Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

how to use internal clock for reading or writing of digital signal for NI -6229 PCI Cards

i am using NI 6229 PCI cards for reading digital signal from MicroController .
how can i use internal sample  Clock for this purpose?  i am using M-series one and using DAQmxReadDigitalU32 function to read.

Message Edited by Ganga on 02-17-2006 05:23 AM

0 Kudos
Message 1 of 7
(4,818 Views)
Hi Ganga-
 
I'm guessing that you're using the ANSI C API based on the function you mention.  This example shows how to use one of the counters on your device to generate a sample clock for digital input.  With M Series, there is no timing engine dedicated to the digital I/O portion of the device, so you must use a clock from a different source.  You could also correlate the DIO operation with a different sample clock such as the analog input clock as shown here.
 
Hopefully this helps-
Tom W
National Instruments
0 Kudos
Message 2 of 7
(4,799 Views)

Hi Tom,

Thank u for your suggestions.i am having problem what to use input for DAQmxCfgDigEdgeStartTrig function.

there we are indicating that /Dev1/PFI0. what type of signal should be given at  this port?and how can we obtain continous samples?

Actually i am trying to measure  ON-time & Period of a digital signal.so i am giving Digital Input at Dev1/port0/line0.here i am making use of only one line. and i am using sample clock generated by Counter0 to sample digital input at continous interval.

is there any better method to acheive this?

 

0 Kudos
Message 3 of 7
(4,793 Views)

Hi Ganga-

The /Dev1/PFI0 line is configured for a digital start trigger in this case.  If you do not need triggering then you can simply comment this line out. 

In order to switch to continuous operation, you only need to change the "DAQmxErrChk (DAQmxCfgSampClkTiming (taskHandleDig,"/Dev1/Ctr0InternalOutput",rate,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,sampsPerChanToAcquire));" to indicate continuous sampling by "DAQmx_Val_ContSamps" .  More information is available in the NI-DAQmx C Reference Help (Start>>Programs>>National Instruments>>NI-DAQ).  A similar change is necessary to configure the counter for continuous generation in the "DAQmxErrChk (DAQmxCfgImplicitTiming (taskHandleCtr,DAQmx_Val_FiniteSamps,sampsPerChanToAcquire));" function.You would then also need to update the example to call the DAQmxRead function multiple times in a loop to ensure that you do not overflow your input buffer.

If you are trying to measure pulse characteristics you would be better advised to use one of the counters on your device.  "On time" measurements are more commonly referred to as pulse width measurements and are demonstrated by the example "C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Counter\Measure Period or Pulse Width\Pulse Width".  Period measurements can be performed as in "C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Counter\Measure Period or Pulse Width\Dig Periods-Buff-Cont-High Freq 2 Ctr". 

The first example shows a "single shot" measurement while the second shows a buffered measurement that requires a clock to repeatedly sample data at specified intervals.  Both schemes will work well for either measurement type.  As before, the clock can be generated by the second counter on your device.  If you are making the measurement with counters, you will need to be careful to perform continuous pulse train generation because a finite pulse train requires the use of both counters and would preclude the period and/or pulse width measurement from being taken.

Hopefully this helps-

Tom W
National Instruments
0 Kudos
Message 4 of 7
(4,778 Views)

Hey, can you give me an example for correlated digital o/p using counter as clock in LV 8.2? I am also using USB 6229..

Vinoth

0 Kudos
Message 5 of 7
(4,378 Views)
Hi,
 
Please see this example code: http://zone.ni.com/devzone/cda/epd/p/id/1566
 
Hope this helps!
Abhinav T.
Applications Engineering
National Instruments India

LabVIEW Introduction Course - Six Hours
Getting Started with NI-DAQmx
Measurement Fundamentals
0 Kudos
Message 6 of 7
(4,367 Views)

Hi Abhinav,

That example code was helpful.Thanks a lot.

Vinoth

0 Kudos
Message 7 of 7
(4,355 Views)