Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem: PCI-6281, external clock, digital start trigger

Hello,

I am trying to write an application that will acquire data using the 18-bit PCI-6281 board, external sampling clock and digital start trigger.

I am using Borland C++ Builder 6 with NI-DAQmx 8.1.

As a first try, I modified the "ContAcq-ExtClk-DigStart.c" example program to accept an external clock signal through PFI0, and digital start trigger through PFI13. The task starts without any error messages, but when the program is running, the digital trigger is not recognized. If the internal clock is used, the digital trigger is recognized.

The external clock rate is 576kHz. (Maximum sampling rate of the PCI-6281 with a single channel is 625kHz.)

Below is a code snippet showing the task configuration code:

const int gSampleRate = 576000;
const int gSamplesToRead = gSampleRate / 10;


    /*********************************************/
    // DAQmx Configure Code
    /*********************************************/
    DAQmxErrChk (DAQmxCreateTask("DigitalTriggerTest",&taskHandle));
    DAQmxErrChk (DAQmxCreateAIVoltageChan(
        taskHandle, "Dev1/ai0", "",
        DAQmx_Val_Cfg_Default, -10.0, 10.0,
        DAQmx_Val_Volts, NULL));

    /*
    // Program works with internal clock
    DAQmxErrChk (DAQmxCfgSampClkTiming(
        taskHandle, "",
        gSampleRate, DAQmx_Val_Rising,
        DAQmx_Val_ContSamps, gSamplesToRead));
    */

    // Program will not work with external clock source
    DAQmxErrChk (DAQmxCfgSampClkTiming(
        taskHandle, "/Dev1/PFI0",
        gSampleRate, DAQmx_Val_Rising,
        DAQmx_Val_ContSamps, gSamplesToRead));

    // Set up digital start trigger
    DAQmxErrChk (DAQmxCfgDigEdgeStartTrig(
        taskHandle, "/Dev1/PFI13", DAQmx_Val_Rising));

    DAQmxErrChk (DAQmxRegisterEveryNSamplesEvent(
        taskHandle, DAQmx_Val_Acquired_Into_Buffer,
        gSamplesToRead, 0, EveryNCallback, NULL));

    DAQmxErrChk (DAQmxRegisterDoneEvent(
        taskHandle, 0, DoneCallback, NULL));

    // Manually configure the input buffer.
    DAQmxErrChk (DAQmxCfgInputBuffer(
        taskHandle, gSampleRate * 5)); // 5 second buffer


Why is the digital trigger not recognized when the external clock is used? Is this a hardware limitation

Thanks very much,
Markus Svilans.

0 Kudos
Message 1 of 4
(3,313 Views)
Markus,
 
Have you tried an external clock example without a digital trigger?  It almost sounds like the triggering is working fine but it's not detecting a clock signal on PFI0.  Is your external clock signal a TTL 0 to 5V pulse?  One way to see if the board is even getting a signal for your external clock would be to open up a test panel for your device in MAX and look at the input signal on Port 1 line 0 (this corresponds to PFI0).  But to answer your question there is no limitation of our boards that wouldn't allow them to do a digital trigger on an externally clocked task.  I ran the equivalent example program in Labview and it worked great for me.
 
Hope this helps,
Justin D.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 4
(3,292 Views)
Hello Justin,

Thanks for your response.

My application works perfectly with the external clock, without the digital trigger. The application has been extensively tested with the external clock, and that is how I have been running it until now. Recently there was a new requirement to synchronize to an external device that outputs the digital trigger. I thought it would be simple -- so I added the digital trigger code to the application, and it then nothing works!

I then tried the external clock, external trigger example program, to make sure that it wasn't my application at fault. The same thing happened -- when I modified the external clock parameters to match those of my application, even the example program would not work.

Are there any other causes for the problem? Is it possible that I have a defective board?

Thanks,
Markus.

0 Kudos
Message 3 of 4
(3,280 Views)

Markus,

I copied and pasted your code into one of our example programs and it seemed to work fine for me.  Just for the heck of it could you try and run my code to see if it works for your system.  It's probably the same as your code but it might be worth it to give it a shot.  The only thing that I had to change once I copied and pasted your code over the example code was to change the "EveryNCallback" function to read in more samples and have a bigger buffer.  Also, to make this example a little simpler you could use the counter I/O test panels in MAX to generate an external clock instead of using your internal clock.  This is what I did when I ran your code.

If this example will not work for you then this narrows down your problem to either something in the hardware or something in an external signal connection.  Just for the sake of debugging, could you move around your triggering and external clock lines to see if any other lines work for these purposes?  It seems really odd that the external clocks and triggering would be working separately but not at the same time.  Maybe one of those PFI lines is damaged in some way.

Hope this helps you,
Justin D.
Applications Engineer
National Instruments

0 Kudos
Message 4 of 4
(3,264 Views)