04-27-2010 07:39 PM
Hello, I am REALLY new to labview and probably a beginner to programming all together.
I have a problem that is probably already answered but I do not even know what to search for.
My problem:
I am getting data from an instrument once every second and I am reading it every second. For example it will read 1234 (not really) and the next second the instrument will send it again and I will read 1234... but occasionally (like once every 10 min give or take) it will read part of the old data I read and I will get something like 4123...
I read somewhere something about a handshake thing?? I don't know if thats the problem?
Sorry I am really new at this. I have been playing with the visa buffer things, but its all very new to me.
So if you could give me a few links or so and point me in the right direction that would be great! Thanks!!
Solved! Go to Solution.
04-27-2010 07:50 PM - edited 04-27-2010 07:53 PM
Can we assume you are getting serial data (via serial COM port / RS232) from your instrument?
There is a "bytes at port" propertly for the serial VISA functions. Try checking how many bytes are available at the port with this function before reading, and then read all of them.
That way you wont be leaving any bytes in the serial buffer.
04-27-2010 08:12 PM
04-28-2010 03:16 AM - edited 04-28-2010 03:16 AM
It could also be that you are using the default serial port configuration which is configured with a termination character of 0x0A.
If the data being sent from the device happens to contain 0x0A in it, the read function will stop and any remaining data will be left in the buffer until the next read.
If that is the case, you can just set the 'use termination character' input to the 'configure serial port.vi' to False.
04-28-2010 04:18 PM - edited 04-28-2010 04:21 PM
So I fixed the problem. I tried putting the flow control to RTS/CTS. I don't know if this is supposed to be obvious or not but it works now. Thanks for the help!
The only other problem is it sometimes starts with 4123 and will stay that way... but if it starts with 1234 the first time then it will continue working. But I can live with this for now.