16. cc_visa

16.1. Communication Channel using VISA protocol

module

cc_visa

synopsis

VISA communication channel to communicate to instruments using SCPI protocol.

class pykiso.lib.connectors.cc_visa.VISAChannel(**kwargs)[source]

VISA Interface for devices communicating with SCPI

Initialize channel settings.

_cc_close()[source]

Close a resource

Return type

None

abstract _cc_open()[source]

Open an instrument

Return type

None

_cc_receive(timeout=0.1, raw=False)[source]

Send a read request to the instrument

Parameters
  • timeout (float) – time in second to wait for reading a message

  • raw (bool) – should the message be returned raw or should it be interpreted as a pykiso.Message?

Return type

str

Returns

the received response message, or an empty string if the request expired with a timeout.

_cc_send(msg, raw=False)[source]

Send a write request to the instrument

Parameters
  • msg (Union[Message, bytes, str]) – message to send

  • raw (bool) – is the message in a raw format (True) or is it a string (False)?

Return type

None

_process_request(request, request_data='')[source]

Send a SCPI request.

Parameters
  • request (str) – command request to the instrument (write, read or query)

  • request_data (str) – command payload (for write and query requests only)

Return type

str

Returns

response message from the instrument (read and query requests) or an empty string for write requests and if read or query request failed.

query(query_command)[source]

Send a query request to the instrument

Parameters

query_command (str) – query command to send

Return type

str

Returns

Response message, None if the request expired with a timeout.

class pykiso.lib.connectors.cc_visa.VISASerial(serial_port, baud_rate=9600, **kwargs)[source]

Connector used to communicate with an instrument via Serial.

Initialize channel attributes.

Parameters
  • serial_port (int) – COM port to use to connect to the instrument

  • baud_rate – baud rate used to communicate with the instrument

_cc_open()[source]

Open an instrument via serial

Return type

None

class pykiso.lib.connectors.cc_visa.VISATcpip(ip_address, protocol='INSTR', **kwargs)[source]

Connector used to communicate with an instrument via TCPIP

Initialize channel attributes.

Parameters
  • ip_address (str) – target instrument’s ip address

  • protocol – communication protocol to use

_cc_open()[source]

Open a remote instrument via TCPIP

Return type

None