Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Software UARTs in PIC18F452

Status
Not open for further replies.

adwnis123

Full Member level 4
Joined
Jun 19, 2014
Messages
214
Helped
0
Reputation
0
Reaction score
1
Trophy points
18
Activity points
1,737
How many software UARTs can I use in a PIC microcontroller??
 

As many as there are pins available but the more you use the slower they will all become. Most software UARTS in compiler libraries are blocking, meaning that once a serial byte has started to arrive, the routine waits until the last bit has been received before continuing the program again. This obviously makes it difficult to use more than one at a time but by carefully coding your own UART routines it is possible to use many in parallel.

Brian.
 
As many as there are pins available but the more you use the slower they will all become. Most software UARTS in compiler libraries are blocking, meaning that once a serial byte has started to arrive, the routine waits until the last bit has been received before continuing the program again. This obviously makes it difficult to use more than one at a time but by carefully coding your own UART routines it is possible to use many in parallel.

Brian.

By meaning carefully on C code ? Or assembly?
 

I think it's not a problem of assembler versus C code. The problem is about mastering low-level PIC programming, particularly interrupts and timers. It can be achieved in C, a few lines of inline assembler can be helpful.
 

I think it's not a problem of assembler versus C code. The problem is about mastering low-level PIC programming, particularly interrupts and timers. It can be achieved in C, a few lines of inline assembler can be helpful.

So, if I want to use 2 software Uarts of mikroelektronika's library, they will work??
 

So, if I want to use 2 software Uarts of mikroelektronika's library, they will work??
Yes, I think they will work but you must always re-init the mikroC Software UART library routines via the proper Soft_UART_Init, before using the other sw uart.
But ... I'm not sure that the Soft_UART_Break is also working in both case. Try it.


Or ... use the Multi-SwUart library (written by me, link: see my post above). Its disadvantage: only one baudrate, same for all. Advantage: much smaller code.
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top