版主你好,我是一名初学者,刚学习PIC,我用10F200编了个汇编程序,要实现以下四个功能是: 1.上电时,要放一次 2.GP2=0时要放一次 3.GP1=0时要吸一次 4.GP1=1时要放一次 (放:GP0先1MS的高电平,然后5MS的低电平,最后保持高电平。 吸:GP3先给1MS的高电平,然后以5MS的低电平,15MS的高电平循环下去)我编译成功了,但是跑表不行,楼主能帮我看看程序吗?[code][/code]list P=10f200 ;指定微控制器型号和文件输出格式
#include <p10f200.inc>
__CONFIG _CP_OFF & _WDT_OFF
T0 EQU 10H
T1 EQU 11H
T2 EQU 12H
TEMP EQU 13H
ORG 0000h
MOVLW 0f9H
TRIS GPIO
MOVF TMR0,T0
MOVLW 05H
MOVWF T1
MOVLW 0FH
MOVWF T2
MOVLW 03H
OPTION
CALL FANG
MAIN: BTFSS GPIO,04H
CALL FANG
BTFSS GPIO,02H
CALL XI
BTFSC GPIO,02H
CALL FANG
GOTO MAIN
FANG: BSF GPIO,0H
BTFSS TEMP,0H
GOTO FANG
CLRF TEMP
BCF GPIO,0H
DECFSZ T1,F
GOTO FANG
BSF GPIO,0H
MOVWF 05H
MOVLW T1
GOTO MAIN
XI: BSF GPIO,08H
BTFSS TEMP,0H
GOTO XI
CLRF TEMP
GOTO XI_1
XI_1: BCF GPIO,08H
BTFSS TEMP,0H
GOTO XI_1
CLRF TEMP
DECFSZ T1,F
GOTO XI_1
MOVLW 05H
MOVWF T1
GOTO XI_2
XI_2: BSF GPIO,08H
BTFSS TEMP,0H
GOTO XI_2
CLRF TEMP
DECFSZ T2,F
GOTO XI_2
MOVLW 0FH
MOVWF T2
GOTO XI_1
DELAY_1MS:SUBWF TMR0,T0
MOVLW 07DH
SUBWF T0,W
BTFSS STATUS,0H
GOTO DELAY_1MS
MOVLW 01H
MOVWF TEMP
MOVF TMR0,T0
RETURN
END
|