;TX_115k2
;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
;loop.
TX_115k2
movwf TXbyte
bcf STATUS,C ;prepare startbit
movlw 09 ;startbit + 8 bits
movwf count
movf sPORTB,W
_TX_shiftloop
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 _/
return
file: /Techref/member/csblondin-sympatico-/Ser-rout.htm, 1KB, , updated: 2006/12/30 14:13, local time: 2024/12/27 07:45,
owner: csblondin-sympatico-,
3.145.105.85:LOG IN
|
©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? <A HREF="http://sxlist.com/techref/member/csblondin-sympatico-/Ser-rout.htm"> RS232 routine for 14-bit PIC cores. TX only, fixed 115200 bps, 3.6864MHz XTAL, no parity.</A> |
Did you find what you needed? |