03-11-2010 10:11 AM
For one-way rs232 transmission, will Serial Write take a string of arbitrary length and split it into individual bytes for transmission? For instance, if I want to send "1023" at 8n1, when converted into binary it would be over 8 bits, so i would have to split this into two bytes for transmission. How would I best do this?
I have experience with the basic serial read write example vi's, but I am not sure exactly how strings are handled by Serial Write... I am not sure if I need to manually take my string, convert it to hex or binary, pad the left w/ zeros to equal 16 bits, and then split this into two strings to send sequentially through serial write OR maybe serial write will do this for me automatically....?
I have posted a similar question in NI hardware (GRIB) thread but I have attemted to clarify my question and have reposted here.
Thank you very much,
Jeff
03-11-2010 10:21 AM
03-11-2010 11:11 AM
thank you dennis, yes i know that this is a simple concept, thank you for emphasizing that.
I will be transmitting ASCII 1023 or hex 3FF, either way since the hardware that is recieving this transmission will be looking for 8n1 and will be converting back to hex, I will probably need to use byte array to string to manipulate the data. I am under the impression that if I give VISA write a 2 byte string, it will only send the first byte, and ignore the rest. So i think that I will need to use byte array to string and send it one byte at a time. I am not sure if you have clarified that point or not, either way I will experiment w/ this and hopefully clarify this for myself.
thank you.
03-11-2010 11:29 AM - edited 03-11-2010 11:31 AM
If you give VISA Write a 2 byte string, it will send 2 bytes.
p.s. ASCII 1023 is not the same thing as hex3FF. ASCII means sending the characters '1', '0', '2', and '3'. Each of those is a byte.
03-11-2010 11:34 AM
okay thank you for clarifying!