Finite state controller for functional electrical stimulation: software implementation

Finite state machine provides a flexible framework to design controllers for Functional Electrical Stimulation (FES). The finite state machine controller allows the implementation of different control strategies under different states. This paper describes the software implementation of finite state machine controller for a portable FES stimulator based on 68332 microcontroller. The states, actions and state transition rules are defined in a text based controller definition file which is edited by users and downloaded to the portable FES stimulator from PC via serial RS232 link. The definition file also defines the stimulation output channels, sensor input channels, and constants which are used in actions and rules. Several commonly used stimulation actions such as pulsewidth/frequency change, pulsewidth ramp are pre-defined. More complex controllers like fuzzy logic controller or PID controller can be incorporated into the finite state controller using customized C controller function. This finite state FES controller is easy to use for ordinary users without computer programming knowledge, yet flexible enough to incorporate complex control functions for expert users who can write the customized C controller function.