cmdPTIME_RDIndex

Command Code:

The Packet:

Description:

This command is only available on BrainStem modules with the pin state-transition timer feature.

This command retrieves the 2-byte time value from a digital IO pin state-transition timer.  A cmdDIG_CFG command may be necessary to configure a digital IO pin before executing cmdPTIME_RD.  Two timing modes are possible: edge mode and width mode.

After issuing the cmdPTIME_RD command in edge mode, an internal timer measures the elapsed time until a transition from the non-target state to the target state occurs on the specified digital input pin.  The elapsed time is a 2-byte value in units of 1.6us.  The maximum time interval is 104ms.  A timeout is represented by a value of 0.

After issuing the cmdPTIME_RD command in width mode, the BrainStem waits until a transition occurs from the non-target state to the target state on the specified digital input pin.  Then it measures the elapsed time until the input pin returns to the non-target state.  The elapsed time is also a 2-byte value in units of 1.6us.  The maximum time interval is 104ms.  A timeout is represented by a value of 0.  A timeout will occur if 104ms elapse before the start transition and end transition occur.

NOTE: The times returned when using this function may differ from the true times by +-6 clock ticks (+-9.6us).  This tolerance applies to both timer modes.  An application that uses the pin timers must be able to handle this tolerance.

If the HOST bit is set, the BrainStem will send a reply packet to the host .  The cmdDEV_VAL reply packet echoes the timer input ID in the first data byte and contains the time in high-byte, low-byte format in the remaining 2 bytes.  If the RFLX bit is set, the value will go directly to a reflex routine within the BrainStem.  The HOST bit and the RFLX bit may be set at the same time.

The following table shows Console commands and sample replies when requesting transition timing input from a BrainStem with an address of 2. (The Console program automatically inserts a size byte into the command packet and extracts the size byte from the reply packet.)

Timer Input Device ID Console Command Sample Reply
1 11 (0x0B) 2 29 129 02:04,0B,00,00
2 12 (0x0C) 2 29 130 02:04,0C,00,00
3 13 (0x0D) 2 29 131 02:04,0D,00,00
4 14 (0x0E) 2 29 132 02:04,0E,00,00

version: 1.0, build n.a.
© Copyright 1994-2012 Acroname, Inc., Boulder, Colorado.  All rights reserved.