Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

usb6259 and digital pattern triggering

Hello,
I want to acquire a continuous stream of 24 bit data that I routed to port0 of an usb6259 board.
An external clock is routed to PFI0.
Since every 64 words I get a sync pattern, I would like to trigger the acquisition on this event.
However, calling "DAQmxCfgDigPatternStartTrig" returns error -200452 "Specified property is not supported by the device or is not applicable to the task".

This is the code:

#define DIG_PATTERN "XX0111001100110101010100XXXXXXXX"

        DAQmxCreateTask("",&gTaskHandle);
        DAQmxCreateDIChan(gTaskHandle,"Dev1/Port0","",DAQmx_Val_ChanForAllLines);
        DAQmxCfgSampClkTiming (gTaskHandle, "/Dev1/PFI0", rate, DAQmx_Val_Rising, DAQmx_Val_FiniteSamps, 64);
        DAQmxCfgDigPatternStartTrig (gTaskHandle, "Dev1/Port0", DIG_PATTERN, DAQmx_Val_PatternMatches);
        while(running) {
             DAQmxReadDigitalU32 (gTaskHandle, DAQmx_Val_Auto, 10, DAQmx_Val_GroupByChannel, gData, 64, &sampsRead, NULL));
             ProcessSystemEvents ();
        }


what is wrong?
Thank you.



Message Edited by atrac on 03-21-2008 06:04 AM
0 Kudos
Message 1 of 5
(3,475 Views)

Hi atrac,

your code is correct, the matter is that the usb6259 (an M-series board) does not support the Digital Pattern Start trigger feature. The only board family, programmable with DAQmx APIs, that is able to accept a digital pattern as start trigger is the 653x; these boards are part of NI HSDIO (High Speed Digital I/O) products.

Let me know if you have other questions,

Best regards,

Fabio

Fabio M.
NI
Principal Engineer
0 Kudos
Message 2 of 5
(3,443 Views)
Greetings Atrac,
 
Fabio is correct in that our M Series products do not support pattern matching. One feature that could help you is change detection, depending on how the your digital waveform pattern changes. http://www.ni.com/pdf/manuals/371022j.pdf Page 6-8 describes how to use the Change Detection feature. You can define per line which state you want to detect (high or low). This is especially useful if you have a valid data bit or a communication bit.
 
Please let us know if you have any further questions.
 
Nathan Yang | Data Acquisition Product Manager | National Instruments
0 Kudos
Message 3 of 5
(3,419 Views)
I'm going to correct myself. After further thought, this won't work for you. Although you can detect per-line state changes, any change in the waveform will trigger the acquisition. Your best option with the current hardware is to do a continuous waveform acquisition (if the rate is not too fast) and do pattern detection in software.
 
Regards,
 
Nathan Yang | DAQ Product Manager | National Instruments
0 Kudos
Message 4 of 5
(3,410 Views)

Thanks for your answers.

I try to explain the application a bit more. I need to acquire 24-bit words at a rate of 800kHz, with an external clock connected to PFI0. I also have to do a little processing: synchronize on a digital pattern (that occurs every 64 samples), discard some selected words after the pattern, and dump the remaining data to disk. Essentially, a it is a software down-sampling.

Initially, I wrote a trivial test program that successfully reads data from the board (and discards those data) at the desired rate, using the callback registered by DAQmxRegisterEveryNSamplesEvent. With successfully I mean that I do not get any buffer overflow.

But, if in the callback I insert a to call fwrite to dump those data to the disk, it seems that the writing to disk (in blocks of nSamples, see below) cannot follow that rate. The timing is very critical and in some conditions I get buffer overflow. The problem seems to be choosing the right combination of buffer size (i.e. number of samples in DAQmxCfgSampClkTiming) and number of nSamples (how many samples in buffer to trigger DAQmxRegisterEveryNSamplesEvent). At this time, I found the best compromise without having too large buffers using buffer size = 8MB and nSamples = (buffer size)/10. But this was set by attempt. What is the rule? What do you suggest? Is it a problem of windows xp latency when accessing the disk? The disk is in DMA mode, and I would expect it to be much faster than the usb bus!

This board has a very small hardware fifo (2047 samples), but is rated at more than 1MS/s, so it should do the job. What is your opinion?

Thank you

0 Kudos
Message 5 of 5
(3,391 Views)