Re: Single pin to control a shift register
- From: CBFalconer <cbfalconer@xxxxxxxxx>
- Date: Mon, 03 Mar 2008 21:34:25 -0500
Tomás Ó hÉilidhe wrote:
(I already posted this but it didn't show up after half an hour
so I posted it again. If there's a duplicate thread, then please
ignore THIS one and put all replies in the other thread.)
Usenet posts can take their time. One principle is: Never assume
anyone has (or will) receive all posts, so make each message stand
by itself. That's why there are quoting facilities.
I'm just a novice really in embedded systems, and I'm doing a.... snip ...
college project. I've already gotten my board made and already
stuffed it with components, so the time for backtracking the
design has been and gone. My design might not be brilliant, but
I hope it will work in the end. Here goes...
I have an 8-Bit shift register chip, and at any time there will
only be one HIGH on it. For instance:
1000000
0000001
Each shift-register pin will go to a single LED, and the HIGH
will be used to power one LED at a time. The shift register will
be clocked so fast that I'll have 8 LED's that will look like
they're all on at the same time.
First point - look at the drive current available from the chip.
Usually much more is available in the low state than the high. So
you should reverse your logic (or use an inverter to drive the
LED), i.e.
01111111
...
11111110
Now I could have done this fairly easily using TWO pins from my
microcontroller. The first pin would go to the actual shift
register input, and the second pin would go to the clock input on
the shift register. (An RC circuit would be put on the shift
register's master reset to make sure that we start off with all
zeroes). When the micrcontroller boots up, I would put a HIGH
onto the input, clock it, then set the input low, then clock it
a further six times, then set the input high again, clock it, set
the input low, then clock it a further six times, ad infinitum.
Very iffy. You don't know the relationship between the RC circuit,
the oscillator, and the gate thresholds. So avoid it all. In
part, this depends on the available input signals to the SR. The
idea is to get it into all 1's, and then feed in a single zero. If
you use an inverter on the output pin you can use all 0's and feed
in a single one. If you use a register within the microcontroller,
you can set up just what you need. Then the 'shift code' can be:
if (rh_bit == 0) next_state = 01111111b;
else next_state = (old_state / 2) | 10000000b;
which you perform on one clock edge. On the other clock edge you
perform
old_state = next_state;
Good luck.
--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
--
Posted via a free Usenet account from http://www.teranews.com
.
- References:
- Single pin to control a shift register
- From: Tomás Ó hÉilidhe
- Single pin to control a shift register
- Prev by Date: Re: Embeded Tutorial?
- Next by Date: UART design considerations
- Previous by thread: Single pin to control a shift register
- Next by thread: UART design considerations
- Index(es):
Relevant Pages
|