More Shift Register Advice
Recently I asked for your wiring advice regarding the configuration of a BS2 serial out to a 74HC595 shift register out to a ULN2803 as the final output... you can find that short thread here: http://forums.parallax.com/showthread.php?p=756324 it may add some clarity to read this first.
The project continues and I would appreciate some more advice...
I have one BS2 which will drive the four shift register/ULN combinations, for a total of 32 outputs. The timing for driving the final outputs is not critical, and my questions are these:
What are the pros and cons of daisy-chaining the four shift register and ULN combinations and driving them from three BS2 pins by shifting out all 32 bits vs. driving each shift register/ULN combination separately from the Basic Stamp??
The sole job of the BS2 for this project is to drive these 32 outputs, so I feel that it could be done either way as I don't need to save I/O pins for other uses.
This is my first time using shift registers so those of you with some experience please let me know which way would be the better way to go. The daisy-chain option saves wiring and I/O, but I don't know if the programming will be simpler or easier for one way vs. the other.
As always, thanks for the help.
Tim
Post Edited (Tim-M) : 10/15/2008 2:20:17 PM GMT
The project continues and I would appreciate some more advice...
I have one BS2 which will drive the four shift register/ULN combinations, for a total of 32 outputs. The timing for driving the final outputs is not critical, and my questions are these:
What are the pros and cons of daisy-chaining the four shift register and ULN combinations and driving them from three BS2 pins by shifting out all 32 bits vs. driving each shift register/ULN combination separately from the Basic Stamp??
The sole job of the BS2 for this project is to drive these 32 outputs, so I feel that it could be done either way as I don't need to save I/O pins for other uses.
This is my first time using shift registers so those of you with some experience please let me know which way would be the better way to go. The daisy-chain option saves wiring and I/O, but I don't know if the programming will be simpler or easier for one way vs. the other.
As always, thanks for the help.
Tim
Post Edited (Tim-M) : 10/15/2008 2:20:17 PM GMT
Comments
In Parallel : More I/O, faster
If you don't care about speed or pins used it does, as you note, come down to software. That depends on what data you have to put out and how it's stored. If you have three bytes which can be sequentially banged out to fill the three shift registers daisy-chaining is what I expect gets the edge.
Best way to get an answer as to which is best is to code up both options, or at least determine what algorithms you'd need for each. For daisy-chaining that's probably as simple as load a byte to a var, GOSUB to the bit-banging output routine, repeat three times.
I do care about speed a little bit. I'd like to update all 32 outputs a few times a second (10-20 would be great!) but without shift register experience, I don't know if that's realistic... That maximum update rate will be the basis for my decision for the daisy-chain or parallel method, I think. If 10-20 times a second is possible in a daisy-chain, I'll go that route, otherwise I'll keep the shift register/ULN pairs separate and update them individually as needed.
Tim
You can get some timing data for SHIFTOUT on a BS-2 here:
http://www.emesystems.com/BS2speed.htm
Thanks go to Dr. Tracy Allen. Using those formulas should permit you to answer the question yourself.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When all else fails, try inserting a new battery.
Thanks for the speed calculations link on Tracy Allen's site, that's valuable information! I don't quite understand the 990 microseconds listed at the top of the right hand column... is that the total time for one byte to be sent as shown in the lower left, or is it the total time for the two bytes shown below on the right? Four bits per byte for a total of eight bits, correct? My digital background is very weak, so I apologize for the really rookie questions but I want to be sure that I understand the chart information correctly so the calculations are right for my project.
Tim
There are 8 bits per byte. It takes 990 ms. to transmit one BYTE, or 8 BITS.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When all else fails, try inserting a new battery.
Tim
32 bits/4 = 8 bytes,
990 microseconds per byte, so
990 microseconds x 8 = 7920 microseconds or 0.007920 seconds total for 32 bits to be sent.
1 second/0.007920 for 32 bits to be sent means I can update the outputs about 126 times per second maximum. (On paper)
Can·anyone else verify this as correct or not?
Thanks again for the help Bruce, and Tracy too!
Tim
Post Edited (Tim-M) : 10/15/2008 7:04:13 PM GMT
Does the above time calculation for shifting out 32 bits with an OEM Basic Stamp II look correct?
Tim
Tim
Edit: I think I made a mistake above...
I should have divided the 32 bits by 8·for total·bytes, rather than four.
32 bits/8 bits per byte = 4 bytes
990 microseconds per byte x 4 = 3960 microseconds, or 0.003960 seconds total time to send 32 bits.
This provides a maximum update rate of about 252 times per second. (On paper at least)
Look right to you?
Post Edited (Tim-M) : 10/17/2008 8:46:54 PM GMT