• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Two USART links

Status
Not open for further replies.

avi

New Member
I need your advice,
I want to connect two different bluetooth transmitters to one PIC18F452.
The Trans. is connected to the PIC by the USART.
Since there is only one USART port in the PIC, How can I connet the two transmitters simultaneously (every Tx transmits different data)??
 

Sceadwian

Banned
Google it, you should easily find software UARTs code in C for PIC's, mind you they're typically sensative to the clock speed of the PIC you're running, a lot moreso than hardware because it's done all in software using interupts. Depending on how much data you're transmitting between the two devices you may run out of processing speed fast enough to handle both the hardware and software uarts at the same time though and you'll start getting corrupted data.
 

Nigel Goodwin

Super Moderator
Most Helpful Member
Google it, you should easily find software UARTs code in C for PIC's, mind you they're typically sensative to the clock speed of the PIC you're running, a lot moreso than hardware because it's done all in software using interupts.
Sorry, but again you're completely wrong - there's no specific need to use interrupts for a software UART - and most don't do it, I've certainly never found any requirement to.

Even assuming you did use interrupts, it would be a trivial task for a PIC to run interrupt driven software and hardware UART's at the same time.

Depending on how much data you're transmitting between the two devices you may run out of processing speed fast enough to handle both the hardware and software uarts at the same time though and you'll start getting corrupted data.
No problems whatsoever, PIC's are far faster than that - however, if you read the original post, you will see he only wants to TRANSMIT data, which you could easily and simply do using multiple software UART's for as many channels as you wanted.
 

edeca

Active Member
Does somebody have "Software USART" code in C?
What C compiler do you use? Microchip have examples for C18 in their reference guide that explain how to use both hardware and software USART.
 

avi

New Member
I use the "HI-TECH universal ToolSuite"

-------------------------
What C compiler do you use? Microchip have examples for C18 in their reference guide that explain how to use both hardware and software USART.
 

Sceadwian

Banned
Nigel I'm not wrong just backwards close enough to wrong though, I was thinking of receiving. For reception at some point an interrupt is going to cause an ISR during the software UART's delay routine and desync it.
 

Nigel Goodwin

Super Moderator
Most Helpful Member
Nigel I'm not wrong just backwards close enough to wrong though, I was thinking of receiving. For reception at some point an interrupt is going to cause an ISR during the software UART's delay routine and desync it.
No, because that's why you keep ISR's short and fast, so it's not long enough to cause problems for any normal sort of baud rates - you're probably going to get problems trying to run a software UART at 115Kb, but at the more normal 9600 baud it's not a problem at all. Also, choosing which you use for TX and which for RX makes a difference, depending exactly what you're doing - even at 115Kb.

But TX, as this thread is about, is no problem at all.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top