Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

updating DIO lines on GPCTR interrupt?

Hi there,

My problem is the following:
Is it possible to update DIO lines on a PCI-6024E board with a minimum accuracy of 0.1 ms using the General Purpose Counter/Timer (GPCTR)?

For my experiment I need to switch several devices (approx. 6) independently with TTL signals. One experimantel run takes 5-10 seconds and in the last few seconds I want to switch several DIO lines with at least 0.1 ms resolution. Typical TTL High times are 20 to 500ms. In a later stadium, I may want to change one or more of the DIO lines by an analog ramp. I already have a PCI-6024E board an would like to use it for this purpose. My measurement PC is a PIII-450 wih MS Windows 98.

My first attempt was to program everything in LabVIEW. I had the GPCTR counting up and a while loop was checking its output to see which DIO line was to be switched. As expected, this turned out to be too slow and too dependent on CPU activity.

My second attempt therefore was to program in C/C++. I'm not too familiar with register level programming, but decided to give it a go.
In the DAQ-STC Tech. Ref. manual I found that the GPCTR generates an interrupt as the counter reaches TC (Terminal Count). So I guess that if I let my GPCTR count downwards for each interval I could use this interrupt to update the DIO lines. To handle this interrupt I need to write an Interrupt Service Routine (ISR), but I do not know how and where to implement such an ISR.

Thanks for any help!
0 Kudos
Message 1 of 3
(2,932 Views)
The DIOs on the 6024E are not hardware timed. Therefore, there is no guaranty that you will get the resolution you asking for. It is totally software timed and depends on your processing power.
However, it you are using LabVIEW, you may want to use timed loop controlled by counters to increase your accuracy. But even then, there is still no guaranty.
The only way to guaranty this is to use a hardware timed DIO device. The M series would do would solved your problem since they can be hardware timed if supplied a sample clock either externally or from the counters. For more information about the M Series, go to http://www.ni.com/dataacquisition/mseries.htm
0 Kudos
Message 2 of 3
(2,899 Views)
Thanks for your input Serges, but I have just solved my problem.
I refreshed my C programming skills a bit and used the comedi package together with the Real Time package RTAI for Linux to latch my DIO lines with a resolution of .04 msecs. So that's even better than I needed. Using RTAI and Comedi proved to be much easier than the register level programming stuff.
I will now integrate this real time "driver" into a LabVIEW vi which will do non time-critical stuff and act as a user interface to the C code.

Lennart Karssen.

Message Edited by lckarssen on 03-07-2005 10:23 PM

0 Kudos
Message 3 of 3
(2,896 Views)