Quantcast
Channel: Counter/Timer topics
Viewing all articles
Browse latest Browse all 1271

Keeping generated pulses in sync with an external clock

$
0
0

I am using a PCI-6602 card with Windows 7 and the ANSI C library.

 

I need a continous 100 HZ output to remain in sync with an external 1 HZ clock.

I started with the example at http://www.ni.com/example/27415/en/

If I send 99 pulses out I can retrigger each second without a problem

If I send 100 pulses out the next retrigger is missed and pulses go out every other second.

I there a way to get around this?

 

 

    TaskHandle  taskHandle=0;
    char *      chan           = "Dev1/ctr0";
    float64     duty           = 0.5;
    float64     freq           = 100;
    uInt32      idle           = DAQmx_Val_Low;
    float64     initDelay      = 0.0;
    uInt32      edge           = DAQmx_Val_Rising;
    char        *triggerSource = "/Dev1/PFI19";
    uInt32      numSamples     = 100; 

    DAQmxCreateTask("",&taskHandle);
    DAQmxCreateCOPulseChanFreq(taskHandle,chan,"",DAQmx_Val_Hz,idle,initDelay,freq,duty);
    DAQmxCfgDigEdgeStartTrig(taskHandle,triggerSource,edge);
    DAQmxCfgImplicitTiming(taskHandle,DAQmx_Val_FiniteSamps ,numSamples);
    DAQmxSetStartTrigRetriggerable(taskHandle, 1);
    DAQmxStartTask(taskHandle);

 


Viewing all articles
Browse latest Browse all 1271

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>