How to Create UART with Software (not used SBUF) on 8051

Status
Not open for further replies.

winit_a

Junior Member level 1
Joined
Nov 16, 2003
Messages
16
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
142
uart xoff implementation

How to Create UART With Software?
My project Used 3 UART (normal have 1 UART with HARDWARE P3.0 and P3.1)

8051 MCU @ 11.0592MHz
How to Create UART used P2 or P1 to Interface RS-232
 

timers t232

Hi,
My opinion: it is damn hard. You will have to do it using interrupts, but 8051 is a relatively slow controller, its performance stays under 1mips at 11,0592mhz clock for clasic 8051 versions (1instruction cycle=12 clock cycle). More than one serial port implemented in software will eat almost all processor time, especially if you want to go up to 115200bps with those ports, or if you want to implement all possible parameters (6/7/8 data bits selecteble, 1/2 stop bits, parity odd/even/mark/space/none, flow control selectable xon-xoff/hard/none). My sugestion is to use an modified architecture 8051 from cypress, or to use a scenix microcontroller ( www.ubicom.com ). For scenix controller I can provide code for 8 uarts simultaneously. This if you want a software implementation. If yau want hardware, you can use max3100 (maxim).

Best,
 

8051 uart even 7 1

You could create one UART (in addition to using the SBUF) by using a dedicated timer and writing very fast code to rotate bit. On the incoming side (RXD), you must use an interrupt pin. When the interrupt comes, start your timers and read the pin status into carry, rotate and create your incoming bytes. Works well upto 9600 Baud (I have used it).

However, creating two MORE at the same time? Forget it. Even if you use two dedicated timers, the interrupt routines become so big that you will miss bits.

If you are looking for slow UARTs (1200 Baud or slower), then this technique works for upto 2 UART's. Keep in mind that you will give up all the three timers (one used for baud rate gen for SBUF, one for port 1 and one for port 2 timing) as well as both the interrupts.

So, better design is to use an ARM chip with two UART's (I have created 2 additional UARTs at 19200 Baud with an ARM) or use the Rabbit controller or some such thing.

Ajay
 

microcontroller sbuf

Hi,

have a look to the attached file from Philips web AN.

**broken link removed**

bye
 

uart implementation 8051 asm

It's very difficult.
Suggest using hardware.
 

uart implementation in 8051

Hi
i have some idea UART but send data only by using timer 0
bit T232 as TxD
MOV TMOD,#22H
MOV TH0,#70H
MOV TL0,#70H
SETB EA
SETB ET0
SETB TR1
;
;
;
;
function send data:
CLR T232 ;START BIT
SETB TR0
MOV R7,#8

TX_LOOP: RRC A
JNB TF0,$
MOV T232,C
CLR TF0
DJNZ R7,TX_LOOP
JNB TF0,$
SETB T232 ;STOP BIT
CLR TF0
JNB TF0,$
RET
it maybe help u
BR.
 

80c51 software uart

try that

[hr:5c6e3c7296]
Fire in the Wire :sm2:
 

xon xoff 8051


This is only good for transmitting. Problem comes when you try to receive as well. First of all, this method will NEVER work for full duplex operation unless you use two DIFFERENT timers.

Moreover, for receiving, you will need to use a hardware interrupt which will precisely start the timer at the right time and then will help shift the data. Again, this method is only good as a half duplex communication.

Another complexity comes from the fact that the interrupt routines become long and will cause problems by missing bits. Keep in mind that the error will accumulate over a period of time!

The best way is to use a chip which has more serial ports (ARM, uPSD from ST etc.)

Ajay
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…