advice needed: simple baud rate conversion

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View


Hello,
I have a simple application that requires interfacing a device which tx
data at 9600 baud, and another device that rx data at 115k baud. Have
considered pic but am not sure which one and not all can support the
higher baud rate.

Thank You
Greg


Re: advice needed: simple baud rate conversion


snipped-for-privacy@gmail.com says...
Quoted text here. Click to load it

Find any processor that can input at 9600 and then just user a timer
and output 115K on any other port by doing the bit shuffling yourself,
so then you dont need a cpu that has a serial port to do 115K...
You just have to be careful in setting your interrupts and what you
get the processor to do between output bit states, bit of interleaving
and you dont need interrupts even, can be fun doing it that way. I did
one once with 4 lots of 4800 input and one output at 19200,
ie. The UART port was the output and the 4 inputs were bit shuffled
and used a mapping function to ensure I didnt lose any edges, neat stuff.
Oh and there was a pair of hc86's on the front end - as an error/coincidence
flag check, though it never went off to indicate I missed any edge timing...


--
Regards
Mike
We've slightly trimmed the long signature. Click to see the full one.
Re: advice needed: simple baud rate conversion


Hi Mike,
Thanks for the advice. Could you suggest a cheap processor that will do
this? As mentioned I have consdered pic processors but was confused
with the huge number of these devices and the limitations many had in
being able to output at 115kBaud. My main concern is that I can program
the processor without having to buy expensive development kits and so
on. Also the outputting of data at 115kb requires some tricky
programming. Do you have any examples of software that does this?

greg


Re: advice needed: simple baud rate conversion


snipped-for-privacy@gmail.com says...
Quoted text here. Click to load it

You can do serial in/out with any processor just about if you are
able to 'bash the bits', I might add, you can do that at way above
115K if you really wanted to without much trouble at all.

What do you consider expensive, there are programmers on the net
that have free s/w and recommend h/w you can build yourself for
less than $10. ?

Not tricky at all to output serial, like stopping at a red light and
waiting for it to turn green, same principle just add a counter for
the number of bits, the rest is a sequence of events, do it by hand
for one byte if you like and you'll soon see its trivial. Just get
acquainted with the functions for count, jump, shift etc

Not willing to give my examples as it really depends on the processor,
it would be very easy to get misled and waste time, as you are new to
this I'd recommend doing it from first principles, though sure, you
can find examples on web through google, your time not mine.

--
Regards
Mike
We've slightly trimmed the long signature. Click to see the full one.
Re: advice needed: simple baud rate conversion


Quoted text here. Click to load it

one way is a loop like this

I'm not familiar with PIC assembler so this is pseudocode.

   1  the byte to send is in the data register

   2  clear the carry flag
      
   3  output the carry flag to the I/O port

   4  compare the data register with the number 255
      
   5  if it's 255 jump tp step 8

   6  set the carry flag
      
   7  rotate the data register right through the carry flag
      
   8  jump to step 3
  
   9  output 1 to the I/0 port

   go and wait for another byte to arrive in the UART.
  

115K2 transmission can probably be done using that method with a
1.8432 Mhz clock you'll need to pad the loops (step 3 to 8) enough that they
take to 16 clock cycles each, and also pad the code ensure that step 9 comes
16 cycles after step 3,

that clock rate should also be compatible with running the in-built uart at
9600.




--

Bye.
   Jasen

Re: advice needed: simple baud rate conversion


snipped-for-privacy@gmail.com says...
Quoted text here. Click to load it

yeah!

I didn't read it properly yesterday... no need for interrupts...

Just poll the 9600 UART and when you get a byte spit the bits out as fast as
you can, you'll be done long before there's another byte in the UART to deal
with,

figure out how many cycles will separate the bits and pick a crystal that'll
give 115200 bps (pad the loop with nops until there's a suitable crystal
available then set the divisor for the uart...)

serial data is sent as a 0 bit, then the data bits from right to left, then
a 1 forever until the 0 before the start of the next byte.


--

Bye.
   Jasen

Re: advice needed: simple baud rate conversion



Quoted text here. Click to load it

You could use a z180 processor, not quite one chip solution but you
could still keep it simple and gives you heaps of power if you need to
do any other conversions or buffering.

    cya,    Andrew...


Re: advice needed: simple baud rate conversion


Quoted text here. Click to load it

to make your job easier pick one with two uarts.

check the documentation but 1.8432 MHz is probably enough for that 115K2 baud
rate going to a faster crystal some multiple of that will give you more
opportunity to process the data, (should that be needed)

You could implement the 9600 baud UART in software (the venerable Commodore
64 had a software uart capable of 1200 baud) so a micro running at 7.3728
MHz (or probably 3.6824MHz) should be capable of keeping up with 9600 baud
using its built-in timers to help track the signal...

So there's two answers, buy the expensive model if you're in a hurry, or the
cheap one if you want to do some intensive driver coding.

Bye.
   Jasen

Re: advice needed: simple baud rate conversion



Quoted text here. Click to load it

Use a 16F688. Listen on the UART, bit bash out a GPIO pin.

If you want an easy to get part, then use whatever your local hobby
shop sells. You can always listen on one port pin using a timer and
bit bash out on another pin.

YOu should not need a fast device for this. Most of the bottom end
devices now support at least a 4MHz clock (last time i checked) which
is plenty.

I just had a look at the PIC collection, it is pretty impressive these
days.

Site Timeline