利用串口調(diào)試精靈或PC端的超級終端調(diào)試串口的代碼
MAIN
BANKSEL TXSTA
MOVLW B'00100100'
MOVWF TXSTA
MOVLW .25
MOVWF SPBRG
CLRF PIE1
BSF PIE1,RCIE
CLRF STATUS
CLRF TXCOUNT
CLRF GETPTR
CLRF PUTPTR
MOVLW B'10010000'
MOVWF RCSTA
CLRF INTCON
BSF INTCON,PEIE
BSF INTCON,GIE
LOOP
CALL CHECK_DATA
GOTO LOOP
;-------------------------
CHECK_DATA
CLRF STATUS
MOVF TXCOUNT,W
SKPZ
RETURN
MOVF GETPTR,W
XORWF PUTPTR,W
SKPNZ
RETURN
MOVLW RXBUFF
MOVWF FSR
MOVF GETPTR,W
ADDWF FSR,F
INCF GETPTR,F
MOVLW .7
ANDWF GETPTR,F
MOVF INDF,W
MOVWF TXBUFF+0
MOVLW 'P'
MOVWF TXBUFF+1
MOVLW 'I'
MOVWF TXBUFF+2
MOVLW 'C'
MOVWF TXBUFF+3
MOVLW 'A'
MOVWF TXBUFF+4
MOVLW 'V'
MOVWF TXBUFF+5
MOVLW 'R'
MOVWF TXBUFF+6
MOVLW 0X0D
MOVWF TXBUFF+7
MOVLW 0X0A
MOVWF TXBUFF+8
MOVLW .9
MOVWF TXCOUNT
CLRF TXPTR
BSF STATUS,RP0
BSF PIE1,TXIE
BCF STATUS,RP0
RETURN
;---------------------
END本文引用地址:http://butianyuan.cn/article/172056.htm
評論