03-11-2013 08:13 PM
I have a 3 axis accelerometer that sends data thru Serial. In the VI attached I can plot in real time one axis when I send data in the format:
3
6
8
5
4
3
The problem is that I want to plot all 3 axis (in 3 differents graphs) and I don't know how to do that. The accelerometer sends the data of the 3 axis in the format:
X=4 Y=3 Z=7
X=3 Y=1 Z=6
X=2 Y=8 Z=3
X=8 Y=1 Z=10
What modifications to the attached VI should I make to plot all 3 axis in real time?
Thanks
03-11-2013 08:27 PM - edited 03-11-2013 08:27 PM
You need to replace the Decimal String to Number with a Scan From String so that you can get all 3 values. You'll need to bundle the 3 values together and wire the cluster to the chart. Converting to dynamic data is silly. Since you are specifying that the string is terminated with a line feed, you can wire an arbitrary number to the bytes to read - as long as it is greater than the expected string. And make the bytes to read a U32. The bytes read should be a U32 as well. Do you know you can create a control/indicator with a right click on the terminal of the function?
03-11-2013 08:28 PM - edited 03-11-2013 08:30 PM
Your present code only places a single dot on the graph as it is a scalar value which is written to the waveform chart.
Before offering any suggestion, I would need to know if you wish to plot the values as you are reading them or after you read them.
You present code wants to plot the values as you read them, if they were in an array, of course.
Do you know how many values you plan to read or is this gathering data over an extended period of time with an undefined number of samples?
EDIT: Hi Dennis, I am not sure that the accelerometers actually write X=4 Y=3 Z=7, but I could be wrong.
He also needs to build an array since he is only passing a single value at a time to the chart. 🙂
03-11-2013 08:37 PM
I'm just going by what the op said (X=4 Y=3 Z=7). If that's the format, then the op needs to clarify
03-11-2013 09:03 PM
Thanks Ray.R and Dennis_Knutson for the fast answer.
Actually I can choose the format that the accelerometer sends the data. Can be:
X=4 Y=3 Z=7
X=3 Y=1 Z=6
X=2 Y=8 Z=3
or
4 3 7
3 1 6
2 8 3
I want to plot the values as I'm reading them (real time).
I'm getting data over an extended period of time with an undefined number of samples.
03-11-2013 10:17 PM
03-11-2013 10:55 PM
03-11-2013 11:03 PM
03-12-2013 07:59 AM
vitor,
you have not answered my question:
@Ray.R wrote:
Your present code only places a single dot on the graph as it is a scalar value which is written to the waveform chart.
Before offering any suggestion, I would need to know if you wish to plot the values as you are reading them or after you read them.
You present code wants to plot the values as you read them, if they were in an array, of course.
Do you know how many values you plan to read or is this gathering data over an extended period of time with an undefined number of samples?
03-12-2013 08:24 AM
Ray.R
I answered you question in the previous post. I want to plot the values as I'm reading them.