LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to set Decimal Point position from right to left Serial Read Evaluate Number within Range over RS-232

I am new to Labview, I am communicating with a TQ8800 Torque meter via RS-232. The 16 digit data stream is as follows:


D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0


Each digit indicate the following status :
D0 End Word

D1 & D8 Display reading, D1 = LSD, D8 = MSD
For example :
If the display reading
is 1234, then D8 to D1 is :00001234


D9 Decimal Point(DP), position from right to the left
0 = No DP, 1= 1 DP, 2 = 2 DP, 3 = 3 DP

D10 Polarity
0 = Positive 1 = Negative

D11 & D12 Annunciator for Display
Kg cm = 81 LB inch = 82 N cm = 83

D13 1

D14 4

D15 Start Word

 

I am using a modified version of the basic_serial_write_read.vi. I am attempting to parse the 16 digit data stream extracting out the number and whether it is positive or negative. I am having trouble with the decimal point placement. Is there an example that could help me with this? After the number is parsed I am then comparing it to see if it is within +/- 9.2 N cm. If it is then the test passes. I am outputing the data to a file. I have included the vi. Also how can I check for different units of the annunciator. Any help would be appreciated.  Thank you.

 

0 Kudos
Message 1 of 23
(4,683 Views)

Hi gprall,

 

you just use the simple math equation:

value = ("D8 to D1") * 1/(10^D9)

Looks pretty easy…

Best regards,
GerdW


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

Thank you very much for the formula, I really appreciate it. In order to integrate this formula into my vi are you saying I should use formula mode and insert before the Fract/Exp String to Number which outputs to the Mask and Limit Testing?

 

Thank you.

 

 

0 Kudos
Message 3 of 23
(4,662 Views)

I have added the formula using the formula node. When I run the vi I keep getting the -1073807252 error. I have added a delay which was recommended by the help. I have also added the Visa flush buffer but still getting the same error. The comm cable I am using is new, it is connected to back of docking station. I did take my PC out of the docking station and connected directly into the PC trying to limit noise, but still get the error. I have attached my vi and the output data file. Is my Visa buffer in the wrong place? Should it be after the serial? Thanks.

Download All
0 Kudos
Message 4 of 23
(4,616 Views)

What is the definition of the End Word?  You will likely need to figure this out experimentally (the manual doesn't seem to define it).  Whatever it is, you should set that as the termination character and enable the termination character.  That will help you in keeping your messages in sync.  Just tell the VISA Reads to read more than a message should be, something like 30 should work nicely.

 

The error you are seeing is a buffer overload.  This means that the instrument is sending data to you faster than you can process it.  So you need to figure out how to perform the read faster.  File IO is slow.  So you should put that into a seperate loop so that your loop does nothing but read the data from the port as quickly as the data comes in.  Use a queue to send the data from the reading loop to the logging loop.  This is known as a Producer/Consumer.

 

And here is a cleaned up version of your code.  No need for your express VI or the formula node.  Some other general cleaning up also done to make it easier to read.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 23
(4,605 Views)

I have two questions on your revised diagram picture. How did you create the termination char xA? The help says it is a U8 but when I create a U8 I can not enter the hex xA value.

 

Second question what is the box before the pass? I have not been able to locate that box.

0 Kudos
Message 6 of 23
(4,592 Views)

Hi gprall,

 

1. Show the radix of your U8 constant, then change it to hex display…

 

2. InRangeAndCoerce

 

I guess you need to change your "polarity" check: in your specs you wrote "0=positive, 1=negative"…

Best regards,
GerdW


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

The In Range And Coerce function is in the Comparison palette.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 23
(4,577 Views)

Thank you for the added information, I am getting an error on the while loop on the left side "This is a completely unconnected wire." I deleted the wires and redrew them but the error still exists. 

0 Kudos
Message 9 of 23
(4,566 Views)

I chose the remove loose ends and the error went away. What did this do?

0 Kudos
Message 10 of 23
(4,562 Views)