Port manager: Difference between revisions

From SweepMe! Wiki
Jump to navigation Jump to search
(Formatting)
(Added introduction from device communication page.)
Line 1: Line 1:
Creating and handling port objects for use in a [[Device Class]] can be done via the SweepMe! port manager.
SweepMe! supports and simplifies communication to devices via RS232 ([[COM]] port), [[GPIB]], [[USB]] and [[TCPIP]] by using the SweepMe! [[Port manager]].


==Introduction==
The communication with the hardware is usually done in each [[Device Class]]. In order to simplify the process of creating the communication channel, i.e. establish a connection, SweepMe! provides the port manager for easy handling.


=== Supported port types ===
== Supported protocols ==


* [[COM]]: standard PC serial port using RS-232 protocol
* [[COM]]: standard PC serial port using RS-232 protocol
Line 9: Line 11:
* [[VB]]: a National Instrument VirtualBench device
* [[VB]]: a National Instrument VirtualBench device


 
== Usage ==
=== Configuration ===
===Configuration===
 
The following variables have to be set within the ''__init__'' function of a Device Class:
The following variables have to be set within the ''__init__'' function of a Device Class:



Revision as of 16:59, 29 September 2017

SweepMe! supports and simplifies communication to devices via RS232 (COM port), GPIB, USB and TCPIP by using the SweepMe! Port manager.

Introduction

The communication with the hardware is usually done in each Device Class. In order to simplify the process of creating the communication channel, i.e. establish a connection, SweepMe! provides the port manager for easy handling.

Supported protocols

  • COM: standard PC serial port using RS-232 protocol
  • GPIB: an IEEE-488-Bus, a standard communication
  • USB: plug and play USB test and measurement device as supported by pyvisa
  • VB: a National Instrument VirtualBench device

Usage

Configuration

The following variables have to be set within the __init__ function of a Device Class:

In order to get the available ports listed in the GUI of the corresponding Measurement Class, choose desired port types by:

self.port_types = ["COM", "GPIB", "USB", "VB"]

A port object is automatically created by

self.port_manager = True

Further parameters can be changed through

self.port_properties = {
    "baudrate" : 9600, 
    "EOL": "\n",
    ...
}

Get a list of all port_properties using

print self.port_properties

Communicating

If the port manager is activated, the port is automatically available within all functions of the sequencer procedure as the variable

self.port

A message can be sent using

self.port.write("string of the message without end-of-line/terminator character")

The answer of a device is acquired by

var = self.port.read()