From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQ external triggered at 5kHz

Hello expert,

I got totally confused as I tried to do some externally triggered DAQ
with my DAQPad-MIO-16XE-50 board.
My problems are the different kinds of counters and timers and functions
to control them.
I added a piece of code, which I think should do the job...

numChans=2;
chans[0]=1;
gains[0]=1;
chans[1]=3;
gains[1]=10;
scanRateDivS[0]=1;
scanRateDivS[1]=127;

DAQ_Config (DEVICE, 0, 2)
^^^^^^^^^^^^^^^^
as far as I understand is the scan interval now externally controlled...
(signals on PFI_7)

Select_Signal(DEVICE, ND_IN_SCAN_CLOCK_TIMEBASE, ND_PFI_7,
ND_HIGH_TO_LOW)
^^^^^^^^^^^^^^^^^^
is this necessary? the manual says the timer generates an IN_START_SCAN
after the specified occurences of signal transitions... whe
re do I
specify this number of transitions???

DAQ_DB_Config (DEVICE, 1)
SCAN_Sequence_Setup(DEVICE,numChans,chans,gains,scanRateDivS,&scansSequence,&sampleSequence)

SCAN_Sequence_Retrieve(DEVICE,sampleSequence,scanSequenceVector);

SCAN_Start (DEVICE, circBuff,circBuffSize, 2, 8, 0, 1)
^^^^^^^^^^^^^^^^
which parameters are to be set here? Is the scan timer in use at all? or
should I just call Select_Signal with ND_IN_SCAN_START routed to
PFI_7???

while (sampLeftToAcq>0 && !kbhit()){
iStat = DAQ_DB_Transfer (DEVICE,halfBuff,&ptsTfr,&status);
if (iStat) break;
iStat = NI_DAQ_Mem_Copy(memhandle, halfBuff, numBytesWritten,
(long) halfBuffSize, 1);
if (iStat) break;
numBytesWritten+=halfBuffSize;
sampLeftToAcq -= halfBuffSize;
}

If I apply a trigger at 5kHz, the Computer locks up and presents Error
12 after removing the trigger signal.
At 2.5kHz everything works fine...

I just want to sample 127 times one channel and then once two channels

externally triggered at 5kHz.
Perhaps anyone could supply me with the essential code for this.


Many thanks, Martin
0 Kudos
Message 1 of 1
(2,581 Views)