“Debouncing???” – Free preview!

In this lesson we learn what debouncing is, and why it is so important.

 

Here’s the assembly code:

list p=16F1455 ; list directive to define processor
#include “p16F1455.inc” ; processor specific variable definitions
__CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_OFF & _MCLRE_ON & _CP_OFF & _BOREN_ON & _CLKOUTEN_OFF & _IESO_ON & _FCMEN_ON
__CONFIG _CONFIG2, _WRT_OFF & _CPUDIV_NOCLKDIV & _USBLSCLK_48MHz & _PLLMULT_3x & _PLLEN_DISABLED & _STVREN_ON & _BORV_LO & _LPBOR_OFF & _LVP_ON

errorlevel -302 , -207 ; suppress message 302 from list file
banksel OSCCON
movlw B’00111110′
banksel TRISC
clrf TRISC
banksel TRISA
movlw h’FF’
movwf TRISA
banksel LATC
clrf LATC
loopy1:
banksel PORTA
btfsc PORTA, 0
call buttonpress
goto loopy1
buttonpress:
banksel LATC
incf LATC
btfsc LATC, 4
clrf LATC
movlw d’50’
movwf h’0070′
count1:
banksel PORTA
btfss PORTA, 0
decfsz h’0070′,1
goto count1
movlw d’50’
movwf h’0070′
count2:
banksel PORTA
btfss PORTA, 0
decfsz h’0070′,1
goto count2
return

end

 

Questions