完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
高手,最近我编了如下:
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 仿真运行正常,下载到集成电路中,就出现以上现象,查不出原因,请高手帮助查查是编程的问题不?这个项目急着交,可这个问题我始终解决不了,拜托大神了!!! |
|
相关推荐
2 个讨论
|
|
液晶屏是北京迪文的10寸触摸屏,硬件我检查了未发现问题,另外偶尔有翻页成功的。
|
|
|
|
|
|
求助高手指点啊!!!
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-23 05:05 , Processed in 0.676428 second(s), Total 71, Slave 53 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号