Documentation
¶
Overview ¶
Package prologix communicates with either the Prologix GPIB-USB or GPIB-ETHERNET controller. Communication with the GPIB-USB controller can either be via the FTDI Virtual COM Port (VCP) driver or via the FTDI D2XX direct driver. The Prologix GPIB controller can operate as a GPIB Controller-in-Charge (CIC), a GPIB Talker Device, or a GPIB Listener Device.
Index ¶
- type Controller
- func (c *Controller) AssertEOI() (bool, error)
- func (c *Controller) ClearDevice() error
- func (c *Controller) ClearInterface() error
- func (c *Controller) Command(format string, a ...any) error
- func (c *Controller) CommandController(cmd string) error
- func (c *Controller) FrontPanel(enable bool) error
- func (c *Controller) GPIBTermination() (GpibTerm, error)
- func (c *Controller) InstrumentAddress() (int, error)
- func (c *Controller) Query(cmd string) (string, error)
- func (c *Controller) QueryController(cmd string) (string, error)
- func (c *Controller) Read(p []byte) (n int, err error)
- func (c *Controller) ReadAfterWrite() (bool, error)
- func (c *Controller) ReadTimeout() (int, error)
- func (c *Controller) Reset() error
- func (c *Controller) ServiceRequest() (bool, error)
- func (c *Controller) SetAssertEOI(enable bool) error
- func (c *Controller) SetGPIBTermination(term GpibTerm) error
- func (c *Controller) SetInstrumentAddress(addr int) error
- func (c *Controller) SetReadAfterWrite(enable bool) error
- func (c *Controller) SetReadTimeout(timeout int) error
- func (c *Controller) Version() (string, error)
- func (c *Controller) Write(p []byte) (n int, err error)
- func (c *Controller) WriteString(s string) (n int, err error)
- type GpibTerm
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller models a GPIB controller-in-charge.
func NewController ¶
func NewController(rw io.ReadWriter, addr int, clear bool) (*Controller, error)
NewController creates a GPIB controller-in-charge at the given address using the given Prologix driver, which can either be a Virtual COM Port (VCP), USB direct, or Ethernet. Enable clear to send the Selected Device Clear (SDC) message to the GPIB address.
func (*Controller) AssertEOI ¶ added in v0.2.0
func (c *Controller) AssertEOI() (bool, error)
AssertEOI determines if the Prologix controller is configured to assert the EOI signal at the end of any command sent over the GPIB port.
func (*Controller) ClearDevice ¶ added in v0.2.0
func (c *Controller) ClearDevice() error
ClearDevice sends the `clr` command to the Prologix controller which sends the Selected Device Clear (SDC) message to the currently selected GPIB address.
func (*Controller) ClearInterface ¶ added in v0.2.0
func (c *Controller) ClearInterface() error
ClearInterface sends the `ifc` command to the Prologix controller which asserts the GPIB Interface Clear (IFC) signal for 150 microseconds making the Prologix GPIB controller the Controller-In-Charge.
func (*Controller) Command ¶
func (c *Controller) Command(format string, a ...any) error
Command formats according to a format specifier if provided and sends a SCPI/ASCII command to the instrument at the currently assigned GPIB address. All leading and trailing whitespace is removed before appending the USB terminator to the command sent to the Prologix.
func (*Controller) CommandController ¶ added in v0.3.0
func (c *Controller) CommandController(cmd string) error
CommandController sends the given command to the Prologix controller. To indicate this is a command for the Prologix controller, thereby not transmitting to the instrument over GPIB, two plus signs `++` are prepended. Addtionally, a new line is appended to act as the USB termination character.
func (*Controller) FrontPanel ¶
func (c *Controller) FrontPanel(enable bool) error
FrontPanel enables or disables front panel operation for the instrument at the current GPIB address. This is accomplished by either sending the Prologix `loc` local command to enable the front panel or by sending the Prologix `llo` local lockout command to disable the front panel.
func (*Controller) GPIBTermination ¶ added in v0.2.0
func (c *Controller) GPIBTermination() (GpibTerm, error)
GPIBTermination uses the Prologix `eos` command to query the GPIB terminator.
func (*Controller) InstrumentAddress ¶
func (c *Controller) InstrumentAddress() (int, error)
InstrumentAddress returns the GPIB address for the instrument under control.
func (*Controller) Query ¶
func (c *Controller) Query(cmd string) (string, error)
Query queries the instrument at the currently assigned GPIB using the given SCPI/ASCII command. The cmd string does not need to include a new line character, since all leading and trailing whitespace is removed before appending the USB terminator to the command sent to the Prologix. When data from host is received over USB, the Prologix controller removes all non-escaped LF, CR and ESC characters and appends the GPIB terminator, as specified by the `eos` command, before sending the data to instruments. To change the GPIB terminator use the SetGPIBTermination method.
func (*Controller) QueryController ¶ added in v0.3.0
func (c *Controller) QueryController(cmd string) (string, error)
QueryController sends the given command to the Prologix controller and returns its response as a string. To indicate this is a command for the Prologix controller, thereby not transmitting over GPIB, two plus signs `++` are prepended. Addtionally, a new line is appended to act as the USB termination character.
func (*Controller) Read ¶
func (c *Controller) Read(p []byte) (n int, err error)
Read reads from the instrument at the currently assigned GPIB address into the given byte slice.
func (*Controller) ReadAfterWrite ¶
func (c *Controller) ReadAfterWrite() (bool, error)
ReadAfterWrite determines if the Prologix controller is configured to automatically read after a write.
func (*Controller) ReadTimeout ¶
func (c *Controller) ReadTimeout() (int, error)
ReadTimeout queries the read timeout value in milliseconds from the Prologix GPIB controller.
func (*Controller) Reset ¶ added in v0.2.0
func (c *Controller) Reset() error
Reset performs a power-on reset of the controller. The process takes about 5 seconds. All input received during this time are ignored.
func (*Controller) ServiceRequest ¶
func (c *Controller) ServiceRequest() (bool, error)
ServiceRequest sends the `srq` command to the Prologix controller to determine if the GPIB SRQ signal is asserted or not.
func (*Controller) SetAssertEOI ¶ added in v0.2.0
func (c *Controller) SetAssertEOI(enable bool) error
SetAssertEOI sets the Prologix controller to assert the EOI signal after the last character of a command sent over the GPIB port.
func (*Controller) SetGPIBTermination ¶ added in v0.2.0
func (c *Controller) SetGPIBTermination(term GpibTerm) error
SetGPIBTermination uses the Prologix `eos` command to set the character to be appended as the GPIB terminator to all data sent from the Prologix Controller to the instrument.
func (*Controller) SetInstrumentAddress ¶
func (c *Controller) SetInstrumentAddress(addr int) error
SetInstrumentAddress sets the GPIB address for the instrument under control.
func (*Controller) SetReadAfterWrite ¶
func (c *Controller) SetReadAfterWrite(enable bool) error
SetReadAfterWrite sets the Proglogix controller to automatically read after write.
func (*Controller) SetReadTimeout ¶
func (c *Controller) SetReadTimeout(timeout int) error
SetReadTimeout sets the Proglogix controller's read timeout in milliseconds. The timeout must be between 1 and 3000 milliseconds.
func (*Controller) Version ¶
func (c *Controller) Version() (string, error)
Version returns the version string from the Prologix GPIB controller.
func (*Controller) Write ¶
func (c *Controller) Write(p []byte) (n int, err error)
Write writes the given data to the instrument at the currently assigned GPIB address.
func (*Controller) WriteString ¶
func (c *Controller) WriteString(s string) (n int, err error)
WriteString writes a string to the instrument at the currently assigned GPIB address.
Directories
¶
| Path | Synopsis |
|---|---|
|
driver
|
|
|
examples
|
|
|
vcp/e3631a
command
|
|
|
vcp/fluke45
command
|
|
|
vcp/key33220a
command
|