Latching an Input
civster
Posts: 17
I'm trying to figure out the best way to latch an input in case my application is performing a PAUSE instruction.
Here is an example:
Slot0
My current dilemma is that pin 15 will be connected to a relay output of an external device that will only close the contacts for a few milliseconds. In my example above, if pin 15 is pulled low when the PAUSE instruction just begun and its' only pulled low for 40ms then the program in slot1 will not be executed.
I'm wondering if there is something that will pull pin 15 low until a program in slot1 resets it.
Here is an example:
Slot0
StartBtn PIN 15 ' pin 15 is active low POLLIN StartBtn, 0 POLLRUN 1 POLLMODE 3 Main: DO ' Perform tasks here PAUSE 50 LOOP END
My current dilemma is that pin 15 will be connected to a relay output of an external device that will only close the contacts for a few milliseconds. In my example above, if pin 15 is pulled low when the PAUSE instruction just begun and its' only pulled low for 40ms then the program in slot1 will not be executed.
I'm wondering if there is something that will pull pin 15 low until a program in slot1 resets it.
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Any resources around that can enlighten me on using a flip-flop for my current application?
Thanks!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
The SENSE pin is an input·(read your signal here)
The Set/Reset pin is an output and supplies power to the SCR.· To "set" the latch make this
pin LOW.· To "reset" the latch make this pin HIGH for about 1mS, and then LOW again.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 7/6/2005 9:01:26 PM GMT
Don't forget to check the status of StartBtn each time you come back from the subroutine.
Cheers,
Tom Sisk
Thanks for the SCR diagram and after studying it, I'm guessing that the BS2p pin that is connected to SENSE will now be active high. Also, the TRIGGER will be connected to my external device's N.O. relay and back to +5VDC? Without these transistors in hand, I couldn't test these theories on the bench.
Just as Tom suggested, I've already set my PAUSE to 5ms increment in a FOR...NEXT loop, however, I would also like to have the input latched for redundancy.
N.O. relay contacts, you might find this circuit a little sensitive. You can counter this by decreasing the value of the 10K resistor, likewise if you need more sensitivity you can increase
this value. Leave the parallel 1K and .022uF the way it is (errr don't change R... C could vary from .1uF to .01uF), this prevents false triggering during power-up, by creating a virtual
short across the B-E junction of the PNP transistor.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
I really appreciate your help with the SCR diagram. I finally got some transistors and decided to build the SCR circuit.
I did noticed an oddity; when I connected an LED to the SENSE pin of the circuit, the LED will be on after the TRIGGER goes high but it will not turn off when the RESET pin goes high. When I connected the circuit to my Stamp, it worked as expected.
Below, is the code I used to check the circuit:
While studying your diagram, I believed it's possible to use the same pin in Basic Stamp to be the SENSE and the RESET?
Again, thanks.
SCR's are funny when you are trying to turn them off.... they basically don't want to. Connecting a LED to the SENSE pin probably allowed enough of a path to VSS that the
SCR was not able to turn completely off. If you want an LED indicator, put it in series with the SET/RESET pin.
As far as using the same stamp pin for the SENSE and RESET.... This would not work since the SENSE pin needs to be an INPUT to the stamp, and the SET/RESET is actually
supplying VSS to the SCR. By making the SET/RESET pin HIGH you are supplying +5V to the SCR's ground, this effectively turns off the SCR - "RESET" ...Making this pin LOW
again, the SCR is "SET" and ready for a trigger.
Now, you could interchange these two pins, but one needs to be an OUTPUT supplying power/ground to the SCR, while the other needs to be an INPUT.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
With POLLRUN, the program will break out of slot 0 and into slot 1 immediately, between two Stamp instructions, when the event occurs. Sometimes, some programs, the interruption might occur at a bad time in the middle of other tasks. Maybe that isn't a problem here.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com