| ??? 09/30/09 09:49 Read: times |
#169299 - One Problem Fixed Responding to: ???'s previous message |
I found that TF2 was not set to start the timer. I have fixed this but still the timer interrupt is not generated. This is the updated code.
#include <8052.h>
#define WAIT 1
#define READY 0
#define CLEAR 0
#define SET 1
volatile bit ovf = 0; /* record the overflow */
volatile bit bit_status = READY;
void isr_byte_recv(void) __interrupt 7;
main()
{
T2CON |= 0x01;
EXEN2 = 1;
EA = 1;
ET2 = 1;
TR2 = 1;
while (1) {
/* my application code here */
/* This is a test code */
if (TF2 == 1) { /* check overflow */
P1_4 = !P1_4; /* LED1 */
TF2 = 0;
}
}
}
void isr_byte_recv(void) __interrupt 7
{
P1_4 = !P1_4;
if (TF2 == 1) { /* check overflow */
ovf = 1;
P1_5 = !P1_5; /* LED2 */
}
else
P3_4 = !P3_4; /* buzzer */
TF2 = 0;
EXF2 = 0;
}
Now, the LED 1,2 should toggle continuously and buzzer beeps when EXF2 is set. But I see only the led1 blinking and LED2 and Buzzer are OFF this indicates that the timer is configured for capture mode but not giving interrupts. Is anything wrong here? |
| Topic | Author | Date |
| Timer 2 Interrupt Enable? | 01/01/70 00:00 | |
| do you actually clock the T2EX? | 01/01/70 00:00 | |
| Yes I am | 01/01/70 00:00 | |
| prototype visible to main | 01/01/70 00:00 | |
| Some Differences Found in Documentation | 01/01/70 00:00 | |
| who know the most about NXP chips ? | 01/01/70 00:00 | |
| Can't Get Your Point | 01/01/70 00:00 | |
| YES | 01/01/70 00:00 | |
| One Problem Fixed | 01/01/70 00:00 | |
| wrong include | 01/01/70 00:00 | |
| This was the Exact Problem | 01/01/70 00:00 | |
re include files | 01/01/70 00:00 | |
| Please check .RST file | 01/01/70 00:00 |



