08-06-2009 05:34 PM
Hello,
I am experiencing some problems with the imaqDisplayImage function. When I call it:
//////////////////////////////////////////////
#include "nivision.h"
*
*
*
// Vision variables
static Image* singleImage;
static Image* singleImage_1;
*
*
*
int main (int argc, char *argv[]) {
*
*
*
// Vision
singleImage = imaqCreateImage(IMAQ_IMAGE_I16, 0);
imaqSetImageSize(singleImage, 300, 1);
status = imaqDisplayImage(singleImage, 0, TRUE);
if(status == 0){
err=imaqGetErrorText(imaqGetLastError());
sprintf(outputString, "Status: %i\n", status);
WriteString(textout, outputString);
sprintf(outputString, "Error Code: %i\n", imaqGetLastError());
WriteString(textout, outputString);
sprintf(outputString, "Error Description: %c\n", err);
WriteString(textout, outputString);
}
imaqSetWindowTitle(0, "Camera 1");
windowPosition.x = 610;
windowPosition.y = 30;
imaqMoveWindow(0, windowPosition);
singleImage_1 = imaqCreateImage(IMAQ_IMAGE_I16, 0);
}
//////////////////////////////////////////////
The WriteString allows me to be able to read the values of "status", "imaqGetLastError()", and "err":
Status: 0
Error Code: 0
Error Description:
The problem is that although "imaqDisplayImage" fails (it returns a zero), the "imaqGetErrorText" does not give me a proper feedback. In fact, I am not able to have an error description.
I am very confused, any help will be greatly appreciated! 🙂
Thanks!
08-07-2009 08:13 AM
I don't use imaq, but as a guess, where you have:
sprintf(outputString, "Error Description: %c\n", err);
perhaps try:
sprintf(outputString, "Error Description: %s\n", err);
instead.
JR
08-07-2009 09:50 AM
Thank you! Yes, I catched that, too 🙂 But I keep not having an error description. I think the issue is more related to another question I posted on the forum (http://forums.ni.com/ni/board/message?board.id=180&thread.id=42409). For some reasons, if I run the code as an administrator I receive a Windows error message regarding NIVisSvr.exe. While if I run it with no-administartor privileges, the error does not come up at all. This is even more confusing...
Thanks