Thanks, I did it also like that. But it looks like a small buggiein the compiler!
Regards.
M
Thanks, I did it also like that. But it looks like a small buggiein the compiler!
Regards.
M
Hi Mat,
To set the USART to 9-bit mode, use ...
DEFINE HSER_BITS 9
RCSTA will automatically be set to 0D0h
TXSTA will also be set to 60h
HTH,
DT
i don't know why but my attention was mostely on 'above A0' than on the real purpose ... i just saw that D0.
Too bad, there's some missing conditions in the Macro
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
I think it would also work with a 0 before the D0h in DEFINE HSER_RCSTA.
Don't think there's anything missing. Sometimes it helps to look at the Defaults in the PBPPIC14.lib file.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
DT
Yeah right... but why the extra 0 before D0? that's another story
And since the 9 bit mode is probably not a common/popular use.... Anyways there's always many different solution such as set the register directly
Last edited by mister_e; - 26th September 2006 at 17:03.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
If anything starts with a Letter, the assembler considers it to be either a Label, Variable name, or Text replacement value.but why the extra 0 before D0?
For it to know that it's a number, it has to start with a digit between 0-9. This is why Variables and Labels can't start with a number.
So any HEX numbers with A-F in the first digit must be preceeded by a 0.
In PBP, HEX numbers start with a $, so it can tell it's a number without the 0.
<br>
DT
Thanks all of you. I think I will take the DEFINE HSER_BITS 9 Than I will not forget after a few month what I did there. And why a 0 before, I dont't know, but if they want that, I will do that.
Thanks Darrel, now I know. We were here at the same time.
Last edited by mat janssen; - 26th September 2006 at 17:27.
Thanks Darrel, it make sense now.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks