You will be writing software to set up the system in 8-bit left-aligned mode to
ID: 3777644 • Letter: Y
Question
You will be writing software to set up the system in 8-bit left-aligned mode to generate a 250Hz PWM signal on Port T bit 0 (PT0). The frequency of the PCLK is 4 MHz. The output will be low at the beginning of the cycle, and go high when the duty count is reached. The overall period of the waveform will be 4 s.
Write the ritual that initializes the system with a 250 Hz 50% duty cycle waveform on PT0.
Write a function that changes the duty cycle of the waveform on PT0. The format of the input parameter to this function is 8-bit unsigned binary fixed-point. 0 means 0%, 128 means 50%, and 255 means 99.6%.