Microprocessors – Lab 8: Requirement Description Solved

$ 20.99
Category:

Description

⚫ CCP Module
 video: https://www.youtube.com/watch?v=0jZ3yKdq3yY
 hackmd: https://hackmd.io/@BxpMLE7ATAWt1EF9QEbig/SkuUiAhBj
 DEMO: https://www.youtube.com/watch?v=x7358_vQwpg

⚫ Basic (70%)
 Description: Use RB0 as a motor control button, and then use it to control the motor rotation as follow:
1. Initial degree: – 90°
2. When pressing the button, the motor will rotate 90° counterclockwise.
3. When the motor rotates to +90°, the direction of rotation will change to clockwise.
4. When the motor rotates back to -90°, pressing the button again, do step 2 ~ step 4.

 Standard of Grading:
1. Do not ignore CCP1CON <5:4> when setting the duty cycle.
2. You need to explain how you set the PWM period to 20ms.
3. You need to explain how you set the PWM duty cycle to 500μs ,1450μs and 2400μs.
4. C or assembly are both accepted.
⚫ Advanced (30%)
 Description: Use RB0 as a motor control button, and then use it to control the motor rotation as follow:
1. Initial degree: – 90°
2. When pressing the button, the motor will rotate from – 90° to + 90°.
3. When the motor rotates to +90°, set the degree of the motor to the initial state – 90°.
4. When pressing the button again, do step 2 ~ step 4

 Standard of Grading:
1. Do not set – 90°and + 90°only.
You should deal with each degree, which means you should increase CCPR1L: CCP1CON <5:4> one by one.
2. Do not ignore CCP1CON <5:4> when setting the duty cycle.
3. You need to explain how you set the PWM period to 20ms.
4. You need to explain how you set the PWM duty cycle to 500μs and 2400μs.
5. C or assembly are both accepted.

⚫ Bonus (20%)
 Description: Use RB0 as a motor control button, and then use it to control the motor rotation as follow:
1. Initial degree: – 90°
2. When pressing the button, the motor will rotate from – 90° to + 90° and then rotate back to – 90°, rotating continuously.

 Standard of Grading:
1. Do not set – 90°and + 90°only.
You should deal with each degree, which means you should increase CCPR1L: CCP1CON <5:4> one by one.
2. Do not ignore CCP1CON <5:4> when setting the duty cycle.
3. You need to explain how you set the PWM period to 20ms.
4. You need to explain how you set the PWM duty cycle to 500μs and 2400μs.
5. C or assembly are both accepted.

⚫ Hint:
The following steps should be taken when configuring the CCP module for PWM operation:
1. Set the PWM period by writing to the PR2 register.
2. Set the PWM duty cycle by writing to the CCPRxL register and CCPxCON<5:4>bits.
3. Make the CCPx pin an output by clearing the appropriate TRIS bit.
4. Set the TMR2 prescale value, then enable Timer2 by writing to T2CON.
5. Configure the CCPx module for PWM operation.

Reviews

There are no reviews yet.

Be the first to review “Microprocessors – Lab 8: Requirement Description Solved”

Your email address will not be published. Required fields are marked *