Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

RS232/UART Baud rate Conversion?

1 view
Skip to first unread message

Ben Mok

unread,
Apr 17, 2002, 7:52:15 AM4/17/02
to
Hi,

I just wonder is there any simple method to do some RS232/Uart baud rate
conversion? Recently I need to connect a serial mouse(1200 baud) to a com
port of an embedded system, which can only be configured to 9600 baud for
slowest connection. The system is just a prototype, so the conversion can be
done at either the com or uart stage. Any hints will be much appreciated.


Mark A. Odell

unread,
Apr 17, 2002, 8:21:27 AM4/17/02
to
"Ben Mok" <be...@hotmail.com> wrote in
news:a9jnle$o9...@imsp212.netvigator.com:

Do you mean auto-baud? If so, a search on Google should probably come up with
an example.

michael brown

unread,
Apr 17, 2002, 8:21:32 AM4/17/02
to

Sounds like a good job for a PIC chip. If you step the 1200 up to 19200,
this will allow enough time to send the received byte during the received
bytes stop-bit time. Piece of cake. ;-)

michael

Ben Mok

unread,
Apr 17, 2002, 10:06:20 AM4/17/02
to
Thanks, guys. No, it is not auto-baud rate detection, but rather fixed baud
rate convesion, in this case, 1200 to 9600 baud. My planned solution is also
to use a micro, a 8051 or PIC with two UART port to do it, as this is only
one of a kind demo prototype. I just wonder is there any simple circuit
tricks say a few discrete components to do the job.


Chris Pflieger

unread,
Apr 17, 2002, 10:37:58 AM4/17/02
to
There's no simple solution. It requires a uC and two UARTs. Lag should
be minimal since you're going from 1200 to 9600.
--
Chris Pflieger
Design Engineer
Touchplate Technologies, Inc.

michael brown

unread,
Apr 17, 2002, 11:13:46 AM4/17/02
to

> Ben Mok wrote:
> >
> > Thanks, guys. No, it is not auto-baud rate detection, but rather fixed
baud
> > rate convesion, in this case, 1200 to 9600 baud. My planned solution is
also
> > to use a micro, a 8051 or PIC with two UART port to do it, as this is
only
> > one of a kind demo prototype. I just wonder is there any simple circuit
> > tricks say a few discrete components to do the job.
> >
> There's no simple solution. It requires a uC and two UARTs. Lag should
> be minimal since you're going from 1200 to 9600.

I beg to differ here. This can be easily done on a PIC with no hardware
UARTS (16F84 for example).

Matthias Weißer

unread,
Apr 17, 2002, 1:11:55 PM4/17/02
to

"Ben Mok" <be...@hotmail.com> wrote

Hi

i just opend my old Genius 3-Button-serial Mouse. There is a XTAL inside. Mybe
you can overclock ;-) the mouse by 8-times to reach the 9600Baud.


--
Matthias Weißer
matt...@matwei.de
http://www.matwei.de


Ppelectron

unread,
Apr 17, 2002, 4:29:06 PM4/17/02
to

Yes you could come up with a hardware solution, but as in so many applications
it simply isn't worth it. It's easier, cheaper and faster to design a
microcontroller based solution. I reckon a 74 series logic based solution would
probably need between 5 and 10 chips. Personally, I wouldn't bother. Go for a
dual UART PIC or a Dallas with an 8051 core. Depends what tools you have
available and what you are used to designing with.

Norm Dresner

unread,
Apr 17, 2002, 6:31:10 PM4/17/02
to
Ppelectron <ppele...@aol.com> wrote in message
news:20020417162906...@mb-fs.aol.com...

Go with that advice. I remember designing a circuit back in the late '70s
to take two byte data from a uart: the first byte indexed a demultiplexer
which steered the second byte to its rightful destination. It was ugly, it
was complicated, and it was a bear to debug. Of course, once I got it
running, it could still be running for all I know. In 1978 the only things
I knew how to use were the 8080, 8085 and Z-80 CPUs. An 8051 -- or even a
PIC -- would have been a much easier solution.

Norm

Jim Granville

unread,
Apr 17, 2002, 7:07:20 PM4/17/02
to

Before you throw silicon at this, first check to make SURE you cannot
get
the 9600 down to 1200.
The 'BIOS' may not init below that, but often you can init at 9600,
then
go direct to the BAUD divider registers, and load 1200 settings.

If you need HW, the 1200 baud is doable as SW uart, and 9600 in HW, so
any small uC with 1 UART, from a 89C1051U up, will do.

- jg

Mark A. Odell

unread,
Apr 17, 2002, 8:45:55 PM4/17/02
to
"michael brown" <n5...@nospam.earthlink.net> wrote in news:gNdv8.9089
$oj5.2...@typhoon.austin.rr.com:

From what I've seen of the TI MSP430 you could do this with no trouble, low
cost, and low power to boot.

William Meyer

unread,
Apr 17, 2002, 8:56:14 PM4/17/02
to
In article <a9jvgr$o7...@imsp212.netvigator.com>, be...@hotmail.com
says...

Try an AVR Mega128, which has the UARTs on-board. The software would be
trivial, from what you describe.

Bill

Blakely LaCroix

unread,
Apr 17, 2002, 11:03:16 PM4/17/02
to
In article <20020417162906...@mb-fs.aol.com>, ppele...@aol.com
(Ppelectron) writes:

>Yes you could come up with a hardware solution, but as in so many
>applications
>it simply isn't worth it. It's easier, cheaper and faster to design a
>microcontroller based solution. I reckon a 74 series logic based solution
>would
>probably need between 5 and 10 chips. Personally, I wouldn't bother. Go for a
>dual UART PIC or a Dallas with an 8051 core. Depends what tools you have
>available and what you are used to designing with.
>

If it is just a one way transmission, you can use a normal 8051 with different
timers for receive and trasmit. Receive at 1200 baud on the UART and use
the transmitter to send at 9600. Use timer 1 or receiving and timer 2 for
transmit.

Blakely LaCroix
Minneapolis, Minnesota, USA.
RBP Clique member # 86.

The best adventure is yet to come.

Robert Gush

unread,
Apr 18, 2002, 1:46:15 AM4/18/02
to
"Ben Mok" <be...@hotmail.com> wrote in message
news:a9jnle$o9...@imsp212.netvigator.com...

If its only for a mouse, then it is fairly easy to do it with a PIC16F84 or
similar.

Use 8 samples per bit for the 1200 baud receive and send at 1 sample per bit
for the 9600 tx. Use the same interrupt for both the TX and RX.

I reckon about 50 lines of assembler code.

Regards - Robert

PS - a competition to see who can make the cheapest solution with the
smallest code? Maybe not...


Meindert Sprang

unread,
Apr 18, 2002, 2:19:35 AM4/18/02
to
"Ben Mok" <be...@hotmail.com> wrote in message
news:a9jvgr$o7...@imsp212.netvigator.com...

One uart will do. Run that on 9600. Run a software uart on 1200 baud, which
can easily be done on any micro.

Meindert

Meindert Sprang

unread,
Apr 18, 2002, 2:21:03 AM4/18/02
to
"Blakely LaCroix" <rail...@aol.com> wrote in message
news:20020417230316...@mb-cu.aol.com...

> In article <20020417162906...@mb-fs.aol.com>,
ppele...@aol.com
> (Ppelectron) writes:
>
> >Yes you could come up with a hardware solution, but as in so many
> >applications
> >it simply isn't worth it. It's easier, cheaper and faster to design a
> >microcontroller based solution. I reckon a 74 series logic based solution
> >would
> >probably need between 5 and 10 chips. Personally, I wouldn't bother. Go
for a
> >dual UART PIC or a Dallas with an 8051 core. Depends what tools you have
> >available and what you are used to designing with.
> >
>
> If it is just a one way transmission, you can use a normal 8051 with
different
> timers for receive and trasmit. Receive at 1200 baud on the UART and use
> the transmitter to send at 9600. Use timer 1 or receiving and timer 2
for
> transmit.

Darn! That's the best and easiest! He was talking about a mouse, that is one
way....

Meindert

Meindert Sprang

unread,
Apr 18, 2002, 2:22:05 AM4/18/02
to
"William Meyer" <wmhm...@earthlink.net> wrote in message
news:MPG.1727ba967...@news.earthlink.net...

Yeah, go on.... Why not use a PC with 2 serial ports :-)

He only needed to interface a mouse....

Meindert

Alf Katz

unread,
Apr 18, 2002, 8:21:22 AM4/18/02
to
Yepp, there's lots of microcontroller ways of skinning this cat. However,
if it's only a oncer demo prototype as you say, just throw a PC in there and
say "this will be replaced by a $2 chip". Don't put in in too much NRE
until it's sold.

--
Regards,
Alf Katz,
alf...@removethis.ieee.org


"Ben Mok" <be...@hotmail.com> wrote in message

news:a9jnle$o9...@imsp212.netvigator.com...

Ben Mok

unread,
Apr 18, 2002, 9:21:30 AM4/18/02
to

"Alf Katz" <alf...@removethis.ieee.org> 撰寫於郵件新聞
:3cbeb997$0$4304$afc3...@news.optusnet.com.au...

> if it's only a oncer demo prototype as you say, just throw a PC in there
and
> say "this will be replaced by a $2 chip". Don't put in in too much NRE
> until it's sold.
>
My boss wont agree and he will get me replaced. ;-)


William Meyer

unread,
Apr 18, 2002, 2:29:35 PM4/18/02
to
In article <3cbe654a$1...@news.nb.nu>, mhsp...@ANTIcustomwareSPAM.nl
says...

>
> Yeah, go on.... Why not use a PC with 2 serial ports :-)
>
> He only needed to interface a mouse....

True enough, but if the embedded side is limited, and his choice of
mouse equally limited...

As the harder things get easier, we apply solutions to the simple things
which look like overkill. But embedded CPUs are cheap, while development
time is not.

I'm sure it could be done with some little PIC or a small AVR, and both
UARTs in software, but by the time he counted the hours in development
and debug, it would make the more expensive part seem pretty cheap. Of
course, if he needs to ship 10,000 pieces, then the dev time is worth
spending.

Bill

Rick Merrill

unread,
Apr 18, 2002, 7:39:15 PM4/18/02
to
Norm Dresner wrote:

Used to do this without a UART at all, and for a multiplexer at that.
We sampled at 5x the maximum baud rate and located the center
point of the bits by matching the start-stop signals - it those days
it was like SETI!-)

RMM

Paul Keinanen

unread,
Apr 19, 2002, 2:57:20 AM4/19/02
to
On 18 Apr 2002 03:03:16 GMT, rail...@aol.com (Blakely LaCroix)
wrote:


>If it is just a one way transmission, you can use a normal 8051 with different
>timers for receive and trasmit. Receive at 1200 baud on the UART and use
>the transmitter to send at 9600. Use timer 1 or receiving and timer 2 for
>transmit.

Or use just a single 9600 Hz timer interrupt and sample the 1200 bit/s
stream with 8 samples/bit. If 5-8 samples are "0" then you have
received "0", if there are 5-8 "1" samples, then you have received
"1". However, if you have 4 "0" samples and 4 "1" samples, you
probably have messed up with detection of the falling edge of the
start bit.

In order to reduce the conversion delay, when you have received the
start, data and possibly parity bits and are starting to receive the
stop bit, you can already start sending the start bit on the 9600
bit/s side using the same clock interrupt. When the last sample of the
stop bit of the 1200 bit/s side has been received, you are just
sending the last data bit on the 9600 bit/s side, thus the stop bit on
the 9600 bit/s side can be sent only 1-2 ms after the end of the stop
bit on the 1200 bit/s side, compared to 12-13 ms if two separate PARTs
are used :-).

Paul

Meindert Sprang

unread,
Apr 19, 2002, 3:04:18 AM4/19/02
to
"William Meyer" <wmhm...@earthlink.net> wrote in message
news:MPG.1728b1737...@news.earthlink.net...

> In article <3cbe654a$1...@news.nb.nu>, mhsp...@ANTIcustomwareSPAM.nl
> says...
> >
> > Yeah, go on.... Why not use a PC with 2 serial ports :-)
> >
> > He only needed to interface a mouse....
>
> True enough, but if the embedded side is limited, and his choice of
> mouse equally limited...
>
> As the harder things get easier, we apply solutions to the simple things
> which look like overkill. But embedded CPUs are cheap, while development
> time is not.

Come on! Use a '51, wich can use different baudrates for transmitting and
receiving. The whole initialisation code would be less than 15 assembly
instructions and the entire main loop would look like this:

wait: jnb RI,wait
clr RI
mov a,SBUF
mov SBUF,a
sjmp wait

Development time, huh? What development time....

Meindert

Ppelectron

unread,
Apr 19, 2002, 5:10:19 AM4/19/02
to
>Come on! Use a '51, wich can use different baudrates for transmitting and
>receiving. The whole initialisation code would be less than 15 assembly
>instructions and the entire main loop would look like this:
>
>wait: jnb RI,wait
> clr RI
> mov a,SBUF
> mov SBUF,a
> sjmp wait
>
>Development time, huh? What development time....
>
>Meindert

My thoughts exactly! We could have written the software 10 times over in the
time it has taken to discuss it!

William Meyer

unread,
Apr 19, 2002, 2:08:00 PM4/19/02
to
In article <3cbfc0ab$1...@news.nb.nu>, mhsp...@ANTIcustomwareSPAM.nl
says...

>
> Come on! Use a '51, wich can use different baudrates for transmitting and
> receiving. The whole initialisation code would be less than 15 assembly
> instructions and the entire main loop would look like this:
>
> wait: jnb RI,wait
> clr RI
> mov a,SBUF
> mov SBUF,a
> sjmp wait
>
> Development time, huh? What development time....

Referred to some of the other alternatives, such as hardware solutions.
I am not a '51 user, so I missed that alternative, but I agree, it's a
good one. OTOH, if the solution were for volume production, then a soft
UART on the 1200 baud side would allow even cheaper solutions.

Bill

The Happy Hippy

unread,
Apr 24, 2002, 11:11:55 AM4/24/02
to

"michael brown" <n5...@nospam.earthlink.net> wrote ...

> > There's no simple solution. It requires a uC and two UARTs. Lag should
> > be minimal since you're going from 1200 to 9600.
>
> I beg to differ here. This can be easily done on a PIC with no hardware
> UARTS (16F84 for example).

I agree entirely, having successfully achieved 9600 to 250,000 baud rate
conversions ( PC serial to DMX-512 ) using such a PIC, just by bit banging.

At 1200 bps, you'll have 833uS to play with for each bit, which is a lot of
instructions with a 4MHz xtal.

Going up in baud rate is easy, going down adds the problem of having to
buffer data and stop the transmitter from sending as the buffer approaches
full.


jetmarc

unread,
Apr 27, 2002, 5:13:02 PM4/27/02
to
> I just wonder is there any simple method to do some RS232/Uart baud rate
> conversion? Recently I need to connect a serial mouse(1200 baud) to a com
> port of an embedded system, which can only be configured to 9600 baud for
> slowest connection. The system is just a prototype, so the conversion can be
> done at either the com or uart stage. Any hints will be much appreciated.

If you're willing to pay me, I'll develop you firmware for a PIC12C508(A). You
won't need external components (ie, no XTAL). You can add the PIC to your
embedded PCB right before the UART input. Small footprint SO-8 packages are
available. Check PIC12C508(A) pricing and make an offer (by email).

Marc

0 new messages