LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RS232 and how to build some datas into a waveform

Hello everyone !

 

I would like to ask you a question about how to build some datas into waveform.

 

Let's me explain :

Actually, I am working on a project with a PIC.

The PIC sent 3 informations to Laview by RS 232 :'velocity;current;tension\n'

Lynn and Crossrulz help me to make a diagram that allows to read datas and displays them with charts.

It works perfectly.

 

Now, I would like to display some datas from a sensor (dynamic datas)  and double datas from RS232 on the same chart with different plot.

So, I have to build double datas into waveform,  convert double datas into dynamic datas.

I have tried something : I used 'Convert to dynamic data' function but it doesn't work and I don't know why.

Can you help me ?

 

I join you :

- VI

- a gif that shows what's happening

- screenshot

 

Notice : I used 'simulate signal' to represent a sensor

 

Thanks for your help

Download All
0 Kudos
Message 1 of 14
(3,679 Views)

First of all, lets avoid the Dynamic Data Type like its the plague.  It is asking for nothing but trouble.

 

Secondly, look in the Waveform palette.  There is a Build Waveform in there.  A Waveform is nothing but an array of data (Y), a sample rate (dt), and the start time (T0).  If you can supply those, then you can quickly make a waveform.  The chart will take an array of waveforms.


GCentral
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 2 of 14
(3,654 Views)

Hello Crossrulz !

 

Thanks again for your help.

I have found Build Waveform but I get a strange result.

As first step, I have simplified my problem and I have just tried to build a waveform from my datas.

 

Since Build Waveform must have an array as input, I have used  Array Subset.

As result, I don't get a plot but if you pay attention, you can see a little white dot around my value.

 

How can I fix that ?

 

Thanks again

Download All
0 Kudos
Message 3 of 14
(3,634 Views)

Hi Mike,

 

Since Build Waveform must have an array as input, I have used  Array Subset.

And what's the reason for that decision? And what's the reason to use a subset of just one element? Why not use the whole array for your waveform?

 

How many elements do you have in that array?

Your serial port is set to use a TermChar. Does your device use a TermChar? When it does: do you have a TermChar after each sample?

Best regards,
GerdW


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

Hi GerdW !

 

Thanks for your reply

 

               And what's the reason for that decision? And what's the reason to use a subset of just one element? Why not use the whole array for your waveform?


Well, I sent 3 datas (velocity, current, tension). With RS232, we have to consider strings separated by semicolons.
So it is : 'velocity;current;tension'.
With Labview, I converted string into an array then, I used Index Array to get scalars (a scalar for velocity, for the current and the tension) and used a chart to get a plot.

 

Now, I would like to use waveforme chart.
Build Waveforms must have an array as a input and not a scalar. So, I deleted the Index Array and add ArraySubset.
Of course, there is only one element (equivalent to a scalar). But I can wire with that solution. I don't know if there is a better way to solve my problem (I am a beginner in LabView)


I can't use the whole array in the same time because it contains values from different measures (velocity, current and tension)

 

             How many elements do you have in that array?

 

3 elements : velocity, current and tension.
Their values evolves in time

 

What do you mean by TermChar ? 
When I send some datas and create an indicator, I can read some values. It is just when I try to build a waveform, it doesn't work.

 

Thanks for your help

0 Kudos
Message 5 of 14
(3,593 Views)

Mike.Ad wrote:

What do you mean by TermChar ?


A termination character is a character that flags that the message has completed.  An End Of Line is typically the termination character.

 

I think your problem could be that you are not supplying a timestamp to your waveforms.  Use the Current Time to set the T0 for your waveforms.


GCentral
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 6 of 14
(3,588 Views)

Alright, I have used the current time to set the T0 for my waveforms.

Now, I get a proper plot ! Thanks.

 

However, there is still a problem : The Time scale change. 

It is very weird because the minimal value is now 3.4*10^9 instead of 0.

 

How can I fix that ?

 

Thanks again

Download All
0 Kudos
Message 7 of 14
(3,577 Views)

Hi Mike,

 

change the X axis formatting to "absolute time"…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 14
(3,574 Views)

Hi GerdW !

 

You are right !

With "absolute time", the x axis is stable.

Thanks !

 

However, I would like to keep my old format.

 

In the beginning, the X axis fomat was 'Float'. 

What can I do to keep this format and get a proper X axis ?

 

Thanks

0 Kudos
Message 9 of 14
(3,566 Views)

You could read the time right before going into the loop and then subtract the current time from that and use that result as your T0.


GCentral
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 10 of 14
(3,552 Views)