#include <p10f202.inc>
__CONFIG _MCLRE_OFF & _CP_OFF & _WDT_ON & _IntRC_OSC
org 0x000
nop
goto Main
Main
MOVLW 0AH ;GPIO 1,3能用作输入。GPIO 0,2用作输出
tris gpio
movlw 0xc1 ;设置TMR0为4分频
option
MainLoop
clrwdt
call KeySamp ;按钮采样
; call Samp ;IR采样
goto MainLoop
KeySamp ;4,9,12,13,16,20,29us
;==============================
btfss gpio,3 ;按键采集
goto aaa
goto bbb
bbb
bsf gpio,2
goto ccc
aaa
bcf gpio,2
ccc
return
end |