Digital I/O

cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 

Triggered Digital Output Sequence

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

0 Kudos
Message 1 of 9
(4,443 Views)

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

0 Kudos
Message 2 of 9
(4,430 Views)

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


0 Kudos
Message 3 of 9
(4,427 Views)

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

 

 

0 Kudos
Message 4 of 9
(4,425 Views)

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

 

 

0 Kudos
Message 5 of 9
(4,421 Views)

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

 

0 Kudos
Message 6 of 9
(4,418 Views)

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

0 Kudos
Message 7 of 9
(4,403 Views)

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.

 

Digital Out retriggerable.png

 

Regards

Pixar

 

 

0 Kudos
Message 8 of 9
(4,393 Views)

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

0 Kudos
Message 9 of 9
(4,391 Views)