Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to read from OHAUS Ranger 7000 serial communication

Solved!
Go to solution

Hello,

 

I am trying to read data from an OHAUS Ranger 7000 scale. The communication is through a virtual USB port (drivers came along with the scale). I have configured the port as per serial settings from their manual. But for some reason I am not able to read any data. The process is either timing out or I read 0 bytes data. I have attached the code snippet here. I would really appreciate any suggestions on this. 

 

Thanks

Naren

0 Kudos
Message 1 of 7
(5,000 Views)

Additional information on that..

I know the scale is talking to the computer because I could read data using their commercial software. The serial port configuration in their software is the same I used in the LabVIEW program. It's only using labview VISA, I am not able to read data. Is there anything wrong in the way I configured VISA?

 

0 Kudos
Message 2 of 7
(4,998 Views)

you are probably waiting too little in the while loop.

try 1000ms instead of 10 and decrease until acceptable.

even better to use the endcharacter instead of bytes at port.

When you know what is sent use more bytes to read and the reading will stop at the defined endcharacter.

 

good luck

greetings from the Netherlands
0 Kudos
Message 3 of 7
(4,989 Views)

Thanks Albert for the suggestion. I had already tried using term char and specifying 50 bytes for read (string is about 23 chars) instead of bytes at port. That did not work either.

0 Kudos
Message 4 of 7
(4,985 Views)

You have a few errors in your snip (a snippet would be better! see menu>>Edit>>Create Snippet from VI Selection)  First you are using a 0x0A term character- that should be 0x0D or Decimal 13 per table 5-1 of the instruction manual.

Next, the serial port configure.vi will flush the recieve buffer so the flush you have in there is not doing anything.

 

Why do you believe that the scale should just start sending data?  Have you read section 6 of the manual?  You do need to send a command to the device to get responses.  Are configured for MT-SICS or OHAUS commands (It seems like OHAUS is default) did you send a "CP" to start contineous printing? I bet the vendor supplied application did!  

 

So, you are not set to terminate reads on the correct character and you have not sent a command to start sending data.  Either of these will result in timeouts.  Once you correct those defects get rid of the "Bytes at port" property read and let VISA do its thing reading until the term character is seen.


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 7
(4,970 Views)

Thanks Jeff for the suggestions. I had tried these options too.

The manual says data output is terminated with CRLF. Since it's multiple char termination, I used LF as term char in configuration and then planned to parse the read buffer to remove CR. Any case, I tried with other term char i.e. 13 as well. It did not work.

I had also tried sending a write command first and then read data bytes until term char. That did not work either. I am getting a timeout at Read in all these cases.

I am not able to find any other reason why it shouldn't work.

 

I am attaching the code snippet for reference.code.png

0 Kudos
Message 6 of 7
(4,946 Views)
Solution
Accepted by topic author vnaren3

I tried couple of things and figured out the mistake. The program worked when I wrote the commands one byte at a time.

 

final.png

0 Kudos
Message 7 of 7
(4,930 Views)