Reset Button not working
I have written a program for my double switch circuit to change power supply between LOW, HIGH, and OFF, but my reset button on the Stamp won't work. I have to plug the stamp into the computer and unplug it each time to get it to run. And then, I'm not even pressing the button. After plugging it in and unplugging it, the program just starts. When it's done running, I press the reset button to do the cycle once again, but it does nothing. How can I fix this so I can use my reset button and don't have to keep plugging the computer in every time?
Here's my code:
PAUSE 1000
LOW 1 'switch to HIGH voltage on top relay
HIGH 0 ' switch bottom relay into ON position
PAUSE 3000 'HIGH voltage supplied for 3 seconds
LOW 0 'switch bottom relay into OFF position
PAUSE 2000 'pause in OFF position
HIGH 1 'switch to LOW voltage on top relay
HIGH 0 'switch bottom relay into ON position
PAUSE 3000 'LOW voltage supplied for 3 seconds
LOW 0 'switch bottom relay into OFF position
END
Here's my code:
PAUSE 1000
LOW 1 'switch to HIGH voltage on top relay
HIGH 0 ' switch bottom relay into ON position
PAUSE 3000 'HIGH voltage supplied for 3 seconds
LOW 0 'switch bottom relay into OFF position
PAUSE 2000 'pause in OFF position
HIGH 1 'switch to LOW voltage on top relay
HIGH 0 'switch bottom relay into ON position
PAUSE 3000 'LOW voltage supplied for 3 seconds
LOW 0 'switch bottom relay into OFF position
END
Comments
You might put a LOW 0 and LOW 1 before the PAUSE 1000. It should be optional since the Stamp's I/O pins are put into input mode on a reset, but it's good programming practice to set I/O pins to an initial state (if not input) at the beginning of a program.
The contact cleaner comes in a spray can and is handy for just about any test equipment with knobs and switches. I use a German brand that is called "Kontakt".
Alternatively, you could short the Vin to Vss and have the Brown Out circuit inside the microcontroller reset the device. But this is technically a rather brutal way to doing a Reset.
Or another alternative is to install a switch that momentarily breaks the supply circuit. I suppose that might be found at Radio Shack or some place similar.
-Phil
It looks like the Brown Out Reset is an add on chip on this version as the PIC16F57 did not include an internal brownout feature. The SX chips have an internal brownout control.
The main thing is that the BasicStamp is programming correctly. The ATN signal also uses the Reset and if that works the micro-controller is A-Okay. In fact, I am almost 100% sure that if the device will take programs, it has to be a faulty button. The pull-up resistor is intact.
Momentarily shorting the Vin and Vss should trigger a brownout event. If one wants to be conservative, use something like a resistor to do the job. That would limit the current. Not sure about what value though.
Why not just open and close the connection between the battery/source and "Vin"?
Not enough sparks?
-Phil
I did say that shorting option was 'rather brutal'. I don't like to think about what it might do the voltage regulation chip.
If one has the WAM kit, there are a couple of push button switches included that be pressed into use inside the program OR one might drag out the soldering iron and replace the defective one. Just test it before you begin taking your board apart.
I still think aerosol spray cleaner is the best approach.
A reset button is a very simple piece of equipment. In this case it is a normally open momentary switch which closes when you push it. Do you have or can you borrow a multimeter that has a resistance reading or a setting that beeps whether the circuit is open or closed? If you can you must turn your BS2 upside down with the battery in the lower left corner to check it out. Just left of center and about 1/5 of the way down you will see a rectangle of dots. Do not turn the power switch on and use the probes to just check if the left two dots are open or a high or OF reading.(they should be, plus and minus on the probes does not matter) Then with the probes in the same position press the button. If you get shorted or a beep or a very low resistance reading your button works. If this checks out and your button still does not work you may have a mistake in your wiring or program. One last thing to check is the lead between the lower left button and the pin it is connected to on the BS2 module. Make sure that it has not been scratched or marred which would affect the signal from the button.
Please keep entering programs! There is a lot of help here if you just make a try and there is a lot you can do with this little microcontroller.