ikd Posted October 22, 2008 Report Share Posted October 22, 2008 Hello,<br /><br />I am trying to implement simple control of a Pololu serial controller: <a href="http://www.pololu.com/catalog/product/727/resources" target="_blank">http://www.pololu.com/catalog/product/727/resources</a><br /><br />There are two commands that I am interested in:<br />1. Set speed is achieved by sending a sequence of 5 bytes: 0x80 0x01 0x01 0x00 speed_byte<br />2. Set absolute position is achieved by sending the following sequence: 0x80 0x01 0x04 0x00 pos_byte1 pos_byte2<br /><br />For example speed_byte = 0x10, pos_byte1 = 0x10, pos_byte2 = 0x00.<br /><br />I have attached a sreenshot of my VI.<br /><br />The problem is with first byte sequence write (setting velocity). It fails, but then the second command is executed well (with default speed parameter).<br />When I try to run only the set absolute position command (right after setting properties of port) it also fails. Looks like some portions of the sequence are corrupted.<br /><br />I am using the latest version of NI VISA.<br /><br />Could anyone give a clue of what is happening?<br /><br /> <b>Upd: I have tried to used a serial port debugger, and checked that two programs (Pololu serial transmitter which works correctly and my program) give exactly the same output to the COM-port.<b /> Quote Link to comment
Mellroth Posted October 22, 2008 Report Share Posted October 22, 2008 QUOTE (ikd @ Oct 21 2008, 10:59 AM) ...The problem is with first byte sequence write (setting velocity). It fails, but then the second command is executed well (with default speed parameter).When I try to run only the set absolute position command (right after setting properties of port) it also fails... Sounds like a timing issue. Try to put a msWait node after you have configured the serial port, i.e. don't send your commands directly after the config. /J Quote Link to comment
ikd Posted October 22, 2008 Author Report Share Posted October 22, 2008 QUOTE (JFM @ Oct 21 2008, 03:04 PM) Try to put a msWait node after you have configured the serial port I've tried to put a wait after port configuration, but it didn't help Quote Link to comment
Dan Press Posted October 22, 2008 Report Share Posted October 22, 2008 Mine looks slightly different. This is from some old code, but it does work. Quote Link to comment
jdunham Posted October 22, 2008 Report Share Posted October 22, 2008 I think VISA Serial defaults to a text-oriented mode, where EOL chars are sent automatically at the end of each write. You should be using more VISA properties to make sure all those features are turned off. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.