Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

DACmxCreateTask() call hangs

I'm trying to use the PCI-6514 for a low speed digital IO control application. All I need is a license free way to access the IO from VB or a C++ DLL called from VB.

I've tried running the demo app VC_WriteDigPort.dsw. It appears to work
after I changed the channel name to the name that I'd set up.

I then took the code and inserted it into my application. The
DACmxCreateTask function doesn't return. The application hangs inside the
call and I have to stop the application from the VC menu. My application is
written in VB 6.0, calling a VC++ 6.0 DLL, which contains the call to NI's
library functions. See enclosed C++ class.

Don't know how to get the driver version. Masurement and Automation version
supplied with board given below.

Software Details: Visual C++ version N/A
NI Hardware : Digital Input/Output device PCI-6514
Driver Version : Meas and Aut 3.1.0.3021
Operating System: Windows XP

NI6514::NI6514()
{
int iError = 0;
m_hTask = 0;

if ( DAQmxFailed( iError = Configure_WriteDigPort("Dev1/port4",&m_hTask)) )
{
return;
}
if ( DAQmxFailed( iError = Start_WriteDigPort(m_hTask)) )
{
return;
}

m_boOpen = true;

}

int32 Configure_WriteDigPort(const char chan[], TaskHandle *taskHandle)
{
int32 error=0;

/*********************************************************************
* 1. Create a task.
* 2. Create a Digital Output channel. Use one channel for all lines.
* In this case, the port itself acts as an individual channel.
*********************************************************************/
error = DAQmxCreateTask("",taskHandle);
// DAQmxErrChk (DAQmxCreateTask("",taskHandle));
DAQmxErrChk (DAQmxCreateDOChan(*taskHandle,chan,"",DAQmx_Val_ChanForAllLines));
Error:
return error;
}
0 Kudos
Message 1 of 5
(3,638 Views)
Hi Peter,

Can I just ask what version of NI-DAQ you have installed. This is listed under the software tree in Measurment and Automation Explorer.

Many thanks,

Peter H.
Applications Engineer.
NIUK.
0 Kudos
Message 2 of 5
(3,623 Views)
Dear Peter,

Thanks for your interest.

NI-DAQmx 7.3.0f0
Trad NI-DAQ (which I think doesn't support the 6514) 7.3.0f1

Incidentally I tested this by running:
Dev Studio IDE debugging a debug compilation of my C++ DLL
which runs the VB IDE
which runs my VB program in debug mode
which calls an entry point into my DLL (most of the DLL has been used in other projects) which calls DACmxCreateTask()

This is how I usually debug this DLL, so I don't think it should cause the problem.

Hope that's all you need.
Peter
0 Kudos
Message 3 of 5
(3,618 Views)
I think I have the solution. The call to DACmxCreateTask() is in the constructor of a class which is global to the DLL, so is called as the DLL is being initialised.

If I move the call to a function which is called after the DLL has been initialised then it returns without error.
0 Kudos
Message 4 of 5
(3,593 Views)
Peter,

it sounds like you have found the problem, if your DLL wasn't initialised before you try to read from it then it would create problems. Glad you've got it sorted out.

Best regards,

Peter H.
Applications Engineer.
NIUK.
0 Kudos
Message 5 of 5
(3,579 Views)