0
Offline
Jr. Member
Karma: 0
Posts: 93
Arduino rocks
|
 |
« on: May 14, 2011, 07:33:39 am » |
Hello Is it possible to operate a shift-register manually if you get my meaning with a row of switches? Why on Earth would I want to do that I hear you ask? Only out of curiosity and as a learning exercise and oh well isn't there something just a little bit perverse and sexy about doing such a thing? Like I was programming the ENIAC or some other arcane device? Oh Ok, just me then. The shift register I have in mind is a 74HC595. The sequence is I believe 1. latch pin LOW 2. data pin HIGH 3. clock pin LOW 4. data pin {desired pin state for bit N} 5. clock pin HIGH 6. data pin LOW 7. repeat from 3 until N=8 8. clock pin LOW So I'd have 8 LEDs connected to Q1-Q8 of the 595 with 220R current limiting resistors to GND and I'd have three ON/OFF switches for the latch, data and clock pins. I'd go through the sequence for a given binary pattern reach the final step and hey presto my LEDs will light in the given pattern. Makes sense no? I am a noob so I may well be way off piste. The only reason this might not work - it occurs to me - is if the various things are time critical. I was pretty good at Track'n'Field back in the day but I don't think I can flick switches at a millisecond rate 
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15316
Measurement changes behavior
|
 |
« Reply #1 on: May 14, 2011, 10:12:36 am » |
In theory you could operate a shift register with manual switches, the SR doesn't care how slow the sequence operates, just that it has the correct sequence steps. The problem you will have in reality is that manual switches have 'contact bounce' which will cause false stepping unless you design hardware contact debouncing components. That will make the whole circuit fairly component 'busy' and possibly frustrating to get working properly.
Lefty
|
|
|
|
|
Logged
|
|
|
|
|
nr Bundaberg, Australia
Offline
Tesla Member
Karma: 71
Posts: 6824
Scattered showers my arse -- Noah, 2348BC.
|
 |
« Reply #2 on: May 14, 2011, 08:52:53 pm » |
various things are time critical There's nothing particularly time critical in what you are doing, the only issue is switch bounce as retrolefty said, and that only matters on the clock pin. ______ Rob
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Boston area, metrowest
Offline
Brattain Member
Karma: 245
Posts: 16515
Available for Design & Build services
|
 |
« Reply #3 on: May 15, 2011, 12:39:26 am » |
And since only the clock pin matters, you could have a switch trigger a 555 to make pulse for you, nice & wide so when you fatfinger the switch you only get 1 clock signal out of it.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 218
Posts: 13896
Lua rocks!
|
 |
« Reply #4 on: May 15, 2011, 02:18:18 am » |
See below:  That is the bounce on a little switch press. There are so many bounces there it would probably clock out all 8 bits, and you would be left thinking it didn't work. You definitely need to address that or it won't be educational.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 93
Arduino rocks
|
 |
« Reply #5 on: May 16, 2011, 06:32:59 am » |
Thanks chaps. Yes good point, de-bouncing the switches. I know the problem but it hadn't occurred to me in this context.
Could you explain a little more about using a 555 to trigger pulses to make the clock pin HIGH/LOW? If you were to control the 555 with a switch would that switch itself not need de-bouncing also?!
If I understand things correctly, is it only the clock pin that needs de-bouncing because even if the data pins bounce they will settle on the intended value eventually and the next bit isn't considered until the clock pin advances the 595 to it?
|
|
|
|
|
Logged
|
|
|
|
|
nr Bundaberg, Australia
Offline
Tesla Member
Karma: 71
Posts: 6824
Scattered showers my arse -- Noah, 2348BC.
|
 |
« Reply #6 on: May 16, 2011, 07:01:17 am » |
Could you explain a little more about using a 555 to trigger pulses You set it up as a monostable. ie it gets a pulse the produces a longer pulse. would that switch itself not need de-bouncing No because the 555 output will stay active until X time after the last pulse. I can't remember the circuit (haven't used a 555 for about 20 years) but search for "555 monostable" on Google. If I understand things correctly, is it only the clock pin that needs de-bouncing Correct. All the data will be stable by the time you press the clock button. ______ Rob
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 93
Arduino rocks
|
 |
« Reply #7 on: May 24, 2011, 04:10:16 am » |
Thanks again chaps. In exploring shift registers I've gone off on a 555 tangent which I now realise was inevitable and has proved very interesting. I have various LEDs flashing and buzzers whining all over my workbench  Returning to my original problem, as the pins need to be kept HIGH for the relevant cycle and then set LOW again, what's the most sensible solution? Use the 555 in monostable mode with a very long pulse time (minutes) and then add a reset button to interrupt the pulse when desired, eg sooner?
|
|
|
|
|
Logged
|
|
|
|
|
nr Bundaberg, Australia
Offline
Tesla Member
Karma: 71
Posts: 6824
Scattered showers my arse -- Noah, 2348BC.
|
 |
« Reply #8 on: May 24, 2011, 04:42:28 am » |
as the pins need to be kept HIGH for the relevant cycle and then set LOW again Which pins? The only one that matters is the clock and it's edge triggered, so whether you give it a short high pulse or a short low pulse as far as the eye is concerned the SR will update the same way. ______ Rob
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 93
Arduino rocks
|
 |
« Reply #9 on: May 24, 2011, 05:08:58 am » |
as the pins need to be kept HIGH for the relevant cycle and then set LOW again Which pins? The only one that matters is the clock and it's edge triggered, so whether you give it a short high pulse or a short low pulse as far as the eye is concerned the SR will update the same way. Oh Ok cool. I did kind of wonder while I was typing whether it did need to be held or not. Yes sorry, I meant just the clock pin. I don't really know what edge triggered means ... ... Googling ... ... oh Ok, so it only needs a pulse, it's the change in state that triggers (magical stuff inside the IC) rather than whether it's in any particular state? How would I have known that if you hadn't told me? Presumably that sort of information is included in an ICs datasheet? Thanks again Jim
|
|
|
|
|
Logged
|
|
|
|
|
nr Bundaberg, Australia
Offline
Tesla Member
Karma: 71
Posts: 6824
Scattered showers my arse -- Noah, 2348BC.
|
 |
« Reply #10 on: May 24, 2011, 05:14:36 am » |
Presumably that sort of information is included in an ICs datasheet? Yep, but it's not always obvious when you're not used to reading data sheets. Often it's shown as a little triangle on the logic diagram. Also if anything is called a "clock" you can be 98% sure it's edge triggered. And the description will often say "on the rising edge of XX" sort of thing. Then as a last resort there's the timing diagrams. ______ Rob
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 93
Arduino rocks
|
 |
« Reply #11 on: May 24, 2011, 05:18:25 am » |
Thanks for your help
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 93
Arduino rocks
|
 |
« Reply #12 on: April 09, 2012, 06:21:10 pm » |
|
|
|
|
|
Logged
|
|
|
|
|
nr Bundaberg, Australia
Offline
Tesla Member
Karma: 71
Posts: 6824
Scattered showers my arse -- Noah, 2348BC.
|
 |
« Reply #13 on: April 09, 2012, 06:33:59 pm » |
Good one, and it only took a year. Getting paid by the hour were you  There was a great retro project here some time ago, a real Jules Verne style computer. I can't find it now but IIRC the keyboard was made from old typewriter keys etc. Looked great. ______ Rob
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 93
Arduino rocks
|
 |
« Reply #14 on: April 09, 2012, 06:36:38 pm » |
Haha! About 1 month to do and then 10 months to get round to documenting it! 
|
|
|
|
|
Logged
|
|
|
|
|
|