LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

do I have to configure MAX to make the CVI program working?

Hi all,

  I am delveloping a very simple CVI program to control digital channels. The program will be used in another computer with pci6713 card installed and labview 7.1 & traditional DAQ installed. I made the distribution including the DAQmx9.7 driver as well as the CVI runtime but the CVI program running in the destiantion computer doesn't work, it crashes when it writes to the channel. The problem is solved by installing the DAQmx 9.7 driver. Now it won't crash any more. However, sometimes when I write to some channels, the error message popped up and tells that the channel was reserved. Is that because in the MAX the device was assigned to traditioanl DAQ? What should I do in the MAX to make it work for my CVI and not affecting the labview code which is usining tradtional DAQ for the same device?

0 Kudos
Message 1 of 5
(3,609 Views)

This may be related to the known issue discussed in this KnowledgeBase Article: How to Re-associate Your Traditional DAQ Device With The DAQmx Driver.

National Instruments
0 Kudos
Message 2 of 5
(3,601 Views)

OK. It seems work. But I still have a problem. In my CVI, I control the external LED on/off by setting a digital HIGH/LOW, but why it only works for once, i.e. when I switch the button (so the callback will send TRUE boolean to the terminal), it will lit the LED. But it doesn't work any more if I switch the button again.

 

p..s in the callback function, I put message popup there, and it does popup the message with the correct value of the button so it means it can trigger the callback without any problem.

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

I can't think of any obvious reason this would not work. Do you have any code that you could post?

National Instruments
0 Kudos
Message 4 of 5
(3,564 Views)

Here is the code

 

#include <userint.h>
#include "iface.h"

#define DAQmxErrChk(functionCall) if( DAQmxFailed(error=(functionCall)) ) goto Error; else    

int write_onoff(uInt8 HL, const char linename[])
{
  int         error=0;              // error code (initialized to zero i.e. no error)
  TaskHandle  taskHandle=0;            // task ID for DAQmx
  char        errBuff[2048]={'\0'}; // error message
 
  /*********************************************/
  // DAQmx Configure Code
  /*********************************************/
  SetWaitCursor(1);
  DAQmxErrChk(DAQmxCreateTask("", &taskHandle));
  DAQmxErrChk(DAQmxCreateDOChan(taskHandle, linename, "", DAQmx_Val_ChanPerLine ));

  /*********************************************/
  // DAQmx Start Code
  /*********************************************/
  DAQmxErrChk(DAQmxStartTask(taskHandle));

  /*********************************************/
  // DAQmx Write Code
  /*********************************************/
  DAQmxErrChk(DAQmxWriteDigitalU8(taskHandle, 1, 1, 10.0, DAQmx_Val_GroupByChannel, &HL, NULL, NULL));
 
  Error:
    SetWaitCursor(0);
    if (DAQmxFailed(error)) DAQmxGetExtendedErrorInfo(errBuff, 2048);
    if (taskHandle!=0)
    {
      /*********************************************/
      // DAQmx Stop Code
      /*********************************************/
      DAQmxStopTask(taskHandle);
      DAQmxClearTask(taskHandle);
    }
    if (DAQmxFailed(error)) MessagePopup("DAQmx Error", errBuff);  
    
  return error;  
} // end write_digital_line


int CVICALLBACK test (int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
{
  uInt8 onoff=0;
 
  if (event==EVENT_COMMIT)
  {
    GetCtrlVal(panel, control, &onoff);
    write_onoff(onoff, "Dev1/port0/line0");
  }    
  return 0;  // return 0 to tell the system the message has been handled    
}

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