I have a USB-1808x, and would like to set up an analog output scan that contains N*M samples. For each input trigger, output N samples, and after M triggers, restart at the beginning. Is this possible? I have it working fine with M=1, but the BIDACTRIGCOUNT setting does not seem to have any effect when I try to have a single output scan cross multiple triggers. Instead, it simply outputs the entire scan on every trigger.
Here is a simplified version of my code showing what I am trying to do:
long rate = 10000;
int numTriggerSamples = 1000;
int numTriggers = 5;
int numTotalOutputSamples = numTriggerSamples * numTriggers;
HGLOBAL winbuf = cbWinBufAlloc(numTotalOutputSamples);
unsigned short *dataArray = (unsigned short*)winbuf;
for (int i=0; i<numTotalOutputSamples; i++) {
cbFromEngUnits(boardNum, BIP10VOLTS, (float)i / numTotalOutputSamples, &dataArray[i]);
}
ULStat = cbSetTrigger(boardNum, TRIG_POS_EDGE, 0, 0);
if (ULStat != NOERRORS) {
return;
}
ULStat = cbSetConfig(BOARDINFO, boardNum, 0, BIDACTRIGCOUNT, numTriggerSamples);
if (ULStat != NOERRORS) {
return;
}
int options = BACKGROUND | EXTTRIGGER | CONTINUOUS | RETRIGMODE;
ULStat = cbAOutScan(boardNum, 0, 0, numTotalOutputSamples, &rate, BIP10VOLTS, winbuf, options);
if (ULStat != NOERRORS) {
return;
}
cbWinBufFree(winbuf);
Question
jms
I have a USB-1808x, and would like to set up an analog output scan that contains N*M samples. For each input trigger, output N samples, and after M triggers, restart at the beginning. Is this possible? I have it working fine with M=1, but the BIDACTRIGCOUNT setting does not seem to have any effect when I try to have a single output scan cross multiple triggers. Instead, it simply outputs the entire scan on every trigger.
Here is a simplified version of my code showing what I am trying to do:
long rate = 10000; int numTriggerSamples = 1000; int numTriggers = 5; int numTotalOutputSamples = numTriggerSamples * numTriggers; HGLOBAL winbuf = cbWinBufAlloc(numTotalOutputSamples); unsigned short *dataArray = (unsigned short*)winbuf; for (int i=0; i<numTotalOutputSamples; i++) { cbFromEngUnits(boardNum, BIP10VOLTS, (float)i / numTotalOutputSamples, &dataArray[i]); } ULStat = cbSetTrigger(boardNum, TRIG_POS_EDGE, 0, 0); if (ULStat != NOERRORS) { return; } ULStat = cbSetConfig(BOARDINFO, boardNum, 0, BIDACTRIGCOUNT, numTriggerSamples); if (ULStat != NOERRORS) { return; } int options = BACKGROUND | EXTTRIGGER | CONTINUOUS | RETRIGMODE; ULStat = cbAOutScan(boardNum, 0, 0, numTotalOutputSamples, &rate, BIP10VOLTS, winbuf, options); if (ULStat != NOERRORS) { return; } cbWinBufFree(winbuf);
5 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now