
System 3
17-27
BH32 Behavioral Cage Controller
An incoming UDP packet is de-serialized and sent to the macro outputs. The
“NewPack” output goes high (1) for one sample when a new packet header has
been received. The “Busy” outputs are high (1) while the macro is de-serializing a
packet. The length of this period depends on number of BH32 devices (it takes
NumberOf1 sample to receive a packet). The macro outputs are latched
until the next packet is received. The “Reset” input can be used to halt any data
transfer and force the macro to wait for a new packet header.
Note:
Since the channels are received serially, data in later channels occurred several
samples before it is available on the macro Output.
The
Packet
Structure
This guide assumes the BH32 is communicating over UDP using the Ethernet port.
BH32 devices listen on UDP port 22022 and all other UDP messages are
disregarded. Communication over the RS232 serial port uses an identical packet
structure and programming.
All data sent or received by the BH32 is in the form of a packet. Every packet has
a standard structure which includes a header, target device and message.
The header consists of a 32-bit value; the first 24 bits are the protocol ID specific
to the BH32/RZ interface and the next 8 bits are the protocol version (v1 as of
this writing). This header is used by the BH32 and the RZ to identify packets that
they should read and process.
The target device is identified with the next 24 bits of the packet. It consists of a
16-bit device number and an 8-bit group number in case you have more than 256
BH32 devices. This lets you target a single BH32 out of many on the network, or
send batch commands to all BH32s on the network.
The message consists of a single toggle bit that identifies if the packet is to or from
the device, a 7-bit message number (see “Messages” below) and a reserved 32-
bit word for message parameters. Additional data can be appended to messages that
require more than one parameter, such as the GET_SET_IO message that sets the
output state or GET_SET_CONFIG that changes the device configuration.
The structure for the packet is shown below:
1. (24 bits) Unique protocol ID number – 0x55AB00.
2. (8 bits) Message protocol version number – this document covers protocol
v. 1.
3. (16 bits) Device unit number.
a. Devices will only process messages:
b. Matching their unit number.
c. With a unit number of -1.
•
All devices numbered 0 are considered to be unnumbered.
4. (8 bits) Group – used in the GET_SET_IO message. Due to the maximum
transmission unit constraints on most networks, each message can only
contain ~256 data words. Offset provides a means of doing a bulk update
in 256 device increments (e.g. update devices 256-511). This is typically
set to 0.
5. (1 bit) Source – 1 means from device, 0 means device will process it.
1
2
3
4
5 6
7
8