09-22-2015 12:37 PM - edited 09-22-2015 12:50 PM
I initially tried running two case structures simultaneously by applying while loops around each structure, but what happens is that one graph runs normally and the other graph, the x-axis runs too fast and no signals are ploted on the graph.
I need information from two different channels from the same DAQ board (Dev1:Ai16, Dev1:Ai17) to be graphed at the same time.
PS: Also how can I start the x-axis of the graph of x(time)=0?
09-22-2015 12:48 PM
I can't open newer than 2015. I would suggest saving for previous version for more assistance.
You should be reading both of those channels at the same location in your code because they're the same device. Normally, even if they are different devices, you should be reading in the same location. This would allow you to plot them together quite easily.
You can set the timestamp on a graph to display as Relative time.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
09-22-2015 12:51 PM
I uploaded to a previous version of labview!
09-22-2015 12:52 PM
Okay a few things:
You have a total of 4 while loops in your program and none of them are able to stop ever. How do you expect the application to close? How are you going to ensure that a cleanup process happens and your hardware is left is a good known state so it can be used again? Aborting the VI is like crashing your car into a tree to stop it. It will stop it, but in what condition will it be in? You should have a proper way to stop your loops by usig a stop button, or a better design uses the event stucture so you can just close the window but that might be bit complicated with two loops.
So you setup two AI tasks, to use continuous samples, at a rate of 100 hz. Then you start them in parallel. So one will start the other will generate an error. How will you know there is an error? Well you won't, because you don't stop your loops on error, and you have no error handling. Plop down a Simple Error Handler in your while loops and you'll see many errors stating you can't start a task on hardware that already has a task running.
Your device only has one clock, you can only have one task running on it at once. So your top loop runs fine, your bottom won't, or vise versa. You need a task with all channel in that one task. They can go to separate graphs.
Then you read one sample of your 100...why did you tell it to take 100 then just tell it to take one. Then you go into a for loop, with your one sample. Why use a for loop if you only ever have on sample? You then do an average on that one sample, resetting the history each time so your value will not change. Then you apply a filter on that one sample. Then turn that one sample into a 2D array with one sample. Then you add to it in one dimension your target and put it on the chart. Is this really what you want? I'm guessing not. What do you actually want it to do?
I also prefer the waveform graph over chart because there is more control, but you can set the X axis using property nodes.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
09-22-2015 12:57 PM
Yes, you should read both channels with the same DAQ train. You can discard the data of one channel if you don't always need it.
09-22-2015 01:04 PM
How would I create a task with all channels in that task?
09-22-2015 01:05 PM - edited 09-22-2015 01:17 PM
Essentially: Create Task, Create Channel A, Create Channel B, Create Channel C, Start, Read, Read, Read, Read, Read, Read, Read, Read, ...., Stop, Clear
The data comes out as an array of values in order of when you added the channels to the task.
e.g. Create Channel A = ai0:2, Create Channel B = ai4, Create Channel C = ai7. Read will result in an array size 5 with the first 3 values corresponding to Channel A.
This way above is one way, but is the hard way. If all you channels are analog input, then they can all fit in to the same Create Channel input. "Dev1/ai0:2, ai4, ai7, Dev1/ai4, Dev1/ai7"
"Give me six hours to chop down a tree and I will spend the first four sharpening the axe." - Abraham Lincoln
Here are some free training tools primarily focused on LabVIEW and NI hardware to help get started.
-MyRIO Project Essentials Guide (lots of good simple circuits with links to youtube demonstrations)
Learn NI Training Resource Videos
6 Hour LabVIEW Introduction
Self Paced training for students
Self Paced training beginner to advanced, SSP Required
LabVIEW Wiki on Training
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
09-22-2015
01:11 PM
- last edited on
12-20-2024
05:13 PM
by
Content Cleaner
@jkook6 wrote:
How would I create a task with all channels in that task?
Sometimes all you need is read the help. 😄