Created
August 23, 2016 05:30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<reg51.h> | |
sbit LED = P0^0; | |
void timer0_isr() interrupt 1 | |
{ | |
LED =! LED; // Toggle the LED pin, | |
//Note Timer value is not reloaded, It is automatically taken care | |
} | |
void main() | |
{ | |
TMOD = 0x02; //Timer0 mode 2 | |
TH0 = 0X1A; //Load the timer value | |
TR0 = 1; //turn ON Timer zero | |
ET0 = 1; //Enable TImer0 Interrupt | |
EA = 1; //Enable Global Interrupt bit | |
while(1) | |
{ | |
// Do nothing | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment