01-12-2010 08:55 AM
Hi,
I have a data acquisition of several analog inputs and some digital outputs.
Now I want to log both signal groups in one stream (chart or tdms file) to display and save them when the acquisition is done.
The digital signal should be logged as integer values and have the same timestep dt as the analog signal. This is for better reading of the analog data. How do I need to do that?
I'm using DAQmx driver but couldn't find any solution. As far as I know you can't handle both analog and digital signals in one daqmx-task.
Yves
01-12-2010 09:04 AM
The simplest solution is to wire your DO to spare AI chanels and acquire all at the same time in the same task.
Ben
01-12-2010 09:05 AM
01-13-2010 07:36 AM
@ Ben: Unfortunately I don't have any spare AI. My Device has got 8 DO and 8 AI...
@ Dennis Knutson: I found this vi. But I can't see the path where this should lead me. I don't have a digital waveform yet. Because the DO are switched when a user push a front panel button. Or when the program sets a new state.
Until now I have two separated loops for analog IN and digital OUT. This is certainly not good if I want to "synchronize" the signal groups. I'm actually also trying to change this.
Yves
01-13-2010 07:40 AM
Ok start with the simple and move up...
Have you concidered writing the DO data to an Action Engine(AE) at the same time as you write to the hardware and reading from the AE where ever the AI data is being read?
Ben
01-13-2010 09:09 AM
Yes, moving things to the same loop will greatly simplify matters. There are multi-function examples that you can look at.
If you are not using a digital waveform for a digital output, then you are either using a Boolean array or a numeric for the DO. Either one can be converted to a 0/1 array. The Boolean to (0,1) function can have an array as an input.
01-13-2010 04:44 PM
@ Ben: In fact I'm actually not using AE yet. I just couldn't remember your great Nugget. And didn't know this could lead me to the goal. Even with "fast" running acquisition and outputs (1kHz). And the DO's are set without any prediction.
@ Dennis Knutson: Well in fact I'm already using Boolean array for the DO. And I have it converted to an 0/1 array. But I just couldn't imagine how to write this data into a waveform with a true dt.
It is important for me to have a sinchronisation between AI and DO. This means that both dt should be similar.
Yves
01-13-2010 06:51 PM
Since you have not posted any code, I have to guess and make assumptions. It sounds like you are using an NChan/1Samp DAQmx Write and in that case, you don't have a dt. You would have a t0 and the 'real' dt would be the delta between these times. If you do some synchronization so that you start the analog in at the same time you do the digital write, then using the same t0 for both is easy.
Are you doing an NChan/NSamp read with the analog in or not? How are you actually doing the digital writes? How are you synchronizing the two?
01-14-2010 05:34 AM
Wow, you're really THE master.
For DO I don't have a dt because I'm using NChan/1Samp. And for AI I'm using NChan/NSamp
And that's why I don't have a synchronizing between the two.
I haven't posted any code because it is not cleaned up and it is loaded with other, not relevant function.
Now I have exported the acquisition part to a separeted vi. (LV8.6)
Of course I'm happy for any input.
Yves
01-18-2010 07:14 AM