hello,
With Hardware UART , you have an internal buffer of 1 car...
with sof tuart you don't have...
are you using interrupt on otherfunction (like Timer )?
soft uart need 100% of CPU.
"1 car" you mean I have a lot of space?
If so, you maybe able to utilize an analog multiplexer to switch the connection from XBee to the other device on a periodic and scheduled basis.
Have you worked with any reliable multiplexer you can suggest me ?
Most semiconductor manufacturers offer several versions of analog multiplexer devices suitable for UART multiplexing, TI CD405x series and MAXIM MAX399 often come to mind.
CMOS Triple 2-Channel Analog Multiplexer/Demultiplexer with Logic-Level Conversion
You should be able to find examples of the TI CD4053B used as a UART multiplexor with a Google search.
Although, I typically avoid the use of multiplexors for switching UART lines and opt instead for a microcontroller with more UARTs.
BigDog
Because I am confused of how are written here in microchip's datasheet, does this
https://www.microchip.com/wwwproducts/Devices.aspx?product=PIC18F4455
has 2 UARTS? It says 1-A/E/USART.
The Enhanced Universal Synchronous Asynchronous
Receiver Transmitter (EUSART) module is one of the
two serial I/O modules. (Generically, the USART is also
known as a Serial Communications Interface or SCI.)
The EUSART can be configured as a full-duplex
asynchronous system that can communicate with
peripheral devices, such as CRT terminals and
personal computers. It can also be configured as a half-
duplex synchronous system that can communicate
with peripheral devices, such as A/D or D/A integrated
circuits, serial EEPROMs, etc.
The Enhanced USART module implements additional
features, including automatic baud rate detection and
calibration, automatic wake-up on Sync Break recep-
tion and 12-bit Break character transmit. These make it
ideally suited for use in Local Interconnect Network bus
(LIN bus) systems.
The EUSART can be configured in the following
modes:
• Asynchronous (full duplex) with:
- Auto-wake-up on character reception
- Auto-baud calibration
- 12-bit Break character transmission
• Synchronous – Master (half duplex) with
selectable clock polarity
• Synchronous – Slave (half duplex) with selectable
clock polarity
No, the nomenclature, 1-A/E/USART, indicates a single peripheral module which has Advanced Enhanced Synchronous capabilities, which microchip refers to as EUSART, in other words it supports synchronous protocols, as well as, asynchronous protocols.
Reference: PIC18F2X1X/4X1X Datasheet, Section: 17.0 ENHANCED UNIVERSAL SYNCHRONOUS RECEIVER TRANSMITTER (EUSART), Page: 193
By the way, TI offers numerous multiplexor switching devices, the CD405x series is an old standby, there are several other devices which they offer that could suffice in switching UART lines.
BigDog
1-UART, 1-A/E/USART,
Most semiconductor manufacturers offer several versions of analog multiplexer devices suitable for UART multiplexing, TI CD405x series and MAXIM MAX399 often come to mind.
CMOS Triple 2-Channel Analog Multiplexer/Demultiplexer with Logic-Level Conversion
You should be able to find examples of the TI CD4053B used as a UART multiplexor with a Google search.
Although, I typically avoid the use of multiplexors for switching UART lines and opt instead for a microcontroller with more UARTs.
BigDog
So, If I need the HardwareUART to work on 38400bps and the Software on 4800 bps with 16 MHz is it achievable??
hello,
Maybe it is possible ;if your flow of data is not contineous ( some gap of time beween stream)
is your RB0 pin available ?
in this case you can use RB0as RX pin ; and RB0 interrupt to detect incoming of data and treat the data on the way (bit bang UART)
and your main program is not allways busy for that..
4800 bauds -> 480 car /sec .. interrupt every 2mS
How many car /sec do you need .. gives the remaining time for oiher task ...
Do you know any cheap circuit to get -5 Volt supply for MAX399?
Did you consider a newer PIC18 with two UARTs like 18F45K22?
Hello, I have the below connection:
A PIC is connected to a Xbee through UART. And my Laptop is connected to another Xbee.
When I use Hardware UART on the PIC (16 MHz,38400bps), the messages are sent correctly to the Laptop.
However, when I use use Software UART on the PIC (16 MHz,38400bps), the messages are NOT sent correctly, I get strange characters.
I use the PIC18F452.
What is wrong?
void sendbyte(byte dat)
{
int i;
output_low(pin_d0);
delay_us(18);
for(i=0;i<8;i++)
{
if(bit_test(dat,i))
output_high(pin_d0);
else
output_low(pin_d0);
delay_us(18);
}
output_high(pin_d0);
}
delay_ms(100);
sendbyte(0Xaa);
delay_ms(100);
sendbyte(0X55);
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?