Jump to content
  • 0

Question

Posted

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

  • 0
Posted

This configuration item needs to be fixed. I tried it with several values and found that the output in my test program was unaffected. I also need clarification about its function; the cbw.h file and UL Help indicate that the count is not the number of triggers but the number of samples output with each trigger. I will contact Engineering for more information and update this post then. 

 

  • 0
Posted

Answer: The USB-1808X does not support the BIDACTRIGCOUNT configuration item. The answer is at the bottom of the USB-1808X UL Help page under the Configuration section. For Retrigger Count, we created .Net functions for BIDITRIGCOUNT and BIDOTRIGCOUNT, but nothing for BIDACTRIGCOUNT. If it was a valid setting for the USB-1808X we would have created a .Net function for it.

  • 0
Posted

Hi JRys, thanks for looking into this.  I understand that BIDACTRIGCOUNT is the number of samples - in my example numTriggerSamples is the number of samples that I want to output with each trigger.

I don't understand what you're seeing that is indicating that BIDACTRIGCOUNT is not supported by the USB-1808.  I am looking at the universal library help, and it specifically says that this is supported:

 

image.thumb.png.ecbc1575bf70e4131db77419cb851d72.png

 

  • 0
Posted

What needs to be clarified is the section above, called Retrigger Count, which lists only the BIDITRIGCOUNT and BIDOTRIGCOUNT. You're right; it reads as if it should work. I just sent an email off to engineering for clarity. I will update this post when I have more information.

 

  • 0
Posted

BIDACTRIGCOUNT must be broken or not supported for the USB-1808X.  I switch to USB-1608GX-2AO, and the same code mostly worked. I couldn't use just any trigger count, increments of 1024 and a buffer size of 10,240 worked best. When I got fancy and tried 1536, it got confused and output 3072. However, 1024, 2048, 3072, 4096, 5120, 6144, 8192, and 9216 all worked great.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...