Hi guys, Here is the situation I've 89c51 microcontroller board which I want to connect with PC as well as GSM but as everybody knows it(8051) has only one UART so one solution is try using 87xx or 83xx series of controller but that means I'll have to change my programmer. So what I'm thinking is I'll use simple mux/demux for Tx/Rx of 8051. I want to know will it be o.k.? Can simple AND or OR gates can handle data rate of 9600bps?
Thank you very much in advance.
checkout this site-- www.atmel.com/.../doc3aae2f186a94b.pdf this is a software UART program.
There are other code sets for software UARTs on the WEB, one at--- www.silabs.com/.../mcu_applications_appnotes.htm
Look for AN115 and the software source code AN115SW
If your system can spare the overhead, a software UART might just be what you need.
while "soft UARTs" indeed are possible, they are true 'killers' if a reasonable baudrate is desired.
They WILL tie up your uC in ways that, most likely, will cause timing problems elsewhere.
Of course, if your project is a banale calculator, such may not be a problem but since the '51 is a microcontroller the likelyhood is you are controlling something and a "soft UART" can (most likely will) be disastrous.
Erik
Hey I did it successfully I can actually multiplex that UART of 89c51 through hardware just have to keep in mind that it needs some delay after select line has changed its state. I read 89c51re2 surely will consider it Thanks a lot for all your contribution. Will come back and let you know if something goes wrong
Well if you need to use 2 UART not working simultaneously and can tolerate some delay between switching then u can consider it
Well guys the assembly I've designed was working fine till I tried to receive the data through it i.e. My board(at89c51) is still able to transmit data to 2 devices alternatively however when I multiplexed the transmit lines of 2 devices to connect to receive line of (at89c51) , it doesn't work. please provide your suggestions anyway will update if I find some solution
"when I multiplexed the transmit lines of 2 devices to connect to receive line of (at89c51) , it doesn't work"
So you've done it wrong!
With no details of exactly what you have done, or exactly how it "doesn't work", it is obviously impossible to say exactly where it's wrong!
One thing: how do you ensure that you don't switch the multiplexer in the middle of a character?
My 2 PCs (which are connected to my microcontroller) don't communicate simultaneously so I've ORed their transmit pin to connect to receive of microcontroller
After the RS232 receivers, of course...?!
We have a similar situation and have implemented an analog switch to switch between the two ports rather cheap way to solve it but with a small possibility of missing data if not coded right :)
ya after MAX232 i.e. when signals are TTL level I guess my switching occurs properly but serial initialization routine can't be activated properly have a look
#define R 1 #define G 0 . . . Long_Delay(200); Select_Serial = R; LongDelay(); Init_Serial(); Xmit_Static_Char('R'); P0 = 0x01; LongDelay(); Select_Serial = G; LongDelay(); Init_Serial(); Xmit_Static_Char('G'); P0 = 0x02; LongDelay(); Select_Serial = R; Init_Serial(); Xmit_Static_Char('R'); P0 = 0x01; LongDelay(); Select_Serial = G; LongDelay(); Init_Serial(); Xmit_Static_Char('G'); P0 = 0x02;
Here I can see R(1st terminal) G(2nd terminal) and R(1st) but that also sometimes then nothing but P0 shows LED status correctly as 0x01,0x02,0x01,0x02 etc.
That would be good option but my problem is I want switching to be handled by uC according to command comes to it Anyway Thanks for sharing your opinion
It's fairly pointless posting code with all the important bits missing!
What does Select_Serial do? What does Init_Serial() do? What does Xmit_Static_Char() do?
Where is serial reception handled?
Select_Serial is pin 3.2 to select which serial line to select (uC to terminal1 or uC to terminal2) Serial_Init initialize serial port i.e. TMOD 20h,SCON 50h etc. Xmit_Static_Char transmit a character. and reception is handled on hyperterminal on pc
"Select_Serial is pin 3.2 to select which serial line to select (uC to terminal1 or uC to terminal2)"
Does it work? Have you tested that the hardware does actually correctly route the signals?
"Serial_Init initialize serial port i.e. TMOD 20h,SCON 50h etc."
Again, does it work? Have you tested that the hardware is actually correctly configured to the correct baud rate, etc?
"Xmit_Static_Char transmit a character."
Yet Again, does it work? Have you tested that that it actually transmits the correct character?
"reception is handled on hyperterminal on pc"
Now I'm confused! In which direction is this multiplexing occurring?!
Why do you repeat this for every single transmitted character?!
Yes Andy the configuration i.e. H/W and S/W are working just fine. I am using these settings for other programs. Even switching is working perfectly as I can see status on port 0 with LEDs and For that initialization every time : At first I didn't use it but as that program didn't work I thought because of delay serial initialization may get hampered so I'm doing it every time anyway that way it won't cause any harm except little more machine cycles.
I guess I'm doing some stupid mistake I'll have to rectify it