Question: Problem 19: (24 points) Figure 1 shows software for controlling the intensity of an LED. The user sets the LED intensity using an incre- mental


Problem 19: (24 points) Figure 1 shows software for controlling the intensity of an LED. The user sets the LED intensity using an incre- mental rotary encoder that generates 24 count-per-revolutions. The dsPIC33EP64MC502 microcontroller observes the rotation of the rotary encoder using the modulo counter mode of the quadrature encoder interface module, where the counter register representing the encoder rotation position is programmed to be an integer between 0 and 95. Rotating the encoder shaft clockwise increases the count while a counter clockwise rotation decreases the count. One complete clockwise rotation of the encoder shaft sweeps the duty cycle over its full range from 0% to 100% Modify the code so that four complete clockwise rotations of the encoder shaft are required to sweep the duty cycle 1. (8 points) Using the line numbers in Figure 1, which two lines must be modified? Justify your answer in two 2. (16 Points) Write the modified code lines. For each of the two s, nclude an appropriate line number and from 0% to 100%. comment Problem 19: (24 points) Figure 1 shows software for controlling the intensity of an LED. The user sets the LED intensity using an incre- mental rotary encoder that generates 24 count-per-revolutions. The dsPIC33EP64MC502 microcontroller observes the rotation of the rotary encoder using the modulo counter mode of the quadrature encoder interface module, where the counter register representing the encoder rotation position is programmed to be an integer between 0 and 95. Rotating the encoder shaft clockwise increases the count while a counter clockwise rotation decreases the count. One complete clockwise rotation of the encoder shaft sweeps the duty cycle over its full range from 0% to 100% Modify the code so that four complete clockwise rotations of the encoder shaft are required to sweep the duty cycle 1. (8 points) Using the line numbers in Figure 1, which two lines must be modified? Justify your answer in two 2. (16 Points) Write the modified code lines. For each of the two s, nclude an appropriate line number and from 0% to 100%. comment
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
