2004-08-11 04:29 AM
sos,why TIMERB_INT cannt exit interrup.sos!!!
2004-08-01 05:36 AM
i use timerb_oc1 for 1ms timer, enter oc2 int but ,cannt exit interrup,why?
please tell me exit interrup other condition.thank you. void INT_Timer2 (void) {unsigned char temp; if(TIM2_SR&0x40) { temp = M2_SR; /* Clear all flags */ temp = TIM2_OC1L; TIM2_OC1H= 0x03; /* Load OC1R value */ temp = TIM2_SR; /* Clear all flags */ TIM2_OC1L =0xe8; TIM2_ACL = TIMER_DEFAULT; /* Reset counter to 0xFFFC */ } if(TIM2_SR&0x0 { temp = TIM2_SR; /* Clear all flags */ temp = TIM2_OC2L; TIM2_OC2H= 0xFF; /* Load OC1R value */ temp = TIM2_SR; /* Clear all flags */ TIM2_OC2L =0x00; }} main(){ TIM2_SR &= 0xFB; TIM2_CR1 |= 0x40; /* Enable timerA interrupts */ TIM2_OC1H= 0x03; /* Load OC1R value */ TIM2_OC1L =0xe8; }2004-08-02 03:13 AM
2004-08-04 03:20 AM
i have checked my code
pragma TRAP_PROC SAVE_REGS void INT_Timer2 (void) VECTOR ADDRESS 0xffe8 INT_Timer2 has been add.2004-08-05 01:22 AM
In the Interrupt Routine also check for Overflow flag, if it is set then clear it. Because the interrupt Routine for Overflow and Output Compare is same. So once the Interrupt is generated the control could reenter in to the Routine untill all the Flags are cleared.
2004-08-05 04:58 AM
i have been found wrong ,in my map file
SEGMENT ''TIMA'' TIM1_SR 31 1 ( 1) TIMA TIM1_IC1L 32 1 ( 1) TIMA TIM1_OC1L 33 1 ( 1) TIMA TIM1_CNTL 34 1 ( 1) TIMA TIM1_IC2L 35 1 ( 1) TIMA TIM1_OC2L 36 1 ( 1) TIMA SEGMENT ''TIMB'' TIM2_CR2 41 1 ( 3) TIMB TIM2_CR1 42 1 ( 2) TIMB TIM2_SR 43 1 ( 4) TIMB TIM2_IC1L 44 1 ( 1) TIMB TIM2_OC1L 45 1 ( 2) TIMB TIM2_ACL 46 1 ( 2) TIMB TIM2_IC2L 47 1 ( 1) TIMB TIM2_OC2L 48 1 ( 2) TIMB st72c define /*-------------------------------------------------------------------------- ST72321 Timer A Internal Registers ---------------------------------------------------------------------------*/ #pragma DATA_SEG SHORT TIMA volatile unsigned char TIM1_CR2; /* control register 2 */ volatile unsigned char TIM1_CR1; /* control register 1 */ volatile unsigned char TIM1_SR; /* status register */ volatile unsigned char TIM1_IC1H; /* input capture 1 high */ volatile unsigned char TIM1_IC1L; /* input capture 1 low */ volatile unsigned char TIM1_OC1H; /* output compare 1 high */ volatile unsigned char TIM1_OC1L; /* output compare 1 low */ volatile unsigned char TIM1_CNT; /* counter high */ volatile unsigned char TIM1_CNTL; /* counter low */ volatile unsigned char TIM1_ACH; /* alternate counter high */ volatile unsigned char TIM1_ACL; /* alternate counter low */ volatile unsigned char TIM1_IC2H; /* input capture 2 high */ volatile unsigned char TIM1_IC2L; /* input capture 2 low */ volatile unsigned char TIM1_OC2H; /* output compare 2 high */ volatile unsigned char TIM1_OC2L; /* output compare 2 low */ /*-------------------------------------------------------------------------- ST72321 Timer B Internal Registers ---------------------------------------------------------------------------*/ #pragma DATA_SEG SHORT TIMB volatile unsigned char TIM2_CR2; /* control register 2 */ volatile unsigned char TIM2_CR1; /* control register 1 */ volatile unsigned char TIM2_SR; /* status register */ volatile unsigned char TIM2_IC1H; /* input capture 1 high */ volatile unsigned char TIM2_IC1L; /* input capture 1 low */ volatile unsigned char TIM2_OC1H; /* output compare 1 high */ volatile unsigned char TIM2_OC1L; /* output compare 1 low */ volatile unsigned char TIM2_CNT; /* counter high */ volatile unsigned char TIM2_CNTL; /* counter low */ volatile unsigned char TIM2_ACH; /* alternate counter high */ volatile unsigned char TIM2_ACL; /* alternate counter low */ volatile unsigned char TIM2_IC2H; /* input capture 2 high */ volatile unsigned char TIM2_IC2L; /* input capture 2 low */ volatile unsigned char TIM2_OC2H; /* output compare 2 high */ volatile unsigned char TIM2_OC2L; /* output compare 2 low */ *.prm TIMA INTO NO_INIT 0x0031 TO 0x003F; TIMB INTO NO_INIT 0x0041 TO 0x004F; why appear the result. attachments is the file ,thank you. ________________ Attachments : test.rar : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzW5&d=%2Fa%2F0X0000000bUc%2FLfhMNe8vPtXuZhEUG9BuKjzGXx7izCdVRupU1c5rvIo&asPdf=false2004-08-10 02:49 AM
In *.prm file in ''NAMES'' section where you give the names of the files to be linked.
For register map file st72321.o use a '+' sign after that for example NAMES main.o st7231.o+ timer.o ansi.lib END This will avoid the optimization of register MAP file. Otherwise compiler removes the variables (registers in this case), which are not used.2004-08-11 04:29 AM
thank you sir,i have do it.
check map file fint it wrong. thank you help.