Procedure with BS2 & shifters 74HC595 & 74HC165
Drago
Posts: 24
Hello everybody,
·
No needs to say that I am new here!
Recently I discovered the BS and I am very sorry I didn’t have this opportunity 20 years ago.
It appears that we can use it in the application we already using different processor, but we do not have capabilities to change the software or preloaded process.
Now I will try to switch to BS, but I need little help in this:
Here is the application:
We have 43 “positions” and each position is connected to 2 inputs and 2 outputs (total 172 I/O).
I would like to use one BS2 with shifters 74HC595 and 74HC165.
Each “position is independent and applies the same process:
-········· Input #1 change the state (ON) = activate output #1 for time (10 seconds) next,
if input #2 change the state (from OFF to ON) it activates output #2 and deactivate output #1.
Output #2 stays ON until input #2 is ON even if the process repeats (input #1 trigger again,….).
When input #1 is triggered and input #2 is closed after time out (10 seconds) both outputs #1 & #2 should close.
·
As a beginner I wrote the code for the process, but I do not know how to implement this with the shifters for that many I/O’s?
' {$STAMP BS2}
' {$PBASIC 2.5}
·
DO
·
DEBUG ? IN5
DEBUG ? IN3
IN3 = 0
IF (IN3 = 1)· THEN
HIGH 14
·
PAUSE 10000
LOW 14
·
IF IN5 = 1 THEN
HIGH 15
ELSE
IF· (IN5 = 0) THEN
LOW 15
·PAUSE 3000
ENDIF
· ENDIF
·ENDIF
·
LOOP
·
Previously we used TPIC6B595, but I wasn’t able to make it happen. Today I order the 74HC595 and if anybody can help me with this code that will be great.
Thank you
Drago
·
No needs to say that I am new here!
Recently I discovered the BS and I am very sorry I didn’t have this opportunity 20 years ago.
It appears that we can use it in the application we already using different processor, but we do not have capabilities to change the software or preloaded process.
Now I will try to switch to BS, but I need little help in this:
Here is the application:
We have 43 “positions” and each position is connected to 2 inputs and 2 outputs (total 172 I/O).
I would like to use one BS2 with shifters 74HC595 and 74HC165.
Each “position is independent and applies the same process:
-········· Input #1 change the state (ON) = activate output #1 for time (10 seconds) next,
if input #2 change the state (from OFF to ON) it activates output #2 and deactivate output #1.
Output #2 stays ON until input #2 is ON even if the process repeats (input #1 trigger again,….).
When input #1 is triggered and input #2 is closed after time out (10 seconds) both outputs #1 & #2 should close.
·
As a beginner I wrote the code for the process, but I do not know how to implement this with the shifters for that many I/O’s?
' {$STAMP BS2}
' {$PBASIC 2.5}
·
DO
·
DEBUG ? IN5
DEBUG ? IN3
IN3 = 0
IF (IN3 = 1)· THEN
HIGH 14
·
PAUSE 10000
LOW 14
·
IF IN5 = 1 THEN
HIGH 15
ELSE
IF· (IN5 = 0) THEN
LOW 15
·PAUSE 3000
ENDIF
· ENDIF
·ENDIF
·
LOOP
·
Previously we used TPIC6B595, but I wasn’t able to make it happen. Today I order the 74HC595 and if anybody can help me with this code that will be great.
Thank you
Drago
Comments
On the Parallax website you can download "What's a Microcontroller" which is a really good source for some of the common things we do with Stamps.
In particular, it has some articles on the use of the shift registers you mentioned.
I've done a couple of jobs with the expansion concept (only to 64 inputs, though) for a lumber tally system. Generally they work quite well as long as your process has enough processing time to cycle through the registers. Some experimentation may be required.
Cheers,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk
http://www.siskconsult.com
·
I get some samples from couple sources and the part I wrote work fine, but I wasn’t able to make happen with shifters.
It may happen that TPIC6B595 can’t work and I have to use 74HC595, so I am now on hold until I get them.
I am little bit older guy and it will take little bit until I swallow all info.
Drago
I think your TPIC6B595 can be made to work but it does have a couple extra inputs compared to the 74HC595. Maybe comparing both data sheets you could cross match them.
Also, I may have steered you to the wrong resource.....have a look at the "Stampworks" document on the Parallax website.
Cheers,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk
http://www.siskconsult.com
·
I downloaded Stamp works and it is great help.
As I mentioned I am new with programming, but I am a veteran in electronic hardware.
My experiment with TPIC6B595 it may work, because I implemented the code from Stamp works and I get one cycle of LED’s on (it doesn't repeat?), but I don’t know how to write my application to associate the particular inputs with outputs.
So I taught that will be better to eliminate problem with unknown hardware and use the 74HC595 which sample is written for.
The sample for 74HC165 also works fine each input change the state.
·
Regarding your comment from yesterday each process will be executed separately, so the “traffic” should not be a problem.
Scanning time it could be interrupted for ms until execute output, but this is not crucial.
Thank you
Let me know if I can help further.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk
http://www.siskconsult.com
·
For your project you will need 11 input and 11 output shift registers, for a total of 176 I/O.
Attached is some code that might work for you.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't worry. Be happy
I am waiting to get the 74HC595 and 74HC165 and I will try the configuration and will apply the code.
What about 74HC165? How they are connected?
Are they using the same communication line or they should be on different pins?
Some schematics I have require the resistor to distinguish inputs from outputs on same line.
I can have inputs on different three pins of BS2, and:
• Inputs 1 & 2 could be related only to outputs 1& 2 to execute my process,
• Inputs 3&4 related only to outputs 3&4,
• Inputs 5&6 related only to outputs 5&6, and so on.
That way will avoid the potential communication problem?
By the way how is in Norway?
Have a nice weekend
Drago
In the code I wrote, which I post an update to here, I am assuming that you have inputs 1&2 related to outputs 1&2 of the same "position", and so on. If you didn't you'd get really confused!!
BTW Norway is beautiful this season. I live on the west coast, and do lots of windsurfing and robot-building!!
I had to correct an error in the code. The attachment manager in this forum is bugged, so I post the code here.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't worry. Be happy
It is really easy to confuse me, because as I mentioned I am novice in software development, but you did right.
Thanks one more time.
As soon as I receive my IC’s I will experiment with that and let you know how it works.
BTW: I moved from Europe here recently, and Norway was one of countries I wasn’t able to visit, but I always wish.
Maybe when I get retired (Hi, Hi)
Enjoy!
Drago
You are welcome to Norway
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't worry. Be happy
The code will:
1) Read input #1 on all positions, and turn turn outputs #1 ON (if inputs are on)
2) Wait 10 seconds
3) Continously check both inputs. If input #2 is ON, turn Output #1 OFF and Output # 2 ON. If Input #1 is ON and Input #2 is OFF, turn output #1 OFF.
You will probably have to understand the code to make it work perfectly.
Good luck!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't worry. Be happy
There are enough pins, so I guess when separate the communication the application should work better and more stabile.
Drago
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
If you would like a hardcopy of the StampWorks 2.0 book, PM me a mailing address. I picked up 5 of them a few years ago on a dirt-cheap eBay auction. Sometimes a hardcopy is easier to use than the PDF. Not sure what the differences are between Version 2.0 and the PDF online that is Version 2.1. I don't see an "change history" anywhere and a quick perusal of both turned up no differences.
I also recently started looking into 595s for a setup that uses multiple Temp/Humidity sensors. I think this may be an easier approach than using up 2 IO pins for each of the 12 sensors.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andrew Williams
WBA Consulting
IT / Web / PCB / Audio
Thank you for response.
I downloaded already Stamp works and I am fine for now.
It may be somebody else that needs the book more than I.
Dev/null helped me with code and now I am trying to make it work with TPIC6B595 which we already use, but in different configuration.
This should be the same type of shift register, but it allow 150mA of continues current per output instead 35mA (74HC595).
Will se how it will work.
Regards,
Drago
·
I am not an expert, but I believe that by setting the pin 9 (G) HIGH/LOW that could be changed?
The 74HC595 outputs are standard "totem-pole" outputs that will either source current (from Vdd) or sink current (to ground) depending on whether the output state is high or low respectively.
Are you saying that the TPIC6B595 can only sink while·the 74HC595 can both·source or sink?
The TPIC6B595 can only sink current, but can sink quite a bit of it.
The 74HC595 can sink or source current, but not a lot of it (maybe 20mA ... look at the datasheet for details).
· I just received some 74hc595 shift registers and set up two of them to drive 16 LEDs (per the Stamp Works experiment #23) and everthing works fine. How would I wire the LEDs if I wanted to sink the load rather than source?
I looked up totem-pole outputs but don't grasp the way they function but apparently they can sink more current than they can source.
It would be useful to know how to do that.
Thanks again for your knowledge and help.
Ron