I'm trying to make my own alarm system.
Welcome back Steve.
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
You can solve the problem with a 16 channels mux (74hc4067)
You connect one input pin of your pic to pin 1 of the mux.
Ground pin 12 and pin 15 of mux (Enable)
Connect pin 24 to + 5V
Connect Pins 10; 11; 13 and 14 to 4 output pins of your pic.
Pullup all 16 mux inputs with a 10k resistor
Ground all 16 mux input with n.o. switches
Write a code to scan the mux. Read input pin. If pin=0 then switch is close.
If pin=1 then switch is open.
Scan position will tell you wich swicth has been activated.
Al.
Yes I made the mistake to write n.o. intending n.c. Sorry for that!
Al.
What's up with the switches?
Are they what you have on hand and want to use them up?
Are you short of pins on your present project, yet still need to hook up the switches?
Just trying to get a feel for a good solution. The '4067 isn't a bad solution, for an N.O. switch. But I'm thinking, if you're going to go that route, may as well whip up another PIC to do the tough work for you...
I'm trying to make an alarm system and I don't want it to be limited by to few switches. Now I know everyone is going to say how many doors do you have that you want to put a sensor on. Well its only 3 so far but there are other things like outside gates, garage door, mailbox (then I can have my computer go "you've got mail" and it be real mail ... lol). I'm sure there are other things as well but thats all I've got right now. If i'm going to use up eight pins I might as well get as many switches as I can out of them.
The using a whole other pic might not be a bad idea. hmmmm
Bookmarks