COUNT EQU 20H
TEMP EQU 21H
TEMP1 EQU 22H
J0 EQU 22H
RP0 EQU 05H
RP1 EQU 06H
PIR1 EQU 0CH
PIE1 EQU 8CH
TRMT EQU 01H
RCIF EQU 05H
RCIE EQU 05H
TRISC EQU 87H
TRISB EQU 86H
TRISD EQU 88H
PORTB EQU 06H
PORTD EQU 08H
FSR EQU 00H
TXIF EQU 04H
SPBRG EQU 99H
TXSTA EQU 98H
RCSTA EQU 18H
RCREG EQU 1AH
CREN EQU 04H
TXREG EQU 19H
INDF EQU 04H
STATUS EQU 03H
TXEN EQU 05H
INTCON EQU 0BH
RBIF EQU 00H
ORG 00H
NOP
GOTO MAIN
ORG 020H
MAIN
BSF STATUS,RP0
MOVLW 80H ;C口初始化,7为输出,6为输入
MOVWF TRISC
MOVLW 00H ;D口为输出口
MOVWF TRISD
MOVLW 26H ;波特率为9600,6兆赫
MOVWF SPBRG
MOVLW 24H ;异步方式,高波特率,发送使能
MOVWF TXSTA
BCF STATUS,RP0
CLRF PORTD
MOVLW 90H
MOVWF RCSTA ;设置连续接受数据
BSF STATUS,5
BSF TRISC,7
BCF TRISC,6
BSF PIE1,RCIE ;使能SCI接收中断
JIESHOU
BSF STATUS,5
BTFSS PIR1,RCIF ;查接收中断
GOTO JIESHOU
BCF STATUS,5
MOVF RCREG,0
BCF STATUS,5
MOVLW 90H
MOVWF RCSTA
MOVLW 0C8H ;使能总中断,和RB中断
MOVWF INTCON
CALL DELAY1S ;延时
CALL DELAY1S
FSOUT1 MOVLW 5AH ;翻页程序
CALL FSOUT
MOVLW 0A5H
CALL FSOUT
MOVLW 04H
CALL FSOUT
MOVLW 80H
CALL FSOUT
MOVLW 03H
CALL FSOUT
MOVLW 00H
CALL FSOUT
MOVLW 01H
CALL FSOUT
CALL DELAY1S
CALL DELAY1S
NOP
NOP
NOP
MOVLW 5AH ;翻页程序
CALL FSOUT
MOVLW 0A5H
CALL FSOUT
MOVLW 04H
CALL FSOUT
MOVLW 80H
CALL FSOUT
MOVLW 03H
CALL FSOUT
MOVLW 00H
CALL FSOUT
MOVLW 02H
CALL FSOUT
CALL DELAY1S
CALL DELAY1S
NOP
NOP
NOP
MOVLW 5AH ;翻页程序
CALL FSOUT
MOVLW 0A5H
CALL FSOUT
MOVLW 04H
CALL FSOUT
MOVLW 80H
CALL FSOUT
MOVLW 03H
CALL FSOUT
MOVLW 00H
CALL FSOUT
MOVLW 03H
CALL FSOUT
CALL DELAY1S
CALL DELAY1S
NOP
NOP
NOP
MOVLW 5AH ;翻页程序
CALL FSOUT
MOVLW 0A5H
CALL FSOUT
MOVLW 04H
CALL FSOUT
MOVLW 80H
CALL FSOUT
MOVLW 03H
CALL FSOUT
MOVLW 00H
CALL FSOUT
MOVLW 04H
CALL FSOUT
CALL DELAY1S
CALL DELAY1S
NOP
NOP
NOP
MOVLW 5AH ;送数程序
CALL FSOUT
MOVLW 0A5H
CALL FSOUT
MOVLW 05H
CALL FSOUT
MOVLW 82H
CALL FSOUT
MOVLW 50H
CALL FSOUT
MOVLW 00H
CALL FSOUT
MOVLW 00H
CALL FSOUT
MOVLW 01H
CALL FSOUT
MOVLW 01H
CALL FSOUT
MOVLW 01H
CALL FSOUT
CALL DELAY1S
CALL DELAY1S
NOP
NOP
GOTO EEND2
WAIT NOP
GOTO WAIT
FSOUT MOVWF TXREG ;读入数据
BSF STATUS,RP0 ;选RAM体1
LPTX BTFSS TXSTA,TRMT ;发送寄存器空吗?
GOTO LPTX ;否,等待
BCF STATUS,RP0 ;是,返回,选RAM体0
RETURN
DELAY1S MOVLW 06H
MOVWF 59H
DELAY10 MOVLW 0EBH
MOVWF 60H
LOP MOVLW 0EAH
MOVWF 61H
LOP1 DECFSZ 61H,1
GOTO LOP1
DECFSZ 60H,1
GOTO LOP
DECFSZ 59H,1
GOTO DELAY10
RETURN
EEND2 NOP
NOP
GOTO EEND2
END
这是PIC16F877A单片机翻页程序和输送数据程序,下到单片机集成电路后,工作不正常,有以下几个现象,1、开机时程序只工作一次,单片机再复位也不工作断电后再开机也不工作;2、有时开机只翻一页,再不工作3、开机,程序就不运行工作,等。这个程序我在MPLAB 中单步,连续运行都正常,在PROTEUS 仿真运行正常,下载到集成电路中,就出现以上现象,查不出原因,请帮助检查下存在问题没?仿真没发现问题,已带触摸屏就出以上问题了,不过偶尔也会正常一两次。
一直解决不了,这个项目赶着交啊,悲哀啊,本人水平较低,求大神帮我啊,拜谢了!
这是PIC16F877A单片机翻页程序和输送数据程序,下到单片机集成电路后,工作不正常,有以下几个现象,1、开机时程序只工作一次,单片机再复位也不工作断电后再开机也不工作;2、有时开机只翻一页,再不工作3、开机,程序就不运行工作,等。这个程序我在MPLAB 中单步,连续运行都正常,在PROTEUS 仿真运行正常,下载到集成电路中,就出现以上现象,查不出原因,请帮助检查下存在问题没?仿真没发现问题,已带触摸屏就出以上问题了,不过偶尔也会正常一两次。
一直解决不了,这个项目赶着交啊,悲哀啊,本人水平较低,求大神帮我啊,拜谢了!
此帖出自
小平头技术问答
一周热门 更多>