LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to update value readings at string indicator

Hi, new to Lab View and need help on this VI.

 

I am trying to read output from a weighing balance through rs232 serial port.

However I encounter error few seconds later after reading the values.

 

1) How do I know the bytes to read from VISA read (Number of lines changes according to the bytes read, but I only want to update one line continuously)

2) Is there any way to fix the error?

3) How do I fix the value to only update one reading continuously: T + 135.82g instead of hundreds of lines of the same weight

4) Even when I change the weight on weighing scale, the value still remains the same, there seems to be a long delay, how do I fix this?

 

Kindly appreciate your help please.

 

jiahe_0-1657083321167.png

jiahe_1-1657083344558.png

jiahe_2-1657083369272.png

 

 

 

 

0 Kudos
Message 1 of 4
(1,098 Views)

Hi jiahe,

 


@jiahe wrote:

1) How do I know the bytes to read from VISA read (Number of lines changes according to the bytes read, but I only want to update one line continuously)

2) Is there any way to fix the error?

3) How do I fix the value to only update one reading continuously: T + 135.82g instead of hundreds of lines of the same weight

4) Even when I change the weight on weighing scale, the value still remains the same, there seems to be a long delay, how do I fix this?


1. Using the TermChar you can simply request a "too large" number of bytes, like 999…

2. Remove that additional wait in the loop! Immediatly! The device will dictate how fast the loop iterates, by having VISARead wait for the next message…

3. Do some data processing on your own. The scale will provide the current reading again and again…

4. See item 2.

 

Watch this video to simplify/improve your serial port handling!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(1,080 Views)

Hi GerdW,

 

Thank you for your help, I tried shifting the icons into the loop and followed your advice, it works now 🙂

Appreciate your help!

 

jiahe_0-1657242527149.png

jiahe_1-1657242549182.png

 

0 Kudos
Message 3 of 4
(1,017 Views)

Hi jiahe,

 


@jiahe wrote:

Thank you for your help, I tried shifting the icons into the loop and followed your advice, it works now 🙂


Well, it may work for a short period of time…

 

Now you made a big mistake: you open the COM port inside the loop with each iteration again and again, but you only close it once after the loop!

You only need to open the port ONCE BEFORE the loop. And you only need to use VISAConfigureSerialPort, there's no need for an additional VISAOpen afterwards…

 

Another hint: You don't need the UnbundleByName on that error wire, you can directly OR the error with your stop button boolean.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 4
(1,001 Views)