您当前的位置:五五电子网电子知识单片机-工控设备PIC单片机16C5X模拟串口 正文
16C5X模拟串口

16C5X模拟串口

点击数:7664 次   录入时间:03-04 11:50:53   整理:http://www.55dianzi.com   PIC单片机
;    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单片机