Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

PCI 6221 non buffering digital output

Hi

 

I need to generate 4 digital outputs. I am using the PCI 6221 which only has two outputs that support buffering, so I am trying use the non buffered outputs and am sending them one sample at a time. I am having issues with this working at greater than 1kHz. Also, even when running at slower speeds the output signals change in duty cycle, as if there is a PC interrupt. I have tried this using both the DAQ assistant, and initializing the hardware using the DAQmx VIs and then sending one data point at a time to a DAQmx write VI in a while loop. I tried searching, but could not find any example code. Any help would be greatly appreciated!

 

Thank you,

 

Sterling

0 Kudos
Message 1 of 3
(4,304 Views)

I am starting to think it may have something to do with the way I am generating the square wave. What would be the best way to generate multiple square waves, while being able to control phase and duty cycle?

 

Also, with the particular code I attached, I cannot genearte multiple signals. I have tried building an array of the multiple boolean signals, and then changing the DAQmx write VI to multiple signals, single sample, but I don't see any output from the pins.

 

Sterling

0 Kudos
Message 2 of 3
(4,303 Views)

Hi Sterling,

Do you mind if I ask what operating system you are using?

 

Unfortunately, there isn't any good way to deterministically time read/write operations in Windows, you can only set the priority of an application and cross your fingers that something else doesn't come along and hold up the thread.  This is probably why you are running into problems with your duty cycle; basically something else behind the scenes is coming along and stealing your CPU before you write the next value to your DO line.  You can try running your application at a higher priority, but this may cause system instability and you will never really be able to guarantee deterministic timing- this is why the hardware-side buffer on the counter lines you are using exists, to provide precision timing.

 

For this type of application, I would suggest manipulating the clock signals you are generating on your counter/buffered outputs using hardware (flip flops or clock chips like the 555) to give you the timing sequences you need,  though without knowing more about your application I cannot say that that is the best option. 

Tom L.
0 Kudos
Message 3 of 3
(4,259 Views)