Question
5) For the provided C-Code below, assume that it will be Compiled and Downloaded to the PIC16F887 Microcontroller. Given Fosc = 20 MHz. Comment all
5) For the provided C-Code below, assume that it will be Compiled and Downloaded to the PIC16F887 Microcontroller. Given Fosc = 20 MHz. Comment all lines of C-Code below marked with comments // and answer the questions that follow: Assume RD0 is Connected to an LED.
Unsigned int ms = 0; //
Void main()
TRISD0 = 0; //
T2CKPS0 = 1; //
T2CKPS1 = 0; //
TOUTPS0 = 0; //
TOUTPS1 = 0; //
TOUTPS2 = 1; //
TOUTPS3 = 0; //
PR2 = 250; //
TMR2ON = 1; //
if(TMR2IF = = 1) //
{
TMR2IF = 0; //
ms++; //
if(ms > = 1000) //
{
ms = 0; //
RD0 = ?RD0; //
}
}
}
}
Timer2 Prescaler ___________
Timer2 Postscaler __________
PR2 Register Equals _________
Timer2 Counts from __________ to ___________
TMR2IF Flag is set from _____________ operation and increases value of __________ Register.
Inverting of the LED Status at RD0 will occur every _________ sec
Calculate this and show your work:
Each Count Requires ____________ us
Calculate this and show your equations and work:
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