03-05-2015 06:53 AM
Hello friends,
I have a force measuring instrument connected to CPU using RS-232 cable. I use the labview program made using VISA write and read. I get correct force readings. But my problem is that I get higher values of "bytes at port" reading. The instrument sends maximum 16 bytes but I see 4065 or something greater than 16byte. I can even see the COM port in MAX. Why is that happeneing? How to solve this?
Thanks
Ashnu
03-05-2015 07:02 AM
That sounds like the instrument is streaming the data, meaning it is just constantly sending measurments to you. And with that delay in there, you can get some really large number of bytes in the buffer.
What is the instrument you are using? What is its command structure? Most instruments will send and End Of Line character or something like that to tell the reciever that the message is done. That is called a termination character. You may want to enable the termination character and not use the Bytes At Port at all. Instead, just set the number of bytes to read for the VISA Read to something like 20 bytes (since the maximum message is 16 bytes).
03-05-2015 08:30 AM
Hey crossrulz,
Thanks for the reply.
The instrument name is: PCE-FG series.
The command structure is: \n or \r
I did the changes as you said and everything works fine. I have a very basic question please clear it to me. When I put an indicator for the numberr of bytes out of the read buffer, I see constant 16 bytes always. Isn't it suppose to vary? Because as per the PCE-FG manual each byte has a meaning. I have attached the manual too.
03-05-2015 08:56 AM
ashnu wrote: I have a very basic question please clear it to me. When I put an indicator for the numberr of bytes out of the read buffer, I see constant 16 bytes always. Isn't it suppose to vary?
The numeric outpuf of the VISA Read is the number of bytes read with that read, no how many bytes are actually available. So if every message is 16 bytes, then that output will always be 16.
03-05-2015 08:56 AM
03-05-2015 09:45 AM
Thanks guys!
Please clear me one more doubt.
I am getting an output as say 7.7 so am i not suppose to get 3 bytes as output instead of 16 bytes from VISA read??
Else, does the 16 bytes mean, the instrument is sending 16 digits or character but I am not able to see all those values (i.e. I am missing few digits)?
Thanks a lot for your patience. 🙂
03-05-2015 11:50 AM