ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Clear GPIB buffer

Hi
One of the instruments hooked up to a GPIB board is going out of control sometime. I noticed this happens when I abort data transfering thru GPIB in the middle of communication (eg while it's still waiting). Then when I initiate communication between the GPIB and the instruments, one of the instruments is acting like it's receiving data. I guess that's the old data that's left over when I aborted the communication last time. What do you think the cause of that problem? If it's because of data left over in the buffer, how do I clear the data in the buffer? Or is there a right way to abort the GPIB communication?

Thank you
0 Kudos
Message 1 of 4
(8,286 Views)
There is a way to clear the buffer, which I would suggest doing after you abort communication. The function is IBCLR which clears a specific device. Here is a link to the NI 488.2 Function Reference Manual:
http://digital.ni.com/manuals.nsf/websearch/35CD6168125E0EBD86256789006E84D4?OpenDocument&node=132100_US
This contains a list of all the functions and how to use them.

If you still have a problem after clearing the device repost.

JenK
0 Kudos
Message 2 of 4
(8,271 Views)
I looked at the IBCLR manual that you gave me the link. Looks like it will work, but it doesn't say what file to #include (I am writing C code to communicate with GPIB). Here are the questions I have.

1. for the IBCLR, Do you know what file to include?
2. I look at the NI488.2 help file thru MAX. There is a function CNI4882Device::Clear(). Does it send the IBCLR as well?
3. Is it OK if I clear the GPIB buffer before I start sending commands to GPIB device? If it's OK, should I clear the buffer before initializing the GPIB device (with ibdev command) or when should I clear it?

My problem is that, there can be unexpected communication abort, so I was wondering if it's OK to clear the GPIB before sending commands to it.

Thank you
0 Kudos
Message 3 of 4
(8,222 Views)
This question is similar to another you posted here (http://forums.ni.com/ni/board/message?board.id=140&message.id=10349#M10349), where I have posted an answer.
0 Kudos
Message 4 of 4
(8,198 Views)