Skip to content

Instantly share code, notes, and snippets.

@SaheblalBagwan
Created August 23, 2016 05:30
#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