Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

When my machine has an error, it gets put in the buffer and I read it via GPIB in my VI. But the buffer does not get c

leared, and the error message keeps coming up, even though the hardware is OK. "VISA device clear" does not help, and the "flush I/O buffer" has error 'invalid mask' - even if nothing is wired to that terminal - is there a special way to use this function?
0 Kudos
Message 1 of 5
(3,910 Views)
leared, and the error message keeps coming up, even though the hardware is OK. "VISA device clear" does not help, and the "flush I/O buffer" has error 'invalid mask' - even if nothing is wired to that terminal - is there a special way to use this function?Mr. Ibrahim,

How do you have the error code propraggated through your code? If you have an error cluster recycled by use of a shift register or other mechanism, the error cluster will retain its state even though the functions no longer are generating the error. The easiest way to "fix" this is to write a clean error cluster or to make sure the error is not recycled.

Also, the "VISA flush I/O buffer" vi makes a standard VISA viFlush function call. This function is intended for use on serial resources. If you were to alter the session type to a serial resource, you would notice that the error would no longer appear.

Ryan Mosley
National Instruments, Applications Engineer
http://www.ni.com/exchange
0 Kudos
Message 2 of 5
(3,910 Views)
leared, and the error message keeps coming up, even though the hardware is OK. "VISA device clear" does not help, and the "flush I/O buffer" has error 'invalid mask' - even if nothing is wired to that terminal - is there a special way to use this function?Thanks for the response. The errors are not cycling around the main loop - I've done all the nitty-gritty searching to find the exact spot where it comes out, and it is at the end of a whole acquisition "cycle", the machine is queried for an error, and it returns an error that happened on the previous acquisition, not this one. The only way to clear it is a hard reset on the instrument, which must clear all the buffers. Can I alter the session type to serial resource while using GPIB?
0 Kudos
Message 3 of 5
(3,910 Views)
leared, and the error message keeps coming up, even though the hardware is OK. "VISA device clear" does not help, and the "flush I/O buffer" has error 'invalid mask' - even if nothing is wired to that terminal - is there a special way to use this function?Matt,

I'm hoping you have some information about the status and error registers for your piece of equipment. This is usually in the programming guide for the equipment. At the highest level there is the status byte register. This register has bits that respond to other lower level registers. When they error and their masks are enabled, a bit is set in this register. And if its mask is set, an SRQ (status register interupt) is generated. You can poll with the common IEEE command *STB? to see if any of these bits have been set. By doing this, you will know when a bit is set to act upon it, but in most cases (i'm familiar with) this will not reset the bits to cleared state. If this is true for your equipment there are a couple of workarounds. Fir
st, try the 'SPOLL' function in the IEEE.2 palette. This will return the same info as *STB? but should also reset the register. Otherwise try polling lower level registers for errors. If you know where the error(s) come from such as the standard event register usually responds to events like power on, command error, request control, etc. This register is usually read with the common command *ESR?. In my experience, this also clears the register besides reading it. There are common commands for setting the masks i mentioned above (like *ESE and *SRE). this is helpful if you just want to generate an error on certain bits of the registers. Your equipment may have other registers available too.

Good luck,
Jared
0 Kudos
Message 4 of 5
(3,910 Views)
leared, and the error message keeps coming up, even though the hardware is OK. "VISA device clear" does not help, and the "flush I/O buffer" has error 'invalid mask' - even if nothing is wired to that terminal - is there a special way to use this function?Thanks, Jared, I tried these commands on my HP Impedance Analyzer, (it seems to take the standard commands without the asterisks), but unfortunately they have not cleared the errors from coming out when an error query is performed straight afterwards. My most common error is a DC current overload, which seems to be a hardware fault that is occurring randomly, and has been getting better lately...there is a function called SDC (selected device clear), but when I try and write it to the bus it gives an 'undefined symbol' error, even when I copy exactly the other bus commands. The general GPIB clear function in LabVIEW doesn't clear the error...
0 Kudos
Message 5 of 5
(3,910 Views)