Task 5
Task 5
TASK 5
Spring 2021
CSE307 MBSD
“On my honor, as student of University of Engineering and Technology, I have neither given
nor received unauthorized assistance on this academic work.”
Submitted to:
Dr. Bilal Habib
Saturday, May 22, 2021
Timer1 Timer0
Gate C/T M1 M0 Gate C/T M1 M0
0 0 0 1 0 1 1 0 (Hex= 16)
void StartTimer()
{
TR1 = 1; //Start Timer 1
TR0 = 1; //Start Counter 0
}
void initTimer()
{
TMOD = 0x16; //Timer 1 mode 1 and Counter 0 mode 2
//Delay of 60ms
TH1 = 0x15;
TL1 = 0x9F;
IE = 0x88; //Enable TF Enterrupt for Timer1
TH0 = 0; //Start Counter from 0
Input = 1; //Set for Input
}
void main(void)
{
Led = 0; //Turn Off the Led
P2 = 0; //Turn Off the Port 2
initTimer();
StartTimer();
while (1)
{
}
}