Hardware Reference
In-Depth Information
Step 3
Enter, assemble, and download the program onto the demo board for execution.
Step 4
Run the program. When the program runs, it outputs the message “duty cycle for DC:”
to the UART port (displayed on the HyperTerminal window). You enter from 00 to 99
(using the PC keyboard) to set the duty cycle for the DC motor and the program reads.
After that, the MCU will update the duty cycle for the DC motor immediately. The
HCS12 next outputs the message “duty cycle for servo:” to the HyperTerminal window.
The user will enter the new duty cycle for the digital waveform that drives the servo-
motor. Remember that the duty cycle for the servomotor is between 5 and 10 percent only.
(See Figure L8.3d.) You can figure out a set of convenient values for specifying duty cycles
for the servomotor. The program reads in the duty cycle and then performs the required
computation to derive the appropriate value that should be written into the duty cycle
registers. Your program will echo the new duty cycle on the LCD screen for the DC motor
and servomotor, respectively. If you are using the serial monitor to communicate with the
PC, then you will need two COM ports from the PC.
After that, the speed of the DC motor and the position of the servomotor would be changed.
Your program will wait for 5 s and then ask you to enter the new duty cycles and repeat the
same operation.
 
Search WWH ::




Custom Search