Clear Service

NI-VISA

Clear Service

When communicating with a message-based device, particularly when you are first developing your program, you may need to tell the device to clear its I/O buffers so that you can start again. In addition, if a device has more information than you need, you may want to read until you have everything you need and then tell the device to throw the rest away. The viClear() operation performs these tasks.

More specifically, the clear operation lets a controller send the device clear command to the device it is associated with, as specified by the interface specification and the type of device. The action that the device takes depends on the interface to which it is connected.

  • For a GPIB device, the controller sends the IEEE 488.1 SDC (04h) command.
  • For a VXI or MXI device, the controller sends the Word Serial Clear (FFFFh) command.
  • For the ASRL INSTR or TCPIP SOCKET resource, the controller sends the string "*CLS\n". The I/O protocol must be set to VI_PROT_4882_STRS for this service to be available to these resources.

For more details on these clear commands, refer to your device documentation, the IEEE 488.1 standard, or the VXIbus specification.