LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

viOpen doesn't detect errors!!

Hi,
I am building an application with Labwindows CVI 8.0 , VISA 4.0, a NI USB 6008 board and a Tektronik TDS1002 scope.
All works fine but VISA. It does never returns an error when it should !! To verify this I have turned off the Scope  and run the program ,expecting to get the Error MSG,,, but it executes as if the scope was turned on... I always get VI_SUCCESS !!
 
Please help me... I am really lost a this point Robot Sad
Here is a piece of my code, it is very simple ... I am just opening a VISA session..
 
static ViSession defaultRM;     
static ViSession instr;    
static ViStatus status;
.....
  /****open VISA ***/
 status=viOpenDefaultRM (&defaultRM);
   if (status < VI_SUCCESS) 
   {
      MessagePopup ("MSG","Could not open a session to the VISA Resource Manager!!");
      exit (EXIT_FAILURE);
   }   
   status = viOpen (defaultRM, "ASRL1::INSTR", VI_NULL, timeout, &instr);
   if (status < VI_SUCCESS)
   {
    MessagePopup ("MSG:","Cannot open a session to TDS1002.");
      goto Close;
   }
 Close:
     status = viClose (instr);
     status = viClose (defaultRM);
......
       
0 Kudos
Message 1 of 3
(3,231 Views)
Hi Mulan,

Turning off the scope does not mean that your computer's serial port is disabled.  When you call viOpen on ASRL1::INSTR, this just opens the serial port for use.  You will receive (timeout) errors if you try to read from the port, but you won't have any trouble opening it, as you've seen.

Hope this helps.

Mert A.
National Instruments
Message 2 of 3
(3,218 Views)
Oh Yes!! Thank you very much Smiley Happy
0 Kudos
Message 3 of 3
(3,184 Views)