Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/14/02 03:02
Read: times


 
#25770 - PCON
I am using at89C52. I am having a hard time getting my Microcontroller to awake from sleep mode. It should be awaken by Timer 2 a 50us tic counter. The ISR does execute but when reti is execute the controller get lost. The problem is the wrong value is on the stack. Any Ideas why this might happen.


my code look like this



main(){

Init_tic_counter();

while(1){
read_adc();
PCON = 1;
}

}



My ISR
; Timer interrupt
CSEG AT 2Bh
T2_VEC: jmp TIM2_IRQ


TIM2_IRQ:
clr TF2
push psw
INC cTimerFlag
inc cTR2counter
pop psw
reti


Init_tic_counter:
setb EA
setb ET2
mov TL2, #0x50
mov RCAP2L, #0x50
mov TH2, #0xC3
mov RCAP2H, #0xC3
mov T2MOD, #0xF1
clr CP_RL2 clr C_T2
setb TR2
clr EXEN2
clr TCLK
clr RCLK
clr EXF2
clr TF2
ret
end






List of 3 messages in thread
TopicAuthorDate
PCON            01/01/70 00:00      
RE: PCON            01/01/70 00:00      
RE: PCON            01/01/70 00:00      

Back to Subject List