最近在玩8条腿的12f675,发现一个怪问题。
具体如下:
list p=12f675
#include "p12f675.inc"
__config b'
org 000h
nop
goto main
org 0004h
goto intt0
;--------前处理------------
tmr0r equ option_reg
tmr0 equ 0x01
int equ 0x0b
figt0 equ 0x30
wtemp equ 0x31
timeh equ 0x25
timel equ 0x26
;---------i/o初始化----------
main
bsf status,rp0
clrf ansel
movlw b'
movwf trisio
bcf status,rp0
clrf cmcon;
;--------点灯程序---------
movlw 05h
movwf timeh
movlw 0ah
movwf timel
clrf figt0
bcf gpio,gp4
bsf figt0,0
loop
movlw 00h
movwf 0x40
goto loop
;--------初始化tmr0------
bsf status,rp0
movlw b'
movwf tmr0r
bcf status,rp0
movlw b'
movwf int
movlw timeh
movwf tmr0
;---------中断执行程序-----
intt0
movwf wtemp
bcf int,t0if
bcf status,rp0
movlw timel
movwf tmr0
btfss gpio,gp4
bsf gpio,gp4
bcf gpio,gp4
movlw wtemp
retfie
end
运行此程序后,gp4始终低电平。
如果把 btfss gpio,gp4 改成btfss gpio,gp4 gp4就为高电平
bsf gpio,gp4 bsf gpio,gp4
bcf gpio,gp4 bsf gpio,gp4
如果gp4能输出高电平,那就说明中断响应了。可改回来就变死低了???