DASYLab

cancel
Showing results for 
Search instead for 
Did you mean: 

RS232 output question

I'm interested in using the RS232 output in DasyLab to communicate with a servo controller.   The data provided by the servo controller manufacturer follows.

The format is 9600 baud, no parity, 8 data bits, 1 stop bit (9600,n,8,1)

You must send the chip 3 data bytes: sync byte, motor/servo number, and motor position
Sync Byte: always 255
Motor/Servo Number: 1 through 8
Motor Position: 1 through 254

I would like to always send the same number for the first two bytes (255 and 1).  For the last byte, i'd like to send the result of a slider control.   Is "2551[b]\r"  the correct format statement for this application?

Thank you,

David


0 Kudos
Message 1 of 4
(7,463 Views)
"255" is "FF" in Hex.

Use \xFF to send 255 to the com port.

If the number is simply ASCII, then keep it as "1", otherwise, you may need to convert it to Hex as well,using \x01.

the b format converts to a byte value.

Let us know if it works.
Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
0 Kudos
Message 2 of 4
(7,408 Views)
I'm using this format string "\xFF\x00[b]".

I'm communicating with a servo controller.  The RS232 portion seems to be working.  However,  the output doesn't respond to the slider input.  If I check the "use value at start" button in the slider properties dialog, then the output will changed to what ever value I put in that box.  However, moving the slider has no effect.   I've set the min to 0.000 and the max to 254.00 with 254 steps.  I do get an error message about 4 seconds after the experiment starts running -> "The data stream is blocked by one of the following modules"

Thanks for the help.
0 Kudos
Message 3 of 4
(7,352 Views)
For completeness, I got it working.  I had to change the experiment frequency to a much lower number (it was set at 10kHz).  I've tested it up to 100hz.

Thanks for the help!

-David
0 Kudos
Message 4 of 4
(7,237 Views)