PA3040
Advanced Member level 3
- Joined
- Aug 1, 2011
- Messages
- 883
- Helped
- 43
- Reputation
- 88
- Reaction score
- 43
- Trophy points
- 1,308
- Activity points
- 6,936
#include <p16f877a.inc>
__config 3f39
org 0x000
Start goto main
org 0x004
goto isr
main call sys_init
call led
led movf TMR0,W
movwf PORTC
goto led
isr btfss INTCON,TMR0IF ;Clear TMR0 Overflow Interrupt Flag bit
retfie
bcf INTCON,TMR0IF ;Clear TMR0 Overflow Interrupt Flag bit
clrf PORTC
rlf PORTD,F
retfie
sys_init clrf PORTC
clrf PORTD
banksel TRISC
clrf TRISC
clrf TRISD
movlw b'00100010'
movwf OPTION_REG
banksel PORTC
movf TMR0,w
clrf TMR0
bsf PORTD,0
bcf INTCON,TMR0IF ;Clear TMR0 Overflow Interrupt Flag bit
bsf INTCON,TMR0IE ;Enables the TMR0 interrupt
bsf INTCON,GIE ;Global Interrupt Enable bit
return
end
I sow that TIMR0 incrementing difference sequence
Also it would be much appreciated if you can provide me the DNS file that you checked above codes
Do you mean that there is no sequence/order to the incrementing? Is it not incrementing every eight switch presses?
Due to debouching issued. is it not incrementing every eight switch presses or any other reason?
Dear Tahmid,
Do you mean that there is no sequence/order to the incrementing? YES
Can I have the switch debounce sample circuit. can we implement switch debounce in software?
Also it would be much appreciated if you can provide me the DNS file that you checked above codes
Thanks in advance
Did your hardware respond similar?
NO..in present situation you can not use any software means for switch denouncing as here you are not dealing with any IO pin...but you are here providing a external clock to internal timer...just think of this pin as a clock input path to the internal timer scalper .. presuming that you already had a pull up resistor connected on this pin....just try adding a simple 100 nf capacitor from this pin to ground... andyes..first start from a pullup value of say 10k..and if still results are`nt good then try increasing the pull-up resistor value ...this simple arrangement may help in eliminating noise generated at keypress...
Dear ALERTTLINK,
Thanks for reply and advice
Yes, my hardware also respond the same problem at all time not only first button press due to denouncing issue
- - - Updated - - -
Dear aashitech,
Thanks for reply
Can you please give me a mathematical solution instead of changing the resister value manually
Please advice
Dear ALERTTLINK,
Thanks for reply and advice
Yes, my hardware also respond the same problem at all time not only first button press due to denouncing issue
- - - Updated - - -
Dear aashitech,
Thanks for reply
Can you please give me a mathematical solution instead of changing the resister value manually
Please advice
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?