LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help to update this DAQmx code

I am doing 2-channel AI acquisition, and I hope to display the data in a waveform chart in a way that at beginning the chart is cleared, and all data are plotted from the left side of the chart.  

Following is the VI I amusing to realize this:




and the data are displayed as what I expected:




This is exactly what I want.
0 Kudos
Message 1 of 13
(3,858 Views)
However, I prefer to use lower level of DAQmx VIs (create channel, timming, start, read.....) for flexibility, but I failed to update above code using those lower level VIs. Looks like above DAQ Assistant output dynamic data, but I can not regenerate dynamic data using DAQmx Read VI.

Anyone can tell me how to use low-level DAQmx VIs to replace DAQ Assistant VI in above code and reproduce the same result?   Note, I need to use DAQmx timing VI to set the rate and triggering from external source.

Thanks a lot for advice.

-Derek
0 Kudos
Message 2 of 13
(3,856 Views)
The original VI using DAQ Assistant is attached here. 

I set 'continuous acquisition', 'rate=25Hz' and 'sample to read=1' as the timing property of the DAQ Assistant.
0 Kudos
Message 3 of 13
(3,855 Views)
A great way to see the underlying code of an Express VI is this:
 
1.  Right click the express VI and click  "Open Front Panel".  A dialog box will ask you if you want to convert.  Go ahead and convert.
2.  The blue express VI becomes a yellow subvi.
3.  Double click the new subVI and it will open up.  Look at the block diagram for it.
 
You can edit the subVI's and save them under a new name if you want.
 
You may want to make a backup copy of your original VI as there is no way to undo the above steps.
Message 4 of 13
(3,851 Views)
Hello Raverns Fan,

Thanks a lot for replying.

I followed what you said, a subvi is generated, and the modified code still do the same function. Great!

Looks like the key is that inside the subvi there is a VI (cloned) which convert arrays of 1D waveforms into DDT. However this VI  is password-protected and I can not see how it is coded. So, I just paste this cloned VI as a blackbox into my code?  Anyway to know the detail of the coding?

Message Edited by Dejun on 08-20-2007 11:10 PM

0 Kudos
Message 5 of 13
(3,848 Views)
Express VI's are a good way to get some code started.  They have a lot of flexibility, but also a lot of overhead.  And they may not have enough flexibility.  But this tip for seeing the underlying code can help see how to generate a string of lower level vi's that would be difficult to figure out on your own from scratch.  And since it is functional code, it gives you a good base to work from to make minor tweaks.
 
From top to bottom opening items in the respective block diagrams:
 
Your VI
DAQ Assistant
small yellow block Convert 1DWFm to DDT.vi  (clone)
very similar but rectangular block sub Waveform Array to Dynamic (clone)
 
I was able to open the first clone to see the lower clone.  But the lower clone sub Wavefrom Array to Dynamic was password protected.  It almost looks like a primitive VI and has underlying code that NI must consider proprietary.  I'm not sure whether it is important to know what is going on inside of it for your situation.
 
I don't really know what is the difference between a waveform and dynamic data.  But by seeing the lower level functions and using context help, you can learn a lot. 
0 Kudos
Message 6 of 13
(3,840 Views)
By studying on the generated subvi, I create following code using low-level DAQmx VIs:



The code runs with almost the same results as the one using subvi, but an exception is I can not auto-scale Y axis when the y-value <=1.0. It scale only when Y-value > 1.0.

ANy hint why this happen?
0 Kudos
Message 7 of 13
(3,838 Views)

I'm glad to hear you are making progress.

I don't see the same behavior as you do on the autoscaling of Y.  Because I don't have any DAQ devices installed in the PC, I created a simulated device in MAX so I could run your code.  It creates a 10 V to -10V noisy sine wave.  I modified your code and added a boolean to keep the simulated signal under 1 V whenever I press the button.  The chart seemed to autoscale just fine once the data greater than 1V moved off the chart.

0 Kudos
Message 8 of 13
(3,813 Views)
 Hi Dejun,

 I've attached a modified example (Cont Acq. & Graph - Int. Clk) to this post, I believe it shows the behaviour you are expecting.
 If not then please post back to this thread.
 I am not sure why your code is exhibiting the behaviour it is, I suspect it's a chart property setting.
 Please take a look at my example when you get a chance.

Ravens Fan: Those are some great tips!

Have a great evening yall.

 Best regards,

MatthewW
Applications Engineer
National Instruments

 

Message Edited by Matthew W on 08-21-2007 10:52 PM

0 Kudos
Message 9 of 13
(3,794 Views)
Matthew,

Thanks a lot for your reply.

Your chart output is not what I need. In your chart the data curve shift rightward, but it is still plotted leftward. However, what I want is the curve to be plotted rightward.

-Dejun

Message Edited by Dejun on 08-22-2007 03:45 PM

0 Kudos
Message 10 of 13
(3,776 Views)