Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmxGetErrorString can't find error -200077

I set up a basic error detection function within my Real Time DLL (see below), and purposefully set it to a run-time error condition (setting frequency to zero) to see if the error would be reported on the screen. When the program runs the code, the variable 'error' is set to -200077 (which conincides with the error outputted by the Test Panel). However, DAQmxGetErrorString(...) is not able to identify it. The function returns:

 

"Explanation could not be found for the requested status code.

Verify that the status code is correct"

 

I've tryed something very similar in a non-real time target and it is very useful. How can I get it to work on a Real Time target?

 

Here's the code -- Thanks!

 

static void CVICALLBACK TaskSet ()
{

    if( DAQmxFailed(error = (DAQmxCreateCOPulseChanFreq(PWM1,"Dev2/ctr0","",DAQmx_Val_Hz,DAQmx_Val_Low,0.0,0,0.50))))

    {

        DAQmxGetErrorString(error, errBuff, 2048);

        printf("Task Setup Error: %s\n", errBuff);

        printf("Error Code: %d\n", error);

    }

 

0 Kudos
Message 1 of 5
(2,236 Views)

Hi RITman,

 

I specifically created a LabWindows/CVI DLL out of the following code:

 

#include <NIDAQmx.h>

static char myError[74];

char* hellomain()
{
 int size;
 size = DAQmxGetErrorString (-200077, myError, 74);
 return myError;
}

 

I then read the value of myError into my LabVIEW Real-Time code so that I could see what the value is.  I see no output from my DLL at all when I run the DLL on my Real-Time controller - whether or not the DLL was created for a Real-Time environment (in CVI » Build » Target Settings » Run-time support » Full run-time engine  .....or Real-time only). 

 

When I run my code on a PC, I get the message "Measurements: Requested value is not a supported value for this property."

 

How are you getting the error message "Explanation could not be found for the requested status code. Verify that the status code is correct"?

(My .c file is attached.)

 

Kevin S.

Applications Engineer

National Instruments

0 Kudos
Message 2 of 5
(2,218 Views)

Hi. Thanks for getting back to me. I used your code and run it as both an Executable (1) in my local machine and as a DLL (2) in my RT Target, both complied using CVI. The output 'works'in my local machine, but not in the RT target. Ideas? -- Thanks.

 

OUTPUT

1.) "Measurements:  Requested value is not a supported value for this property."

2.) "Explanation could not be found for the requested status code. Verify that the requested status code is correct."

 

CODE

1) This is my executable code:

#include <utility.h>
#include <NIDAQmx.h>
#include <ansi_c.h>

static char myError[200];

char* hellomain()
{
     int size;
     size = DAQmxGetErrorString (-200077, myError, 200);
     return myError;
}

void main (void)
{
       if (InitCVIRTE (0, 0, 0) == 0)
    return;    /* out of memory */
   
    printf("%s",hellomain ());
    getchar();
   
    CloseCVIRTE ();
}

 

2.)  This is my RT code:

 #include <utility.h>
#include <NIDAQmx.h>
#include <ansi_c.h>

static char myError[200];

char* hellomain()
{
     int size;
     size = DAQmxGetErrorString (-200077, myError, 200);
     return myError;
}

__declspec (dllexport) void CVIFUNC_C RTmain (void)
{
       if (InitCVIRTE (0, 0, 0) == 0)
    return;    /* out of memory */
    
    printf("%s",hellomain ());
    
    CloseCVIRTE ();
}

0 Kudos
Message 3 of 5
(2,212 Views)

I will investigate.

 

Kevin S.

Applications Engineer

National Instruments

0 Kudos
Message 4 of 5
(2,180 Views)

Hi RITman,

 

I have succeeded in displaying "Measurements:  Requested value is not a supported value for this property." on a Real-Time PXI controller.

 

What I wasn't initially doing was setting my DLL to compile in Real-Time Compatible Mode as well as Release Mode.

 

Here is my LabVIEW code as well as my LabWindows/CVI code.  (Note that there are two network-shared variables.  One holds the actual string message, and the other simply increments at 1Hz - it's tied to a loop iteration counter......I wanted to be sure I could tell when my code was executing.)  I used the Distributed System Manager to view the variable values.  (Tools » Distributed System Manager)  Just be sure to right-click on the library in LabVIEW and explicitly deploy it before you load the startup executable (from LabVIEW) onto a PXI controller.

 

Best of luck in future programming,

Kevin S.

Applications Engineer

National Instruments

Message Edited by Kevin_S on 10-10-2008 10:00 AM
0 Kudos
Message 5 of 5
(2,146 Views)