The AVS-47  is a lab instrument for accurate measurement of electrical resistance. The AVS supports remote readout and commanding via a digital computer interface port. This interface port uses Picobus, a proprietary communication protocol by Picowatt.
This post describes a method to access the AVS-47 with custom software via a direct cable between the AVS-47 Picobus port and the serial port of the computer. This method does not depend on Labview or any particular driver or software library. It can be implemented from scratch in C or Python or any language that provides low-level access to the serial port.
Picobus  is a synchronous serial protocol based on 4 signals: CP (clock pulse), DC (data from computer), DI (data from instrument), AL (alarm). Bus transactions are initiated by the computer. A transaction starts with the computer sending an 8-bit address, followed by both the computer and the AVS simultaneously sending 48 bits of data.
Special protocol converters are available to translate Picobus to GPIB which can then be connected to the computer via a GPIB-USB adapter. I don't like these converters. Their intermediate layer of protocol translation opens up a new set of potential communication errors and makes it much more difficult to debug such errors.
Direct connection to serial port
The Picobus port can also be accessed via a direct cable to the RS-232 serial port of the computer. Alternatively, an RS-232-to-USB converter can be used, for example if the computer does not have physical RS-232 ports available.
The usual RX/TX lines of the RS-232 port are not used. Instead, the Picobus communication lines are connected to 4 modem control lines on the RS-232 port as follows :
|(not connected)||pin 1 = cable shield|
|pin 7 = RTS (to AVS)||pin 4 = CP (clock pulse)|
|pin 8 = CTS (from AVS)||pin 5 = DI (data from instrument)|
|pin 6 = DSR (from AVS)||pin 6 = AL (alarm)|
|pin 5 = GND||pin 7 = GND|
|pin 4 = DTR (to AVS)||pin 20 = DC (data from computer)|
The cable shield should be attached to the connector shell at the PC side, but not at the AVS-47 side to avoid ground loops.
Implementing the Picobus protocol
Operating the Picobus is now a matter of manipulating the modem control lines in a particular pattern. The following pseudo-code shows the correct sequence of bit operations.
The sleep duration bittime is typically 1 ms. Faster bit rates are possible with a physical serial port on the computer (e.g. 100 μs) but not all USB-to-RS-232 converters can so quickly detect changes on the modem control lines.
Note that the most significant bits of the address and data are transferred first, the least significant bits last.
The default Picobus address of the AVS-47 is 1, i.e.
addrbits[7...0] = 0000001.
Meaning of the 48 data bits
The 48 bits from computer to AVS specify a new configuration that the AVS will use for subsequent measurements. The 48 bits from AVS to computer contain the last measured value, as well as the configuration used by the AVS during the last measurement.
Note that the AVS will only accept a new configuration from the computer in REMOTE mode. In LOCAL mode, the AVS listens to its front-panel switches and ignores the configuration bits from the computer (except for the LOCAL/REMOTE bit).
The meaning of the 48 bits can be found in LabView example code provided by PicoWatt :
|48 bits to AVS (txbits)|
|bits 47 ... 32||digital reference, or 0 when not used|
|bits 31 ... 24||3 to change digital reference, or 0 when not used|
|bits 23 ... 22||
|bits 21 ... 20||Input mode:
|bits 19 ... 17||Channel (CH0 ... CH7)|
|bits 16 ... 14||Display mode:
|bits 13 ... 11||Excitation
|bits 10 ... 8||Range
|bit 3 ... 0||
|48 bits from AVS (rxbits)|
|bits 47 ... 43||(ignored)|
|bit 40||decimal digit 4 (leftmost digit)|
|bits 39 ... 36||decimal digit 3|
|bits 35 ... 32||decimal digit 2|
|bits 31 ... 28||decimal digit 1|
|bits 27 ... 24||decimal digit 0 (rightmost digit)|
|bits 23 ... 22||(ignored)|
|bits 21 ... 20||Actual input mode|
|bits 19 ... 17||Actual channel (CH0 ... CH7)|
|bits 16 ... 14||Actual display mode|
|bits 13 ... 11||Actual excitation|
|bits 10 ... 8||Actual range|
|bit 3 ... 0||(ignored)|
The 48 bits from the AVS (rxbits) contain the measured value in the form of binary-coded decimal digits. The measured resistance (in Ohm) can be determined from the numerical value of the decimal digits together with the range setting.
The AL signal
The AL signal is used by the AVS to indicate that a new measurement is complete. The signal becomes inactive during communication between computer and AVS, then becomes active again as soon as the AVS completes its next measurement. The computer can monitor the AL signal (by reading the status of the DSR modem line) to wait for measurement completion.