please dont rip this site

RS232 routine for 14-bit PIC cores. TX only, fixed 115200 bps, 3.6864MHz XTAL, no parity.

Note : Tested only in a PIC6F628A. Free for personal use. If you use
it, please mention my name, or at least where you found this.

;C. Blondin (Fenugrec), 16/12/2006
;sends the byte in W through RB6,
;but it should work with any pin & any port
;(you can change the relevant bitmasks)
;uses a shadow reg, assumes no interrupts during execution.
;also needs two GPRs : count and TXbyte.
;STATUS is modified.

;1 bit @ 115200bps gives 8.68 us / bit;
;1 TCy @ 3.6864 MHz gives 1.085 us;
;total of 8 instructions / bit for the sending

    movwf   TXbyte
    bcf     STATUS,C    ;prepare startbit
    movlw   09          ;startbit + 8 bits
    movwf   count
    movf    sPORTB,W
    andlw   b'10111111' ;RB6 = 0    ;1
    btfsc   STATUS,C                ;1
    iorlw   b'01000000' ;else 1     ;1
    movwf   PORTB                   ;1	X
    rrf	    TXbyte,F    ;LSb first  ;1
    decfsz  count,F                 ;1
    goto    _TX_shiftloop           ;2

    iorlw   b'01000000'             ;1
    movwf   sPORTB                  ;1
    goto    $+1  ;lastbit = 8TCy    ;2
    movwf   PORTB    ;set RB6 high  ;1  _/

file: /Techref/member/csblondin-sympatico-/Ser-rout.htm, 1KB, , updated: 2006/12/30 15:13, local time: 2024/5/30 01:52, owner: csblondin-sympatico-,

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF=""> RS232 routine for 14-bit PIC cores. TX only, fixed 115200 bps, 3.6864MHz XTAL, no parity.</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?