Titus Manoj Kumar
Junior Member level 2
- Joined
- Oct 18, 2013
- Messages
- 24
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Location
- Sriperumpudur, Tamil Nadu
- Activity points
- 178
Dear All,
Am working on 8051 Timer Interrupt Programming.
Specs:
Timer 0 Mode 1.
Need to blink an Led for 30 seconds.
Xtal Freq: 11.0592Mhz.
I've pasted the code below. Could you please identify the errors in it. If so could you give me the complete code for it. It'l be a great help. Thanks.
code :
Am working on 8051 Timer Interrupt Programming.
Specs:
Timer 0 Mode 1.
Need to blink an Led for 30 seconds.
Xtal Freq: 11.0592Mhz.
I've pasted the code below. Could you please identify the errors in it. If so could you give me the complete code for it. It'l be a great help. Thanks.
code :
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 #include<reg51.h> sbit led = P2^0; //LED connected to D0 of port 1 void timer(void) interrupt 1 //interrupt no. 1 for Timer 0 { int x; for (x=0; x<600 ; x++) { led=~led; //toggle LED on interrupt TR0 = 0; } } main() { TMOD = 0x01; // mode1 of Timer0 TH0 = 0x4C; // initial values loaded to timer TL0 = 0x00; IE = 0x82; // enable interrupt TR0 = 1; //start timer while(1); // do nothing }
Last edited by a moderator: