08-21-2014 03:48 PM
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
08-21-2014 06:35 PM
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.
08-22-2014 04:12 AM
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
08-22-2014 04:50 AM - edited 08-22-2014 04:50 AM
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?
08-22-2014 08:01 AM
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
08-22-2014 08:23 AM
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.
08-22-2014 09:24 AM
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
08-22-2014 09:25 AM
08-22-2014 09:38 AM - edited 08-22-2014 09:44 AM
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
08-22-2014 10:09 AM
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.