; Parameters: byte to send, in the W register *
; RAM Usage: 0 *
; ROM Usage: *
; Description: Sends the contents of the W register out *
; the TX_PIN. *
;*****************************************************************
;
putcUART
movwf XmtReg
IF Nbit
movlw 8
ELSE
movlw 7
ENDIF
movwf Count
;
IF MODE
ELSE
IF Nbit
ELSE
rlf XmtReg,f
ENDIF
ENDIF
;
bcf UARTPORT, TXPIN ; Send Start Bit
Delay1 ; 52 uS (19200 baud)
X_next bcf STATUS,C
;
IF MODE
rrf XmtReg,f ; Conditional Assembly
ELSE ; to set if MSB first or LSB first
rlf XmtReg,f
ENDIF
;
btfsc STATUS,C
bsf UARTPORT,TXPIN
btfss STATUS,C
bcf UARTPORT, TXPIN
DelayX
decfsz Count,f
goto X_next
bsf UARTPORT, TXPIN ; Send Stop Bit
Delay1
;
IF STOPBITS
bsf UARTPORT,TXPIN
Delay1
ENDIF
;
retlw 0x01 ; return to calling program
end
上一页 [1] [2] [3] [4] [5]
本文关键字:暂无联系方式PIC单片机,单片机-工控设备 - PIC单片机