| cmdMPD_SET | Index |
Command Code:
The Packet:
| 0 | 1 | 2 | 3 | 4 | ||||
| address | 3 | cmdMPD_SET | CtrID | NPULSES |
| CtrID - | Index of the counter. Range is 0-7. |
| NPULSES - | 1-byte pulse count failure limit (1-127) |
Description:
This command initializes a missing-pulse detector for use by reflexes. A counter ID that is out of range will generate an error message. A pulse count failure limit that is out of range will generate an error message. There is no reply packet.
A missing-pulse detector is a special type of counter. The 8 counter resources available to the BrainStem may be used as normal counters or missing-pulse detectors.
A normal counter generates a raw input when the count reaches zero after a decrement or increment operation. A missing-pulse detector generates a raw input after several consecutive cmdMPD_CHK commands fail to detect a valid pulse. This number of failures is the pulse count failure limit mentioned above. The cmdMPD_CHK command automatically resets the failure limit to the initial value after detecting a valid pulse.
A typical application for this function is to detect cycles in a varying digital or analog signal. A reflex loop must sample the signal at a constant rate and apply the cmdMPD_CHK function to check for pulses. Valid pulses, characterized by 0-1 transitions, continually reset the missing-pulse detector. A lack of pulses will cause a raw input. Then another reflex may act in response to the lack of pulses.