02-07-2014 06:36 PM
Hi,
I find myself running into a slight porblem. I have an array of bytes which are in hexadecimal and i need to be able to write them to the serial port so that a stepper motor can be controlled. I have accumulated the array of bytes and converted them into a string using the 'byte array to string' vi, but for some reason i find myself unable to communicate with the stepper motor. I have successfully communicated with the stepper motor using RealTerm by sending hex commands, but it still won't work in LV. Once the array was converted into a string i then "unconverted" it back to an array of bytes just to make sure that the correct string was getting to the write buffer, and it seems to be just fine. I have included an image and the vi. Any input would be greatly appreciated.
David
02-07-2014 08:23 PM
Does your stepper motor want actual binary hex commands or ASCII Hex commands? I'm guessing it wants ASCII Hex commands since you are currently sending it binary hex commands. So use the Number To Hex String on your data instead of the Byte Array to String.
02-08-2014 12:04 PM
Thanks for the quick reply!
The stepper needs binary hex commands. When I send the ASCII hex commands in a terminal program or if I don't specify that the values are hex (with the 0x prefix) then the motor driver will not respond. I have also tried manually converting the hex values that I am trying to send and sending them in decimal through a terminal program, and this also works, so I'm pretty confident that the motor wants real binary commands and not just ASCII. From what you've seen of my VI, does it look like what is getting to the serial port is the binary hex commands?