timer interrupt routine problem COSMIC compiler
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2006-05-25 1:59 PM
Posted on May 25, 2006 at 22:59
timer interrupt routine problem COSMIC compiler
Labels:
- Labels:
-
Legacy Products
This discussion is locked. Please start a new topic to ask your question.
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2006-05-03 8:03 PM
Posted on May 04, 2006 at 05:03
hello
i wrote a program that operate the timer as a counter. in intetion to create an interrupt. there are 3 problems: 1) the TCHR and TCLR are not going up only the TACR 2) the TOF register never occure never set to 1. 3) I alwys enter the interrupt routine and I can not go out from it. My program is: #include #define output 1 #define input 0 #define EnableInterrupts _asm(''RIM'') #define DisableInterrupts _asm(''SIM'') void main() { EnableInterrupts; TCR1=0b00100000; //configure the counter TCR2=0b00000100; TCSR=0b00000100; TCLR=0; //restat the counter to 650000 //TCSR=0b00000000; while(1) { } } and th INPERRUPT: extern void _stext(); /* startup routine */ //extern unsigned char ohad; @interrupt void INT_Timer(void) { //return; char t2=9; t2=10; t2=11; } /* Interrupt vector table, to be linked at the address 0xFFE0 (in ROM) */ void (* const _vectab[])() = { INT_Timer, /* 0xFFE0 */ INT_Timer, /* 0xFFE2 */ INT_Timer, /* 0xFFE4 */ INT_Timer, /* 0xFFE6 */ INT_Timer, /* 0xFFE8 */ INT_Timer, /* 0xFFEA */ INT_Timer, /* 0xFFEC */ INT_Timer, /* 0xFFEE */ INT_Timer, /* 0xFFF0 */ INT_Timer, /* 0xFFF2 */ INT_Timer, /* 0xFFF4 */ INT_Timer, /* 0xFFF6 */ INT_Timer, /* 0xFFF8 */ INT_Timer, /* 0xFFFA */ INT_Timer, /* Trap vector */ _stext, /* Reset Vector */ };Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2006-05-03 9:26 PM
Posted on May 04, 2006 at 06:26Hello, from the compiler point of view, I see no problems with your code. When you say ''I never get out of the interrupt routine'', it's more likely that you actually get out (execute RETI), but then immediately get back into it again because another interrupt happens (you did'n clear the flag, or another interrupt source is active...) Regards, Luca (Cosmic)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2006-05-03 10:11 PM
Posted on May 04, 2006 at 07:11
Hello Luca
Can u tell me how do i clear the Interrupt Flag?? after I get in to interrupt routine i have added: @interrupt void TIMER_int (void) { char ohad1=0; ohad1=1l; ohad1=12; ohad1=TCSR; TCLR=0; } when I look into the VIEW-->Peripheral Register I can not see the TOF flag at all. so can you tell how do i get out from thsu interrupt?? I suspect that the TOF is still set or i did not put IRET instruction thanks ohadOptions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2006-05-25 1:59 PM
Posted on May 25, 2006 at 22:59
I think you should not put all interrupt to INT_Timer,maybe you can write one interrupt routine for every interrupt. then you will find where work wrong.
do you think so. regards.