Status packets – B&K Precision 8500-8526 - Manual User Manual

Page 48

Advertising
background image

The checksum number is the arithmetic sum of each of the bytes modulo 256.

Status packets

When you send a command that does not cause the DC Load to send requested information back to
you, you will receive a status packet back. The structure of a status packet is

Byte 0 Byte 1 Byte 2

Byte 3

Byte 4 to 24

Byte 25

0xAA Address 0x12

Status byte

Reserved

Checksum

The meaning of the return status byte is defined below:

0x90

Checksum incorrect

0xA0

Parameter incorrect

0xB0

Unrecognized command

0xC0

Invalid command

0x80

Command was successful

Even for commands that request for data to be read back, if the command is incorrect, the status
packet will also be received with one of the above status bytes.

Example program

As you have seen, the native programming interface to the DC loads is fairly low-level. It involves
sending 26 byte commands and receiving 26 byte responses from the instrument. To demonstrate
how to write your own source code to remotely control the DC load, we provide a custom program
written in python which translates well into other text based languages like C/C++
About Python: Python is a dynamic object-oriented programming language that can be used for
various kinds of software development. It offers strong support for integration with other languages
and tools, comes with extensive standard libraries, and is easy to learn in a few days time. Python is
distributed under an OSI-approved open source license that makes it free to use.
You can download a complete python program along with detailed documentation from our website
at

www.bkprecision.com

. Also available under the download area is a high level library which will

make programming much easier as it does the low level bit manipulation for you. Instead of sending
a 26 byte string, you can send a high level command such as SetMaxCurrent(current)
Example script:

# Set DC load to remote mode.

import serial
length_packet = 26 # Number of bytes in a packet

def DumpCommand(bytes):

assert(len(bytes) == length_packet)
header = " "*3

print header,
for i in xrange(length_packet):

8500 DC Load Series

Version: 030614

Page 48 of 77

Advertising