ā08-23-2011 07:11 AM
Hi all,
I am having a problem with digital output generation. I want to output a sequence of six 16-bit words (16 bit unsigend integers)
at the falling edge of a trigger signal, then wait for a certain amount of time (typically 5ms) and then send another
six words and so on.
I am using a NI 6534 card and have already managed to output the words using the DAQmxWriteDigitalU16
to ports 0:1 of the device. The problem now is: If I write the words to some digital output channel (using DAQmxCreateDOChan)
the channel will only write one word at a trigger signal, then wait until the next trigger signal and write another word.
But I want the program to write the sequence of six words and then wait. Has anybody a suggestion how I could manage this?
I am writing in Python (and cannot change to another language) but I basically use the C functions with a wrapper.
Thanks in advance for your suggestions,
Andi
ā08-24-2011 04:10 AM
Hi Andi
What did you use for the parameter numSampsPerChan ?
numSampsPerChan | int32 | The number of samples, per channel, to write. You must pass in a value of 0 or more in order for the sample to write. If you pass a negative number, this function returns an error. |
Regards
Pixar
ā08-24-2011 04:58 AM
Hi Pixar,
I am using a value of 6N numSampsPerChan (I want to write N positions for which I need six 16-bit integers each) because
that's the amount of samples I want to write. Problem is that at one trigger signal there is only one word and not six, as I'd like it,
of my digital channel/task written.
Regards,
Andi
ā08-24-2011 05:42 AM
Hi Andi
Did you use the trigger for triggering an not as a sampleclock ?
Because with the sample clock with each impulse one value will be written to the digital output.
So when you like to use a trigger (retriggerable?) you have to use a onboard sample clock and with the trigger you only start the generation of the samples.
Regards
Pixar
ā08-24-2011 06:52 AM
Hi Pixar,
Thanks again for the fast response. I am new to this stuff. You are right, I am using the falling edges as a sample clock.
This explains the one value.
To the second part. There's a GUI in which the user can give a value for the frequency with which the samples should
be generated. Using the DAQmxCreateCOPulseChanFreq then a pulse train with a certain duty cycle is generated and
at the falling edges of this pulse train the 6 words should be sent.
Any ideas how I could do this?
From what I understand from your suggestion is I should split the data into N sequences of 6 words that are sent when
a trigger signal comes from an onboard clock. (If so, how would I synchronize that with my signal? Or I am getting you
totally wrong?)
Cheers,
Andi
ā08-24-2011 07:41 AM
Hi Andi
As I understand you have a trigger and with each impulse of the trigger you would like to generate your 6 U16 samples for a digital port.
So first you need a sample clock (internal clock), with each rising or falling edge one sample is generated (transfered to the digital output)
Then you need a start trigger, this trigger should be retriggerable so you can generate with each trigger your 6 samples.
So you have to do that:
1. create a digital output task
2. create a timing, use internal clock for a sample clock and a finite number of samples
3. set the trigger
4. set the DAQmx Trigger property start retriggerable to TRUE
5. write the digital output
6. start the task
7. in a while loop check if the task is done
If you have LabVIEW or the possibility to test it I can show you an example for that, it is so much easier.
Regards
Pixar
ā08-25-2011 12:34 PM
Hi Pixar,
thanks for the instructions. I'll only be back to the lab on Tuesday next week, so I am going to try then and will come back to you in any case.
In the lab I also have LAB View available so I would be really gald if you could send me the example you mentioned.
Once again thanks a lot.
Regards,
Andi
ā08-26-2011 03:23 AM
Hi Andi
In LabVIEW go to the example finder (Help -> Find examples). There you can find a lot of DAQ examples, also one for your application.
Regards
Pixar
ā08-26-2011 03:45 AM
Sorry I just recognized that it is not so easy with your device
Trigger Use Cases with the NI 6533 and 6534
Please see the workaroubnd in cae 8 that should be working fine.
Regards
Pixar