LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Invalid character with DAQmxCreateTask

I have a DLL that I wrote which uses NIDAQmx calls.  I've used NIDAQmxbase on Linux before, so I'm fairly comfortable with using the API.  What's new here is that I'm on Windows using MinGW (I'm using the CVI-created NIDAQmx.c method for resolving symbols).  When I try to create a task with "6224DIO/port0/line0" as the name, I get an error saying invalid character at position 7.  I've tried giving a different name like "mytask" but then that gives me an error saying the name is already in use -- no matter what I pick!  But that may be an unrelated problem.  With the original string that I want to use, it's as if it doesn't understand the '/'.  What am I doing wrong?

In the off chance it's a MinGW problem, I'm installing MS Visual C++ 2008 Express to see if building my DLL with MSVC makes any difference (which I doubt).

Thanks,
Keith.

0 Kudos
Message 1 of 4
(2,990 Views)
BTW, I've created my DLL using MSVC now and I still have the same problem.

0 Kudos
Message 2 of 4
(2,977 Views)
OK, I've eliminated LabView from the equation.  I'm just running a simple C++ app calling NIDAQmx:

----
#include <iostream>
#include <NIDAQmx.h>

using namespace std;


int main(int argc,
         char * argv[])
{
    cout << "create task '" << argv[1] << "'" << endl;
    TaskHandle _task_handle;
    int error = DAQmxCreateTask(argv[1],
                                &_task_handle);
    if (DAQmxFailed(error))
    {
        char error_buffer[2048] = {'\0'};
        DAQmxGetExtendedErrorInfo(error_buffer,
                                  sizeof(error_buffer));
        cerr << error_buffer << endl;
        return 1;
    }
    cout << "create task done" << endl;
    DAQmxClearTask(_task_handle);
    return 0;
}
----
Here's what I get:
$ ./Debug/project3.exe 6224DIO/port0/line0
create task '6224DIO/port0/line0'
Measurements: Specified string is not valid, because it contains an invalid character.
Position of Invalid Character: 7
Invalid String: 6224DIO/port0/line0

Task Name: 6224DIO/port0/line0

Status Code: -200552


What's going on here??  Am I not allowed to use the channel name as the task name?  I was able to do this with NIDAQmxbase ...


0 Kudos
Message 3 of 4
(2,974 Views)
Hm.  Apparently you can't use the channel name as the task name.  If I use a simple string with my console app, it works fine.  This is different behavior than with mxbase, but I can live with it ...


0 Kudos
Message 4 of 4
(2,971 Views)