06-09-2009 05:34 AM
Hello,
I would like to send only 1 byte of hexa code from LabVIEW to a external device using RS-232 (300bits/s, 8-bit data, no parity bit, no flow control) every 500 ms.
The TX pin on the computer should stay at logic 1 level once it finished transmitting the 1 byte of data and wait for 500 ms before transmitting again.
I build a test code below:
The "String 1" output will be connected to the write buffer of the VISA Send. (Please note that the code above doesn't include the delay of 500 ms that I mentioned. Just ignore that for a moment.)
Will this code work as what I described above? I tried it on my project, but I was receiving weird things on the device.
Do I convert the hexa code correctly?
And how the VISA Send transmits the string? Does it include other "unneccessary" strings with the hexa code that I want to send?
Any help will be appreciated.
Thanks.
Solved! Go to Solution.
06-09-2009 05:54 AM - edited 06-09-2009 06:03 AM
U converted to hexadecimal correctly but check the bytes.To which instrument u sending this data.Dont forget to put the delay inside the while loop otherwise its heats up ur processor.
http://forums.ni.com/ni/board/message?message.uid=921526#U921526
06-09-2009 05:59 AM
Hi eddiechai...,
you'll get a string of length 2 so you have 2 byte. You should use the to U8 and the type cast function. (see the attached picture). You have to disable the termination character to get what you want.
Mike
06-09-2009 02:01 PM
Thanks MikeS81,
That is exactly what I want.