BrainStem® Input DevicesIndex

The BrainStem can get input from two types of devices: physical devices and software devices.  Each device has its own unique ID.  The BrainStem supports up to 64 unique input device IDs per module.  Devices pass their input on to the host, reflexes, or VM programs via cmdDEV_VAL commands.

Device IDs double as reflex message IDs.  This provides an intuitive method for using device input to trigger reflexes.  Since device IDs range from 0-63 and reflex message IDs range from 0-127, there are many free message IDs for the user.  Any unused device ID may be used as a general-purpose reflex message ID, though this may complicate debugging of reflex routines.

A user may request input from a device by issuing commands or by reading from IO ports in a TEA program.  Commands require a device index byte.  The user may set the HOST and RFLX bits in the device index byte to direct the input data to the host or to a reflex.  When a device has data, it issues a cmdDEV_VAL command with its unique device ID and its data byte(s).  The cmdDEV_VAL command checks the HOST and RFLX bits in its DEVCODE byte and passes the data off to the host or a reflex.  When neither the HOST nor RFLX bit is set, the data will be sent to a TEA program if it is waiting for it.  Otherwise, the data is discarded.

Physical devices include A2D inputs, digital (state, transition, timer) inputs, GP2D02 input, IIC read input, and raw serial byte input.  Only A VM process can request input of raw serial bytes.  All of these devices, except for digital pin state, have some latency before the data is ready.  A digital transition input is a special case because it has no data associated with it.  It is only used to drive reflexes.  When enabled, a transition on a pin places a cmdRAW_INPUT command directly on the command queue.

The software devices are the timers, counters, and semaphores.  Like digital transition inputs, the timers and counters have no data associated with them.  Their inputs are only used to drive reflexes.  A timer expiration or counter rollover-to-zero places a cmdRAW_INPUT command directly on the command queue.  A semaphore is a special case because it takes input from a cmdDEV_VAL command and passes it to a VM that is blocked and waiting for the data.  The physical and software devices along with their codes are listed below:

Input Devices for the GP 1.0 Module

Alias Device ID Input Source
A0-A4 0-4 A2D inputs
D0-D4 5-9 Digital pin state inputs
R0 10 GP2D02 range input
E1-E4 11-14 Digital Edge/Width timer inputs
X0-X4 15-19 0.1ms polling digital transition inputs
T1-T24 20-43 0.1ms resolution timer inputs
C0-C7 44-51 16-bit counter rollover inputs
I0 52 IIC input
S0-S3 53-56 Semaphore inputs
B0 57 Raw serial byte input
L0 126 Host link down reflex input
P0 127 Power-up reset reflex input

Input Devices for the Moto 1.0 Module

Alias Device ID Input Source
A0-A4 0-4 A2D inputs
D00-D10 5-15 Digital pin state inputs
T1-T23 20-42 0.1ms resolution timer inputs
C0-C7 44-51 16-bit counter rollover inputs
I0 52 IIC input
S0-S2 53-55 Semaphore inputs
B0 57 Raw serial byte input
L0 126 Host link down reflex input
P0 127 Power-up reset reflex input

Input Devices for the GP 2.0 Module

Alias Device ID Input Source
A0-A4 0-4 A2D inputs
D0-D6 5-11 Digital pin state inputs
E1-E4 12-15 Digital Edge/Width timer inputs
I1-I4 16-19 IR message reception inputs
X0-X4 20-24 0.1ms polling digital transition inputs
T1-T23 25-48 0.1ms resolution timer inputs
I0 52 IIC input
S0-S3 53-56 Semaphore inputs
B0 57 Raw serial byte input
C0-C7 58-65 16-bit counter rollover inputs
L0 126 Host link down reflex input
P0 127 Power-up reset reflex input

version: 1.0, build 80903
© Copyright 1994-2008 Acroname, Inc., Boulder, Colorado.  All rights reserved.