View previous topic :: View next topic |
Author |
Message |
alan
Joined: 12 Nov 2012 Posts: 358 Location: South Africa
|
|
Posted: Fri Mar 18, 2022 3:33 am |
|
|
From the datasheet
Quote: | Asynchronous Address Mode
A special Address Detection mode is available for use when multiple receivers share the same transmission line, as
seen in RS-485 systems.
When Asynchronous Address mode is enabled, all data is transmitted and received as 9-bit characters. The 9th bit
determines whether the character is address or data. When the 9th bit is set, the eight Least Significant bits are
the address. When the 9th bit is clear, the Least Significant bits are data. In either case, the 9th bit is stored in
PERIF when the byte is written to the receive FIFO. When PERIE is also set, the RXIF will be suppressed, thereby
suspending DMA transfers allowing software to process the received address.
An address character will enable all receivers that match the address and disable all other receivers. Once a receiver
is enabled, all non-address characters will be received until an address character that does not match is received. |
Also
Quote: | Addresses are sent by writing to the UxP1L register. This transmits the written byte with the 9th bit set, which
indicates that the byte is an address. |
So this chip fully support 9-bit mode. |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9377 Location: Greensville,Ontario
|
|
Posted: Fri Mar 18, 2022 5:25 am |
|
|
There are 2 different 9 bit 'modes', at least for old guys like me.
The first, that this PIC does support, is where the 9th bit is used as a 'flag' to show whether the 8 data bits are to be used as an address or as data. Motorola sold the MC14469 Addressable UART, decades ago. A 40 pin device that PICs now mimic.AN806 is worth reading BTW.
The second mode, is a true 9 bit DATA mode, where the serial stream consists of a start bit, NINE data bits, optional parity bit and the stop bit. Historically discrete UARTs could be configured for 5,6,7 or 8 data bits as well as 1, 1.5 or 2 stop bits, as well as even,odd,or no parity. If you had a bipolar(+-) 8 bit ADC, having a 9 bit UART meant you could send the ADC value in a single transmission where 8 bits were the result and the 9th bit the sign (+ or -). |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19655
|
|
Posted: Fri Mar 18, 2022 10:05 am |
|
|
Spot on Jay.
The point is this chip _does not_ support 9 bit data. It only supports the
address mode.
If you want 9bit data mode, this chip won't do it. |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9377 Location: Greensville,Ontario
|
|
Posted: Sat Mar 19, 2022 5:38 am |
|
|
One possible, maybe, option is to use a software UART.
I've done that for decades with my 22 bit serial interface needs.....
It all depends on what is on the 'other end' of the serial link..... |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19655
|
|
Posted: Sun Mar 20, 2022 10:37 am |
|
|
With a bit of 'sneakiness', this could be a good solution.
Use a software UART for TX, and a hardware one for RX. Enable 8 bits
with parity on this.
Then simply read the 8bits plus the UART parity bit to build the 9bits. |
|
![](templates/subSilver/images/spacer.gif) |
alan
Joined: 12 Nov 2012 Posts: 358 Location: South Africa
|
|
Posted: Tue Jun 28, 2022 1:24 pm |
|
|
Just an update on this old post.
The UART1 on this PIC does support full 9 bit operation, but you have to set it up manually as the #use RS232 option does not yet support it and you have to set it up manually.
The U1ERR contains a bit stating that an address have been received and thus reading the RX register contents should be treated as that an address has been received.
To send an address you put the byte in U1P1 and it get send with the 9th bit set.
Regards |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19655
|
|
Posted: Tue Jun 28, 2022 10:29 pm |
|
|
Except that isn't a standard 9bit mode.
The point is it only handles '9bit' as an address.
So as I said earlier, you can do this, but as you describe, you are having to
cheat, detect and handle the address flag to get 9bit operation.
Not standard 9bit data operation. |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9377 Location: Greensville,Ontario
|
|
Posted: Wed Jun 29, 2022 5:20 am |
|
|
Curious, I'm wondering who actually has peripherals that have NINE data bits ? It seems odd (no pun), that anything would have 9 bits. PICs ADC can be 8 or 10, uses 2 bytes, no big deal. I used 16bit ADCs in the past, never anything with odd number of bits...well, OK, Teletypes did ...7 bit BUT back then NO PICs, heck NO UARTS ! A board full of 7400 series chips WAS the UART.
I do have some Motorola Addressable UARTS here (145469 ?), they are 8 bit data.
Still, be nice to know what's on the 'other end' of the wire.
Jay |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19655
|
|
Posted: Wed Jun 29, 2022 8:09 am |
|
|
The commonest use for 9bits, _is_ for addressing. This is why this particular
PIC offers it like this. So you have a byte with the 9th bit set as an
'indicator' that this is an address byte. |
|
![](templates/subSilver/images/spacer.gif) |
|