3 frame format, Packet structure – B&K Precision 1785B - Manual User Manual
Page 21
21
4.3 Frame format
Packet structure
The power supply is programmed using packets of bytes. A packet always contains 26 bytes,
either going to or coming from the instrument. The basic programming rule is:
You send a 26 byte packet to the instrument. You then
read a 26 byte packet back from the power supply to
either
•
Get the status of your submitted packet, or
•
Get the data you requested.
The following are conventions we will follow in this chapter:
1. Hexadecimal integers will be represented by the prefix 0x.
2. Numbers are in base 10 number system unless otherwise indicated.
3. Byte numbering is zero-based, meaning numbering starts with 0.
The structure of each 26 byte packet is:
Byte 0
Byte 1
Byte 2
Byte 3 to 24
Byte 25
0xAA
Address
Command
Command's data
Checksum
Thus, the first byte of any command packet or returned packet is always 0xAA.
Address must be a byte that is between 0x00 and 0xFE. Setting of the address is optional. It
is not required to communicate with the instrument. The address can be set from the front
panel and is stored in non-volatile memory. This feature is useful when communicating via
USB, and connecting several instruments, e.g. via a USB hub. In this scenario, Windows
assigns a virtual COM port to each device which is unknown prior to establishing
communications with the instrument (could be different each time). In this case, the user can
correlate each virtual COM port randomly assigned by Windows with a user defined address.
Command is a byte that identifies which power supply command is used.
The area for the command's data contains parameter information for the command or the
data that is requested via a previous command. Some commands have no data at all. It is a
good programming practice to set all unused bytes to 0x00.
The checksum number is the arithmetic sum of each of the bytes modulo 256.