Page 281 - Programming Microcontrollers in C
P. 281
266 Chapter 5 Programming Large 8-Bit Systems
read in the motor speed;
while ( motor speed does not change);
}
For the moment, let us defer the problem of getting the desired motor
speed. This value will be converted to time by use of the count()
routine and will be saved in motor_period. Next, we need to
calculate the required motor voltage. For this calculation, let us revert
to an experimental technique that can be used usefully. An open loop
system was set up to test the operation of the motor system. Several
input values were entered, and the performance of the motor was
recorded. Table 5-2 shows the result of these measurements.
PWM_Count PWM_Count icap period period ms voltage RPM
Hex decimal counts
0x700 1792 15812 31.62 2.186 1897
0x780 1920 11405 22.81 2.341 2630
0x800 2048 8581 17.17 2.498 3494
0880 2176 6841 13.68 2.653 4385
0x900 2304 5616 11.23 2.809 5342
0x980 2432 4759 9.52 2.964 6304
0xa00 2560 4059 8.12 3.118 7391
0xa80 2688 3530 7.06 3.273 8499
0xb00 2816 3085 6.17 3.424 9724
0xb80 2944 2736 5.47 3.578 10965
Table 5-2: Motor Performance Measurements
The data for this table were gathered by the use of an
M68HC11EVM and a simple motor driver. This driver is a
demonstration board provided by Motorola to show the use of the
MC33033 pulse width motor driver and the MPM3002 FET motor
driver H bridge. A small DC motor with a speed range of 1000 to
11000 rpm was mounted on the board, and the appropriate circuitry
was added to interface the board to the computer. This interface
consisted of a simple RC integrator to receive the PWM signal from
the computer board and a circuit to measure the rotation of the motor.
This latter circuit was quite crude. A magnetic reed switch was
mounted near the motor shaft and a magnet cemented to the shaft.
For each rotation of the shaft, the reed switch would close and open
one time. A resistor was connected between the 12 volts of the motor
driver and one side of the switch; the other side of the switch was