Program Simulation
The speed control application was tested in simulation mode (Figure 11.7). The forward drive, index sensor feedback and current monitoring signals can be seen on the
virtual oscilloscope. The drive is operating at about 100 Hz and the feedback has a period of 100 ms, indicating a speed of 600 rpm (switch input ¼ 0xA0). The maximum motor speed (switch input ¼ FF) with this setup is just over 1000 rpm, the maximum displayed on the animated motor. The minimum speed (switch input ¼ 00) is just below 240 rpm.
The closed loop response can be tested at 600 rpm by opening the switch across the dummy load of 2 U. This adds extra resistance in series with the motor causing a drop in the ‘on’ current, hence the speed. The drive program must compensate by increasing the PWM drive to restore the set speed.
The current in the bridge drivers, forward and reverse, can be monitored across the 0.1 U sensing resistor. The ‘on’ current generates a voltage of about 0.4 V, indicating a current of 4 A. This can be connected to the analogue input AN11 by closing the jumper JP1 so it can be measured for control purposes. This could also be used to prevent excessive current in the bridge if, for example, the motor stalls.
Depending on the processing power of your computer, the simulation speed may drop back from real-time operation to a lower speed when testing this circuit. Check the status information below the edit screen: when the processor load reaches 100%, the simulation clock will slow down.