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.

8051 and 2 serial ports

Status
Not open for further replies.

DrWhoF

Advanced Member level 1
Joined
May 6, 2005
Messages
402
Helped
24
Reputation
48
Reaction score
11
Trophy points
1,298
Activity points
4,388
I need to connect 2 RS-232 devices to 87C52. This mcu has only one UART. How can I do it?
Thanks
DrWho
 

That depends on volume of data that will come/go from/to both RS-232 devices.
One option will be to connect the more important device to hardware UART (with serial port interrupt ON) and the other device to software UART (see Philips application notes for software UART, with INT0/1 ON).
You can also consider sharing the hardware UART (4 NAND gates + 1 mcu pin per RX or Tx) but this option will require some kind of synchronization.
Regards,
IanP
 

    DrWhoF

    Points: 2
    Helpful Answer Positive Rating
You can implement a software UART via bit-banging. Essentially, you use timer interrupts to synchronize data transfer to IO pins. A simple google search gave **broken link removed**.
 

    DrWhoF

    Points: 2
    Helpful Answer Positive Rating
1. periodic timer interrupt at a rate 4-32x higher than the baudrate.
+ fullduplex, even multichannel could be possible
+ does not require dedicated pin
+ under certain conditions can run from the same timer1 as the HW UART
- permanently occupies significant % of processor time

http://www.atmel.com/dyn/resources/prod_documents/doc3ab877f2ec329.pdf
**broken link removed**

2. receiver triggered by an edge-triggered external interrupt (special: a counter set to roll over on the first edge); then sampled using timer timed at baudrate.
Transmitter simply using timer at baudrate.
+ low software overhead
- dedicated (extint) pin needed for Rx
- fullduplex requires 2 timers

An implementation using PCA found in some 8051 derivatives:
http://www.intel.com/design/mcs51/applnots/270531.htm

3. only receiver or only transmitter by performing the sampling in a loop in main program
+ simple
- only 1 direction
- uses up 100% of processor time
- virtually excludes using other interrupts simultaneously


wek
 

try W77e58 or uPSD from ST
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top