LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Not correctly reading serial port data after first cycle

I set up a VI for serial communication using RS232 with a pressure transducer meter. The pressure readings are in a loop along with a series of calculations in that loop. The readout from the first cycle is correct, but i just see garbage characters on every subsequent cycle. The VI was running fine when the loop was just reading the pressure data and not performing any calculations. What could be the reason for this discrepancy.
The OS is windows NT and software is Labview 6.1
Thanks
0 Kudos
Message 1 of 4
(2,714 Views)
Are you using VISA or the old serial drivers. Are you using bytes at serial port to determine how many bytes to read? What data rate? Are you reading strings or converting hex characters? Serial port handshaking or not? Can you post your code?

Sorry for all the questions back at you, but serial comm has many potential problems and you need to provide more details.
0 Kudos
Message 2 of 4
(2,714 Views)
Thanks for your response,
I am using a VISA. The bytes at serial port are fixed, that is for a particular command the response number of bytes is fixed. The read operation in the first cycle (of a loop) is correct but it reads garbage characters for every other cycle. I am using a 9600 baud rate and the meter responds directly in strings, no handshake is used.
Thanks for the response,
PS: The computer with the code is not connected to the net, i will need to transfer it to post the code.
0 Kudos
Message 3 of 4
(2,714 Views)
I never use a fixed byte length. I use VISA Bytes at Serial Port and keep reading until a termination character is read or until there are zero bytes lleft in the buffer. It sounds like you might have bytes left over in the buffer after the first read. One easy thing to try without changing the program too much is to do a VISA Flush I/O Buffer each time before sending the command and then to the read.
0 Kudos
Message 4 of 4
(2,714 Views)