LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RS232 values to graph

Hello,

I would like to ask if you know anyone how to read certain data over serial RS232 port.

Unfortunately I'm just getting started with LabView, but I worked at LabWindows / CVI.
I would need to create the same program in Labview.
Don't know how to implement this data into LabView, so that I can also display it in a graph?
RdData[0].....výška = height
RdData[1].....
RdData[2].....korekce výšky = height correction
RdData[5].....rychlost = speed
RdData[6].....sila1Fx = strong
RdData[7].....sila2Fx = strong
RdData[8].....sila3Fx = strong
RdData[9].....sila4Fx = strong
RdData[10]....zrX1
RdData[11]....zrZ1
RdData[12]....zrX2
RdData[13]....zrZ2
RdData[14]....zrX3
RdData[15]....zrZ3
RdData[16]....zrX4
RdData[17]....zrZ4

Thank you for your help and advice.
Nice day
Download All
0 Kudos
Message 1 of 16
(2,994 Views)

Hi Majk,

 

you get an array of 18 values: when you want to process individual elements from this array you should use the IndexArray function…

Best regards,
GerdW


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

RdData is a char buffer, so every element is a single byte.

You should Type Cast the receive buffer to a U8 array, then index this array to get individual elements.

Moreover: the LabWindows code specify 0xFF = 255 as the termination character: you should do the same when calling VISA Configure Serial Port.

I think you should also make sure you did not receive an incomplete packet (easy if you know what's the packet length).

 

example.png

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 3 of 16
(2,977 Views)

Hello pincpanter,

 

I didn't think of that. That could work.
Unfortunately, as I wrote, I can't do much in labview, I'm an amateur.
How do I insert a U8 Array? And [d255]?

Then I'll try it that way.

Thank you for your help.
0 Kudos
Message 4 of 16
(2,957 Views)

Drop an array shell

Put a numeric in it.

Right click and select "representation" 

Select U8.

 

Also there is a function "String to byte array" which will do the string -> U8 array conversion.

0 Kudos
Message 5 of 16
(2,952 Views)

To wire a constant to a subvi, right click on the desired input terminal and select Create Constant (or Control or Indicator depending on what you want to do). For integer constants/controls/indicators, the display format is usually decimal (d), however you can explicitly show it right-clicking on the constant and selecting Visible Items -> Radix. Then you can select the radix clicking on the symbol (d, x, etc).

Also, if you don't find a function in the palette, you can try to use QuickDrop: type Ctrl-spacebar and search a text in the list that will show up.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 6 of 16
(2,947 Views)

deceased:

You mean this here?

array.jpg

 

pincpanter:

 

Thank you, I found the radix, but not the right array.
I apologize for the shortcomings.
0 Kudos
Message 7 of 16
(2,935 Views)

Yes, it's the right function

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 8 of 16
(2,929 Views)
And to create U8 Array, do I have to enter a constant?
0 Kudos
Message 9 of 16
(2,926 Views)

Hi Majk,

 


@MajklS wrote:
And to create U8 Array, do I have to enter a constant?

This really is explained in the LabVIEW basics - see the "Training resources" offered in the header of the LabVIEW board…

 

  1. place an array constant in the block diagram
  2. place a numeric constant inside the array constant
  3. change the representation (aka datatype) of the numeric constant to "U8" (via right-click menu)

You're done.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 16
(2,922 Views)