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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/10/02 11:45
Read: times


 
#30529 - Faulty ISR??? Part III
Part III

;Code:
BOUNCE_ON EQU 01h
BUTTON_STATUS EQU 21h
RED EQU 0Dh
BLUE EQU 0Eh
PORT1_0 EQU 90h
PORT1_1 EQU 91h

org 0003h
lcall buttonpress
reti

buttonpress:
jb BOUNCE_ON, check_bounce
setb BOUNCE_ON
clr PORT1_0
mov A, 0b0h
mov BOUNCE_DELAY, #00h
CPL A
mov BUTTON_STATUS, A
jb RED, reddd
jnb BLUE, exit_buttonpress
cpl PAUSE
jmp exit_buttonpress
reddd:
sjmp init
check_bounce:
jnb BOUNCE_ON, exit_buttonpress
clr c
mov A, #50d
subb A, BOUNCE_DELAY
jnz exit_buttonpress
clr BOUNCE_ON
setb PORT1_0

exit_buttonpress:
ret

;The BOUNCE_DELAY is incremented by another ISR for timer 0. Timer 0 overflows every 1ms
;check_bounce is called by the same ISR so that BOUNCE_ON will be cleared even if the External
;Interrupt 0 is not activated after a period of 50ms.


List of 14 messages in thread
TopicAuthorDate
Faulty ISR???            01/01/70 00:00      
Faulty ISR??? Part II            01/01/70 00:00      
RE: Faulty ISR???            01/01/70 00:00      
Faulty ISR??? Part III            01/01/70 00:00      
RE: Faulty ISR???            01/01/70 00:00      
RE: Faulty ISR???            01/01/70 00:00      
RE: Faulty ISR??? Eric            01/01/70 00:00      
RE: Faulty ISR??? Eric            01/01/70 00:00      
RE: Faulty ISR??? Eric            01/01/70 00:00      
Peter and Eric..            01/01/70 00:00      
RE: Peter and Eric..            01/01/70 00:00      
RE: Faulty ISR???            01/01/70 00:00      
RE: Faulty ISR???            01/01/70 00:00      
RE: Faulty ISR???            01/01/70 00:00      

Back to Subject List