Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

why viwrite() is not giving error for an invalid command

Hi All,

 

I have a doubt related to VISA - viwrite().

 

I am controlling a DC power supply through VISA. I am able to do all the basic operations successfully without any issues.

 

My concern is :

 

when i am trying to write some invalid command , say for example "^&$" using viwrite(), it is not throwing any error.viwrite() is returning 0. After viwrite(), i called viread(), then surprisingly in read buffer i got device identification string. Even viread() is also not throwing error.

 

Then in this case, how i can provide error checking like the command given is an invalid command like that.

 

Am i missing any thing?

 

Any small help will be greatly appreciated. and i am using labwindows/CVI 8.5.

 

Thanks,

Harika.

0 Kudos
Message 1 of 9
(4,618 Views)
Why would you expect a VISA error? The write and read were successful. How could VISA know that you sent an invalid instrument command? You do understand that each instrument has a unique command set and that a generic hardware driver such as VISA has no way of knowing what that command set is. What you would need to do is send an error query (i.e. ERR?) to the instrument.
0 Kudos
Message 2 of 9
(4,612 Views)

Hi Knutson,

 

Thanks for your reply.

 

As you said, i tried with error query but then also it is not returning any error.

 

This is my code:

 

 st = viOpenDefaultRM(&vi1);
 st = viOpen(vi1,"Dev2", VI_NULL, VI_NULL, &vi2);
 st = viWrite(vi2,cmd,strlen(cmd),&returncount);
 st = viWrite(vi2,"SYST:ERR?",10,&returncount);
 st = viRead(vi2,value,512,&readCount);
 st = viClose(vi1);

 

After executing this, "value" variable contains "0,No Error".

 

Can you please let me know am i missing anything.

 

Thanks,

Harika

0 Kudos
Message 3 of 9
(4,605 Views)
In the above code, cmd contains some invalid command like "%^&".
0 Kudos
Message 4 of 9
(4,604 Views)
Then you will have to check with the vendor. You have not provided the make and model.
0 Kudos
Message 5 of 9
(4,601 Views)

 

I am using Sorenson DC Power Supply.

 

Model is Sorensen DLM 40-15.

 

Is this issue woth the vendor?

0 Kudos
Message 6 of 9
(4,585 Views)
Isn't that what I already said with 'Check with the vendor'?
0 Kudos
Message 7 of 9
(4,564 Views)
I doubt the model does not support error query mechanism. You can check with the vendor.
0 Kudos
Message 8 of 9
(4,525 Views)
I also think the error processing mechanism in the instrument looks like not working.  It may be a firmware (specially SCPI command parser) issue in the instrument.  Ask the vendor.
0 Kudos
Message 9 of 9
(4,502 Views)