Question: Q1. [20 marks) Write a program to control the speed of a DC motor connected to the PIC16F84A microcontroller. The PWM input of the motor

 Q1. [20 marks) Write a program to control the speed ofa DC motor connected to the PIC16F84A microcontroller. The PWM input ofthe motor is connected to RAO. Assume we use a keypad as

Q1. [20 marks) Write a program to control the speed of a DC motor connected to the PIC16F84A microcontroller. The PWM input of the motor is connected to RAO. Assume we use a keypad as an input device, as shown in figure, and according to the pressed button; the microcontroller does one of the following: Button pressed 0 1 2 3 None Action The motor stops The motor moves at 25% of the speed The motor moves at 50% of the speed The motor moves at full speed Speed remains as is RBO RB1 0 RB2 PIC16F84A RAO DC Motor 2 RB3 a. [10 marks] Write a program that continuously scans the keypad and acts accordingly. Assume you already have written subroutines SCAN and SPEED. Note the following: i. Subroutine SCAN scans the keypad and returns the value of the pressed key in the working register (i.e., 1, 25, 50, and 99). If no key is pressed, SCAN returns with the working register having the value 255 (i.e., motor speed remains as is). ii. Subroutine SPEED takes the value inside the working register and uses it to control the speed of the DC motor

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!