Quantcast
Channel: LabWindows/CVI topics
Viewing all articles
Browse latest Browse all 5417

Control of USB-6008OEM1 board does not work unless the Measurement and Automation Explorer, Test Panel "Start" button is clicked

$
0
0

The following code is being used to control a USB-6008OEM1 board, the code works, but, if the board is powered down then back on, this code does not work until the Measurement and Automation Explorer, Test Panel "Start" button is clicked.  

 

For example, the code below is standard code to set digital outputs.   The output is not set until the Measurement and Automation Explorer, Test Panel "Start" button is clicked.

 

I am curious what functionality does the "Start" button perform.

 

Specifically, using the NIDAQmx.lib and NIDAQmx.h in this C++ code example, does anyone know what API equivalent calls is being used when the "Start" button is clicked?

 

Here is the sample code (very basic):

 

void DigitalOut(int line, bool on)
{
 TaskHandle h(0);
 int32 nErr = DAQmxCreateTask("Digital Output Task", &h);
 char szTerminal[256];
 sprintf_s(szTerminal, 256, "/Dev1/port0/line%d", line);
 
 uInt8 nData = 0x00;
 int error(0);
 uInt8 data[1];
 data[0] = (on == true) ? 1 : 0;
  
 int32 numSampsPerChan = 1; 
 bool32 autoStart = 0; 
 float64 timeout = 10;
 bool32 dataLayout = DAQmx_Val_GroupByChannel; 
  
 DAQmxCreateDOChan(h, szTerminal, "write digital out", DAQmx_Val_ChanPerLine);
 DAQmxStartTask(h);
 int32 nDOErr = DAQmxWriteDigitalLines(h, numSampsPerChan, autoStart, timeout, dataLayout, data, NULL, NULL);
 DAQmxStopTask(h);
 DAQmxClearTask(h);
}

 


Viewing all articles
Browse latest Browse all 5417

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>