10-28-2008 03:23 AM
Can someone explain to me how digital waveform work with NI?
I made a physical channel and wired it to a DAQMx create channel then I wired it to a DAQMx Read Digital Wfm 1Chan NSamp and then wired it to a Digital Waveform Graph.
I put the Digital Read and Digital Waveform Graph in a loop.
When I run it, I seem to only get 1 sample on the graph per loop iteration.
The desired output is to add each digital sample as a function of increasing time that can logged and or scrolled back in time to examine what is going on with the signals.
Where is my error?
Attached is my VI.
Any help would be greatly appreciated!
Also another quick question, is there a "comment out" command like // in C or ' in VB? Thanks.
Solved! Go to Solution.
10-28-2008 03:27 AM
10-29-2008 10:40 PM
Hi Henry,
Thanks for the post! It sounds like you are having some trouble with acquiring and graphing digital data using DAQmx and LabVIEW. You are correct that the type of program you have will return a single sample each loop iteration, because you are performing an unbuffered, software-timed acquisition. This means that the program will read a sample for each channel whenever the DAQmx Read VI is called, which is going to depend on how fast the software will execute. Also, when you display this data, the graph will only display the data acquired for that loop iteration (which, in this case, is a single sample).
To accomplish what you wish will take a little bit of extra work and overhead in the software, but you can basically use a shift register and accumulate the samples as your program executes. There is a handy VI made just for doing this sort of thing with digital signals and is called DWDT Append Digital Signals.vi (this can be found in the Functions palette under Programming » Waveform » Digital Wfm). I have created a quick example which you should be able to run that does this. What is actually happening is that the waveform is being rewritten each time with all of the new appended data in addition to the past data. To be able to scroll back and view this data, I have turned off autoscaling on the x axis (if it is on, it will constantly increase and try to show the entire data set all at once) and just selected a window of data to view. Additionally, I have added a horizontal scrollbar to scroll through the data for examination.
And to answer your last question about commenting out code in LabVIEW, this may be done with a Diagram Disable Structure. You will find this structure in your Functions palette under Programming » Structures. Using this structure, you can select a portion of your block diagram to disable, and switch to the enabled state to wire through or add different functionality which will execute. Hope this helps, and best of luck!