03-26-2010 11:09 AM
I have a NI PCIe-6363 card, and I need to repeatedly write a pattern to an analog output. Later in the program I need to read analog data, but I would like to read this syncronized with the one full write buffer, so the read should start when the write restarts.
As an example, I would continously write 100 samples with 1000 Herz on the Device, the program runs, and the data is continously written. At a later point want to read the analog input during one full run of the write pattern (100 samples, 1000 herz, Triggered by the restart of analog output).
Is there a signal that I can use as trigger each time the analog output rewrites the buffered signal?
Thanks a lot,
Timo
03-29-2010 03:54 AM
I'm not quite sure that i get what you are trying to do, but have you looked at the DAQmx trigger.vi? Check out the examples on DAQmx synchronization to learn how to use it.
03-29-2010 11:12 AM
Hi Timo,
There is not a HW signal that indicates when you are starting over from the beginning of the output buffer.
It sounds like what you want is to acquire 1 sample of AI every time the AO buffer regenerates. What I would do here is synchronize my AI and AO, then read back N samples from the AI task in a loop (however many are in the output buffer). Then you would just need to index out the first sample of the array which would correspond to the first sample in the AO buffer.
Best Regards,
03-29-2010 11:17 AM
Sorry for not being clear enough.I will try to explain my problem a bit better:
I have a certain sequence that I need to write to the analog output (lets say one period of a sine wave), and I want that this is continously repeated until the end of the program. Later during the program, I want to read analog input data, but that has to be synchronous with the analog output signal. So I want that a subroutine waits until the AO restarts the generation of the since wave (since this is continous), and just when it restart I want to read one period of data using the analog input. The trigger vi allows to start reading and writing at the same moment. But I would need a trigger signal that is telling me that the write buffer is finished and restarting. I could not find this and I wondered if such a signal exists?
best,
Timo
03-29-2010 11:26 AM
Hi John,
thanks for your reply.
Well, your idea sound good, but I am afraid it would burst my buffers. I want to prepare a certain situation, this has to run for some time, and then later (some minutes), I want to get the AI just during one output buffer sequence. I dont want to disturb the system by stopping and restarting the sequence. Since I am generating and recording with 100 kHz on 4 channels, recording all the data in the intermediate would take too much space. It there a way to start a clock with the frequency of just the time my output buffer needs to write, and then use this clock as a trigger at some later timepoint?
Thanks again,
best,
Timo
03-29-2010 11:42 AM
Hi Timo,
Let me try to clarify what your application is exactly
- Generate 4 channels of AO Continuously at 100 kHz (regenerating a finite buffer repeatedly).
- Acquire on an AI channel for a finite duration at 100 kHz from the start to finish of a single output buffer.
100 kHz isn't terribly fast, you could acquire the AI continuously and just choose to log the data to the file whenever you wanted to. I still suggest something like this:
1. Synchronize AI and AO to the same sample clock
2. Read back N Samples per loop iteration for your AI task (each read will correspond to one output buffer size).
3. The data being read can be thrown away until you are ready to log to a file (you could monitor the data on the front panel if you wanted to).
4. After the desired time has passed, user can select to log a single buffer to a file.
If you don't like the above method, you could instead use a Counter Output to generate a pulse every N samples of your AO sample clock, and could use this to trigger the AI at a later time.
Best Regards,
03-30-2010 04:05 AM
Hi John,
thanks for the suggestion. I was not aware that I can just throw away the data in the continous loop. I thought that the programm might then be trapped in the loop that is reading the info. I will try to do it as suggested. Maybe I will have to come back to you with a sample vi, just if I don't get it done right.
Thanks again!!
Timo