© 2020 Virginia Diodes, Inc.
—All Rights Reserved
7 October 2020
PM5B Communication Protocol
On receipt of a message, the PM5B will acknowledge with an ACK (0x06) if the message was received and parsed correctly or a
NAK (0x15) if it was not. “Parsed correctly” is defined as receiving eight bytes, starting with the synchronizing character “!” (0x21)
or
“?” (0x3f) and terminating with a carriage return (x0d). The action requested by the command is begun upon the correct parsing
of the command.
Because this action may take many milliseconds to complete, the ACK only indicates the correct parsing, not the completion of
the action. It is assumed that the action will complete successfully. The protocol does not provide detailed fault information.
The PM5B assumes the host is always capable of receiving messages and will only transmit a single message in response to a
command. The host must be capable of accepting unsolicited messages back-to-back in rapid succession; this situation will occur
if streaming power output data is requested. The host must not respond with an ACK nor a NAK upon receipt of power output
data.
For Communication from the PM5B
The response from the PM5B has a six byte message format. Byte 1 is an ASCII character. Byte 2 can be an ASCII character or
straight binary depending on Byte 1. Bytes 4 through 6 are straight binary. The response returned from the query ‘D1’ or ‘DS’ has
the following format:
Byte 1
is ‘D’.
Byte 2 is the LSB of the data.
Byte 3 is the MSB of the data.
Byte 4 is Status Byte 1.
Byte 5 is Status Byte 2.
Byte 6 is Status Byte 3.
No response from the host is expected after receipt of this message. In the returned response, Bytes 2 and 3 together constitute
the data in 16 bit integer format (short integer). These two bytes should be unpacked as a 16-bit integer. In addition, these are 16-
bit 2's complement numbers, which will need to be converted from 16 bit 2's complement to decimal.
At this point, after converting to decimal, we have a number that is the raw count value (let us call this number countvalue). The
actual reading is then computed from the countvalue, and based on what the range value is, and if there is a cal factor set in the
front panel. The formula to get the reading from the countvalue and range value (defined here as variable rangeval):
reading = countvalue*2.*rangemax(rangeval)/59576.
where rangemax = 200.E-6 for rangeval=1, or 2.E-3 for rangeval=2, or 20.E-3 for rangeval=3, or 200.E-3 for rangeval=4. The
range value setting is also available in the status bytes (see below). If there is a cal factor on the front panel, the reading from the
formula above should be further modified as:
reading = reading * 10^(calfactor/10.)
where calfactor is the decimal calfactor that you can read from the front of the panel.
This cal factor is also present in Status Byte 3
– See all three Status Byte definition tables on the next page.
Communication Protocol / Communication from the PM5B