Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Simple serial port interface
June 26, 2005, 11:03 pm
rate this thread
I'm trying to build a simple computer controled led driver using sipo
shift registers. I have got it to work great using the parallel port
as I can control the input lines easily, however am having difficulty
understanding and implementing a version that would use the serial
port. I would prefer not to have to use a uC for this as I want to
keep it as cheap and easy to do and so that others, that don't have a
programmer, could make it. I am using latching shift registers so in
total I use 4 lines: input, clock, latch, and reset. Reset is kindof
optional but I prefer to be able to controll it from the program as
I'm having a couple issues, 1) How do I generate the clock signal when
using a DB9 connector that doesn't have one suplied. 2) How and when
would the latch need to be triggered, i.e. when do I know all the data
has been recieved?
I could think that using a resonator could generate the clock signal
though I don't know how to do that exactly. I would think that a
counter (chained flip-flops or the like) would work for trigerring the
latch, however that would (I think) imply that you are constantly
sending data, ideally only changes would be sent.
Not that it matters, but this is intended for use on linux systems as a
visual indication of mythtv's recording schedule, disk usage, etc. But
the hardware for it should be generic enough that it could be used to
indicate virtually anything.
Any ideas would be great, if someone has created a microcontroller-less
serial peripheral I would really like to see the schematic or hear your
Re: Simple serial port interface
You could bit bang it by manually controlling the DTR and RTS lines on
the port. You could use one of the lines as a data line, and one as the
You would set the data line to the correct boolean value (1 or 0), then
toggle the clock line to give you the 0-1-0 or 1-0-1 transition that you
need to clock the bit into the counter and have it ready to deliver the
next clock pulse.
Keep in mind that you will have to do a level shift to be compatible
with positive logic. The serial lines are at either -12V or 0V and need
to be shifted to positive logic for your counter. I would recommend
using a MAX232 IC which is designed specifically for this.
Re: Simple serial port interface
Serial is *a*synchronous. That's why the speed has to be manually set on
both ends (or an intelligence, as in the uProcessor you don't want, cycling
through the supported possibilities to see which one 'works', as modems do
at dial up).
The clocks on each end free run, with respect to each other, and the serial
data stream begins with a START bit. The receiving end monitors the serial
line for the START bit transition and then delays a half bit to set the
sample time. If the START bit is not still there then it's false start and
it goes back to waiting for one. If the START bit is still there then it's
'good' and there will be 7, or 8 (either 8 no parity or 7 with parity), or
9 (8 bit with parity), depending on the setting, data bits spaced equal
clock ticks from the half way point (to allow for bit jitter) in the START
bit. The STOP bit returns to the 'wait' state and is used as a final check
that synchronization occurred (stop should be there) or else the whole
block is discarded. Then parity checking is done if parity is set.
A START/STOP pair is sent for every 7, 8, or 9 data bits because the clocks
are not synchronized and, over time, would eventually drift apart. With a
START/STOP pair the two clocks just have to be close enough to keep within
1/2 bit, or so, over the 10, 11, or 12 bit time frame as they'll re-sync on
the next START.
Get a one chip UART that already does it and presents you with 8 bit
parallel out and a data strobe. Something like this (not that I'm
recommending this particular one, it's just an example)
As the saying goes, "Don't reinvent the wheel."
- » Exasperating graphics problem, motherboard related?
- — Next thread in » Home-built Computers
- » Troubleshooting help please - Problem with adding memory
- — Previous thread in » Home-built Computers