Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

problems creating a finite pulse train

Hi,

I'm trying to create a finite pulse train, but I'm not getting any satisfying results. I based my code on the example provided with nidaqmxbase 3.1:

    TaskHandle  taskHandle0 = 0;
    char        ctr0[] = "Dev1/ctr0";
    float64     freq = 10.0;
    float64     duty = 0.5;
    float64     delay = 0.0;
   
    DAQmxBaseCreateTask("",&taskHandle0);
    DAQmxBaseCreateCOPulseChanFreq(taskHandle0, ctr0, "", DAQmx_Val_Hz, DAQmx_Val_Low, delay, freq, duty);
    DAQmxBaseCfgImplicitTiming(taskHandle0, DAQmx_Val_FiniteSamps, 3);
   
    DAQmxBaseStartTask(taskHandle0);
   
    gRunning = 1;
   
    // The loop will quit after 10 seconds
    time_t      startTime = time(NULL);
    bool32      done0 = 0;
   
    while( gRunning && !done0 && time(NULL)<startTime+10.0 )
    {
        DAQmxBaseIsTaskDone(taskHandle0,&done0);
        if( !done0 )
        {
            usleep(1000);
        }
    }
    DAQmxBaseStopTask(taskHandle0);
    DAQmxBaseClearTask(taskHandle0);

From the documentation and examples I understand that this could should generate 3 pulses on the output of counter0, however I'm getting only a single pulse.

I'm tried both a 6733 and a 6250, on a linux machine with nidaqmxbase 3.1.

What am I doing wrong?

Thanks a lot,
Martijn Sanderse

Software engineer/physicist
www.mapperlithography.com



0 Kudos
Message 1 of 2
(3,728 Views)
Hi,

I discovered that it also seems impossible to connect the counter to an external clock signal on a PFI terminal.
Alternatively I tried writing a digital pattern out, but this also doesn't  work because the external clock on a PFI terminal cannot be used.

In both cases I get a: "DAQmx Base Error: Specified property is not supported by the device or is not applicable to the task.".

The behaviour can be reproduced by running the example "ContWriteDigPort-ExtClk" example in "/usr/local/natinst/nidaqmxbase/examples".

I'm getting the same error when I try to use an external trigger on a PFI terminal. It is a bit of a problem, as I would like to generate a finite pulse train, using an external clock, starting on an external trigger...

Thanks,
Martijn
0 Kudos
Message 2 of 2
(3,705 Views)