LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I can't get data from my ohaus scale in Labview

Solved!
Go to solution

Hello everyone,
I want to have my bioreactor system automatized with labview. The problem is that I have an Ohaus scale (R41ME30) connected through a RS232 port but I can't get the weight data or tare it. I can do these things using the software real term so I don't think it is a connection problem, just that I bad labview programmer! There must be something wrong in my code. Could anyone help me with this? I have attached my code and the scale manual. Note that the main code (Rumen reactor control 2) has an initialize subVI to start tp communicate with devices and a Measurement subVI where I wrote the code to read the values in the scale. The pump subVi has the commands to tare the scale.

 

Thank you very much

0 Kudos
Message 1 of 9
(4,832 Views)

Can you connect to the Ohaus Scale this via Hyperterminal or some other program similar to that? I use them here at my work and I've found that "P" stands for the print command via RS-232 and should request the weight from the scale. What model of scale are you using?

0 Kudos
Message 2 of 9
(4,807 Views)

@Eric1977 wrote:

Can you connect to the Ohaus Scale this via Hyperterminal or some other program similar to that? I use them here at my work and I've found that "P" stands for the print command via RS-232 and should request the weight from the scale. What model of scale are you using?


All of the questions you asked are answered in the post above.  Smiley Wink

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 3 of 9
(4,795 Views)

Why do you have the Byte Count set to "1" at every VISA Read? That means you're only reading 1 character, and I'm fairly certain the output you want is more than one character long.

 

You should configure the termination character settings to match on both the balance an in LabVIEW, then you can tell it to read some large number of bytes and it will read until it encounters a termination character.

0 Kudos
Message 4 of 9
(4,787 Views)

I can't open your code to see how you do it.  However you might want to look at the Find Instrument Driver utility in the Tools menu.  Search for Ohaus.  In my version of Labview, I don't see your scale model listed in any of the supported devices list but I don't think it would hurt to download one of them to try.  After all, the drivers are going to use basic Serial commands just as you would do.  SubVI's are already created for the Connection, Get Weight, Zero commands.  You may need to modify the actual command that is sent if it is different than your specific model.  This is not an ideal solution but it's a good start.

 

I would recommend putting a Close port command at the beginning on your code just to make sure the port is closed before trying to connect to it, especially if you are using an outside terminal software for testing.  But also in the event that your code doesn't shut down properly, that port will likely be left open and you might not be able to connect. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 5 of 9
(4,782 Views)

You may want to try working off of and comparing your code to the working code in this forum post

Although it's not the same device (a Ranger 7000 instead of a 4000), it is in the Ranger series, so it most likely has very similar communication. 

R Dahlman

0 Kudos
Message 6 of 9
(4,735 Views)
Solution
Accepted by topic author xavi88

Hello all,

 

Thank you very much for your help. I managed to solve the problem. I basically needed to increase the number of bites that are read in the VISA read and refresh the buffer every time by having a VISA Flush I/O buffer before the VISA write. I also had the subVI inside a time loop with a dt of 100 ms. I had to increase it to 1000 ms

Download All
0 Kudos
Message 7 of 9
(4,695 Views)

Glad that you have it working. Those scales should return a termination charaecter that you don't have to guess at the number of bytes. I didn't see a Configure VISA Port VI so I am assuming that you already know this and I didn't see this in your VI.

0 Kudos
Message 8 of 9
(4,686 Views)

Yes. This VISA I have it in another subVI. I have attached it. 

0 Kudos
Message 9 of 9
(4,683 Views)