摘要 |
PURPOSE:To stably control a speed by sequentially switching the pulse of a motor during operation by a multiplexer, and controlling motors using an operation amount generated by counting a pulse period by the use of the multiplexer. CONSTITUTION:The pulse period of an encoder E1 is measured by inputting the value of an incremental/decremental counter UDC1 to a CR10 at the rising edge of the output pulse CLR1 of the encoder E1. Then, the speed of a motor M1 is calculated from the pulse period, an operating amount, i.e., the set value of a PWM timer is obtained from the detecting speed and a target speed by Pi calculation, and it is written in the PWM timer 1. A PWM pulse is output from the PWM timer 1 to the motor M1, which is rotated in response to the width of the PWM pulse. The motor speed can be maintained constant by repeating the detection of the speed the Pi calculation PWM output. |