Motor Control Methods
The programs described below have been tested on a previous version of the hardware, and in simulation mode waith the current design.
Open Loop Control
Open loop control of a dc motor (MOT1) has been described in Chapter 8 and a program developed which allows the speed to be controlled manually. In the MOT2 circuit (Figure 11.3), the motor can be driven in either direction by setting RA4 or RA5 high, with both set low to turn the motor off. They must not be high together; this would switch on both transistors, resulting in no current through the motor, and possible damage to the power transistors. Open loop speed control can therefore be implemented by outputting a PWM signal at either RA4 or RA5.
The push-button inputs could be programmed to run the motor in either direction, or to increment and decrement the speed in one direction by modifying the delay in a PWM program. Alternatively, the speed could be set at the binary inputs to port B, either manually at the DIP switches, or with an 8-bit digital input code supplied from a master controller. Analogue control is possible from a manual input (RV1) or from a remote voltage source. Any of these inputs could be used to set the duty cycle of the drive waveform. However, neither the speed nor position can be controlled accurately without feedback.