Re: Bit-banging: is it the 'only' way?
This is from the 14 bit core library . . .
Code:
;****************************************************************
;* Default hardware serial port values *
;****************************************************************
ifndef HSER_BITS
HSER_BITS = 8 ; Default to 8 bits
endif
ifndef HSER_RCSTA ; Receive register data
if (HSER_BITS != 9)
HSER_RCSTA EQU 90h ; Receiver enabled
else
HSER_RCSTA EQU 0d0h ; Receiver enabled for 9 bits
endif
endif
ifndef HSER_TXSTA ; Transmit register data
if (HSER_BITS != 9)
HSER_TXSTA EQU 20h ; Transmitter enabled
else
HSER_TXSTA EQU 60h ; Transmitter enabled for 9 bits
endif
endif
ifndef HSER_BAUD ; Baud rate
HSER_BAUD EQU 2400
endif
ifndef HSER_SPBRG ; Baud rate generator register data
if (OSC == 3)
if (((HSER_TXSTA) & 04h) == 0)
HSER_SPBRG = (((3579545 / (HSER_BAUD)) + 32) / 64) - 1 ; For BRGH = 0
else
HSER_SPBRG = (((3579545 / (HSER_BAUD)) + 8) / 16) - 1 ; For BRGH = 1
endif
else
if (((HSER_TXSTA) & 04h) == 0)
HSER_SPBRG = ((((1000000 * (OSC)) / (HSER_BAUD)) + 32) / 64) - 1 ; For BRGH = 0
else
HSER_SPBRG = ((((1000000 * (OSC)) / (HSER_BAUD)) + 8) / 16) - 1 ; For BRGH = 1
endif
endif
endif
ifdef HSER_EVEN
HSERPARITY_USED = 1 ; Parity used if even
endif
ifdef HSER_ODD
HSERPARITY_USED = 1 ; Parity used if odd
endif
;****************************************************************
You might modify to achieve what you want, save an unaltered copy or make up an include file.
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Bookmarks