Reflex ElementsIndex

Reflex elements are features designed especially for reflexes.  Several commands and IO ports are associated with the reflex elements.  Some reflex elements perform logic and math functions.  Others control flow.  Reflex routines that combine elements and IO operations can perform useful control tasks.

cmdRAW_INPUT

This is the reflex propagation command.  See cmdRAW_INPUT for details.  The cmdPAD_INPUT command issues a raw input with a byte parameter from the scratch pad.  A VM may issue raw inputs by writing to the aPortRawInput IO ports.

Timer

Timers make it possible to implement delays in reflex routines.  When timers expire, they issue raw inputs.  See cmdTMR_SET for details for setting at timer.  The cmdPTMR_SET command sets the time with a value in the scratch pad.

Different modules may have different numbers of software timers.

Module Number of Timers
GP 1.0 24
Moto 1.0 23

Reflex Enabler

A reflex enabler provides a way to control a reflex while it is running.  Each enabler has a configuration byte in RAM that stores an enable bit and a 7-bit reflex vector ID.  See cmdRFLXE_CFG for details about configuring an enabler.  Issuing a cmdRFLXE_CHK command forces a check of the enabler's configuration byte.  When the enable bit is set, a reflex enabler issues a raw input to keep a reflex going.  When the enable bit is clear, it withholds the raw input.  This makes it possible for a command, another reflex, or a VM process to stop a reflex.  It is also possible to alter the behavior of a reflex while it is running by changing the vector ID.  This changes which reflex gets propagated by the enabler.  The GP 1.0 and Moto 1.0 each have eight reflex enablers.  A VM may access the configuration byte for each reflex enabler via the aPortRflxEna IO ports.

Counter

A counter is set and incremented or decremented by command.  It issues a raw input on rollover to zero.  The GP 1.0 and Moto 1.0 each have eight 16-bit counters.  See cmdCTR_SET and cmdCTR_CT for details.  The cmdPCTR_SET command sets the count with a value in the scratch pad.  The cmdPCTR_WR command writes the count to a location in the scratch pad.  A counter may also be used as a missing pulse detector.  See cmdMPD_SET and cmdMPD_CHK for details.  A VM may access the count value for each reflex counter via the aPortRflxCtr IO ports.

Rail

A rail applies upper and lower limits to a parameter and issues a raw input with the new limited parameter.  See cmdRAIL for details.

Function

This element executes different functions on the input based on a selection parameter.  Currently, there is only one function associated with this element.  It subtracts a 2-byte offset from a 2-byte input and propagates the result in a raw input.  See cmdFUNC for details.

Window Comparator

This element compares the input parameter to min and max thresholds.  It issues four different raw inputs based on the comparison result: in window, less than min, greater than max, null.  See cmdWINDOW for details.  The cmdPWINDOW command retrieves the min and max from the scratch pad.

Error Amplifier

This element compares the input to a reference value and multiplies the error times a gain value.  It issues different raw inputs based on the comparison result: less than reference, greater than or equal to reference.  It passes the amplified error as its parameter.  See cmdERRAMP for details.  The cmdPERRAMP command retrieves the reference and gain from the scratch pad.

Error Attenuator

This element compares the input to a reference value and attenuates the error by dividing it by a power or 2.  It issues different raw inputs based on the comparison result: less than reference, greater than or equal to reference.  It passes the attenuated error as its parameter.  See cmdERRATT for details.  The cmdPERRATT command retrieves the reference and attenuation factor from the scratch pad.

The Scratchpad

The scratchpad is an area of RAM accessable by all reflexes and TEA processes in a module.  It is a convenient place for shared data.  The cmdPAD_IO command is used for writing to the scratchpad.  A host can use this command to read the scratchpad.  A VM may access the scratchpad via the aPortScratch IO ports.  Some reflex elements can take their parameters from the scratch pad.  This makes it possible to alter the behavior of reflexes while they are active.

Note:

GP 1.0 modules prior to firmware Build 12 have 32 scratch pad bytes.  GP 1.0 Firmware Build 12 has 56 scratch pad bytes and additional scratch pad features.

GP 1.0 Modules prior to firmware Build 12 support writes of one byte at a time.  Newer modules support writes of up to six bytes at a time.  A multi-byte write that would exceed the scratchpad size will generate an error message.  This feature may be used in BrainStem networks to increase communication throughput.

GP 1.0 Modules prior to Build 12 have 32 bytes of scratch pad RAM.  Newer modules treat the counter memory and reflex enabler memory as additional scratch pad RAM.  This gives them a total of 56 scratch pad bytes.  This provides some extra RAM for applications that don't use counters or enablers.  Bytes 0-31 are still reserved for general purpose use.  Scratch pad bytes 32-47 serve as both scratch pad RAM and two-byte records for reflex counters 0-7.  Scratch pad bytes 48-55 serve as both scratch pad RAM and single-byte records for reflex enablers 0-7.  Counter and enabler functions are unchanged.  It is up to the user to prevent data addressing conflicts between scratch pad variables, counters, and reflex enablers.

Newer modules also support I2C slave-mode reads from the scratch pad.  See cmdPAD_SETPTR for more details regarding this feature.

Moto 1.0 boards have all the latest scratch pad features.


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