subs.asm
来自「TIMER.ASM ********* [ milindhp@tifrv」· 汇编 代码 · 共 27 行
ASM
27 行
; SUBS.ASM
; ********
;read key port in key
read_keys movf newkey, w ;debouncing taken care by s/w
movwf oldkey
movf GPIO, w ;read newkeys
andlw 00011000b ;gp3, gp4 are key ports
movwf newkey
comf newkey, f ;complement since active low
andwf oldkey, w ;key=oldkey AND compl(newkey)
movwf key
;indicate to display routine units or tens key pressed
btfsc key, units_key
bsf digit_inc, units_inc
btfsc key, tens_key
bsf digit_inc, tens_inc
return
;************************************************************
init_ports movlw 0 ;all lo
movwf GPIO
movlw 00011000b ;port g0-g2,g5 o/p & gp3,gp4 i/p
tris GPIO
clrf TMR0 ;clr tmr0 & prescaler
movlw 11000011b ;tmr0 enable with 1:16 prescaler
option
return
;***************** EOF SUBS.ASM ******************************
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?