LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

continuously update graph

Hi, I have a program that is a flat sequence that runs in a while loop. It consists of various delays and reads one analog channel and updates various digital outputs, none of which are time critical. What I want to do is sample the analog channel approximately every 30 milliseconds and display the result on a graph while the rest of the program is running. The only way i can see to ddo it at the moment is to embed it all throughout the sequence, which is inconvenient and inelegant. I guess what I would like an old-fashiened time interrupt, though I don't think it's practical to try to use a timer on the NI board. Thanks in advance.

0 Kudos
Message 1 of 3
(2,742 Views)

I think I understand what you are doing but posting a VI would have been more clear.  Sounds like you want a state machine with DAQmx running a hardware timed task.  You set it up to sample at a rate of 33 Hz (about 30ms between samples) then in your state machine you ask for the DAQ to return all the samples it happens to have since the last read, then you add those to your graph or chart and continue looping.  You can look at one of the many examples shipped with LabVIEW by going to Help >> Find Examples.  There you'll find several examples that show how to setup and read a hardware timed analog input.

0 Kudos
Message 2 of 3
(2,725 Views)

Dear Dogs_In_Space,

 

I think the question you raise is a good discussion on the difference between a Chart and a Graph.  Charts append data, such that it retains a history of the data.  You might also notice that there is a propety node for Charts; History Data.  Whereas Graphs simply plot the data that it is given.  Thus every time you send data to the graph it has to refresh everything.

 

My general rule of thumb is to use Charts inside while loops as they consume less resources and place Graphs outside of loops as they should get updated once all the data is collected.

 

Hope this helps,

Dr. Robert M. Ward MSci PhD CPhys CLA CPI

Certified LabVIEW Architect M>easurement Badge Measurement Badge

0 Kudos
Message 3 of 3
(2,717 Views)