Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

viWrite

Hello,
 
I having an intermittant problem when using this command viWrite.
My program is simple,
first I check the "*IDN?"
sencond I send a command to measure, ":meas?"
third I read back the data.
then repeat step first step again.
 
sometime it run 100 loops than give me timeout error at viWrite, sometime it only run 50 loops.
I use NI-SPY to log the message, I notice something strange
 
when my received an time out error, the retCount parameter of viWrite show 0?  for normal working it will show 6.
is this retCount parameter indicate the command is not success transfer down to equipment?
 
my command listing :   status = viWrite(DM,":meas?",6,&retCnt);
 
is it due to program problem or measurement insrument problem?
 
Thanks
 
 
 
 
 
 
 
0 Kudos
Message 1 of 2
(5,854 Views)
What hardware interface (GPIB, Serial, USB, LAN, etc) are you using? 
 
Depending on the interface type, you may need to send explicit termination character such as 0x0A (Line Feed).  Your instrument looks like IEEE488.2/SCPI compatible, the Line Feed must be the correct termination.
 
Rather than sending 6-byte string without terminator...
viWrite(DM,":meas?",6,&retCnt);
 
try sending 7-byte string with terminator...
viWrite(DM,":meas?\n",7,&retCnt);
 
 
0 Kudos
Message 2 of 2
(5,841 Views)