In my case, I'll have to read the resultant SPBRG and use that to calculate the value for my DEBUGOUT command as well.
I have a large network of connected devices. The Master (18F8723) polls the SLAVES (a bunch of 18F2221's). It sends out an 'Attention' byte, followed by the Slave's address, followed by a command and finally, a checksum.
The Slave uses the Receive part of it's EUSART so I can easily use interrupts
to grab the data. But when answering, the slave must 'speak' open-collector to avoid bus contention. I don't have room for an O.C. gate on the slave, so I can't use the Transmit part of the '2221's EUSART.
So, I use a different pin (not PORTC.6) to do the send. I use DEBUGOUT in order to get 19.2Kbaud with a 4MHz oscillator. And before you ask....
I modified PBPPIC18LIB to add a switch to DEBUGOUT that allows it to run in an open-collector mode.
It all works like a charm.




Bookmarks