Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started