One shot event coding/capability
PCB4U
Posts: 14
Hi Folks
I'd like to use the STAMP to monitor 6 discretes. At any time, a one shot may occur at any of the 6 inputs and I'd like to set an ouptut to be HI until I do a manual reset. I'm concerned the STAMP will set the output LO once the one shot is gone.
My original circuit has a latching relay but the idea of a relay being on for days led me to go to the STAMP.
...or is there a way to go via chips that once the one shot is seen and returns LO, a HI is set and stays that way until I do a manual reset?
Thanks for any ideas
Jay
·
I'd like to use the STAMP to monitor 6 discretes. At any time, a one shot may occur at any of the 6 inputs and I'd like to set an ouptut to be HI until I do a manual reset. I'm concerned the STAMP will set the output LO once the one shot is gone.
My original circuit has a latching relay but the idea of a relay being on for days led me to go to the STAMP.
...or is there a way to go via chips that once the one shot is seen and returns LO, a HI is set and stays that way until I do a manual reset?
Thanks for any ideas
Jay
·
Comments
...................... At any time, a one shot may occur at any of the 6 inputs and I'd like to set the appropriate ouptut (6) to be HI until I do a manual reset.
Thanks
Jay
If IN0 = 1 THEN
HIGH (Output)
etc...
IF IN1 = 1 THEN 'Button pressed
LOW (Output)
etc...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
D Faust
HIGH 1
INPUT 2
buttoncount VAR Byte
waitcount·· VAR Word
DO
· DO WHILE IN2=0
··· PAUSE 10 'delay for testing - not necessary
··· DEBUG HOME,?buttoncount,?waitcount
··· waitcount=waitcount+1
· LOOP
· buttoncount=buttoncount+1
· DEBUG HOME,?buttoncount
· PAUSE 500
· PULSOUT 1,10 'reset latch
LOOP
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Have Fun
TR
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
So if I understand it...your idea is to use a 555 as a latch for an input to the STAMP which when triggered will stay HI until a manual reset.
The PAUSE is good if I understand the code in that it allows a dead time (settling time I think the phrase is) before setting the oputput HI
I would have to nest some code since I will be monitoring 6 inputs...right?
.
.
.
But couldn't I just the use the 555 as a latch for each of the 6 discetes and let the 555 drive a LED and not use a STAMP?
But the PAUSE is needed...maybe I could use another time to create a 15 second delay than hit the 555 circuit you drew up
Be sure your input switches have pull-up resistors to Vss, and when activated it·makes connection to Vdd (active-high configuration)
-Martin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
StampPlot - GUI and Plotting, and XBee Wireless Adapters
Southern Illinois University Carbondale, Electronic Systems Technologies
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Have Fun
TR
Thats interesting. I need 6 LEDs to show which input created the one shot. How woudl INL·work to set the appropriate output HI?
-Martin
Here is a variation that turns on LEDs for all events that happen, that is, if event on p3 happens and then the event on p1, then both LEDs will come on and stay on.
The code that Martin posted latches the first event that happens, and then locks out all others. (Typo, the OUTH=$FF should be DIRH=$FF).
It all depends in detail on what needs to happen.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Thanks much for the input.
My requirements are nested and maybe you can help me along with this. Not only is a scan of 6 signals required but I must determine a 7th signal for a·TRUE/FALSE state after which· I can set the appropriate output to power down a circuit if the 7th signal is deemed TRUE. If the 7th signal is deemed FALSE (all is well), return to scanning the 6 discretes.
The 7th signal needs to be analyzed after·a 15·second delay·to determine its true state (need settling time).
Hi Level Flow
GIVEN: Only one discrete will be active·during any time interval. There will be no case where 2 or more discretes will be active at the same time.
1. Scan 6 inputs to determine which one is·active (TRUE). If none are TRUE, loop back and continually scan the 6 discretes until a·TRUE is detected. A 100ms delay needs to be incorporated as it scans from one input to the next input. I just discoverd some settling time problems (relays)
2. When·a·TRUE is detected in the 6 discretes,·we now know which circuit is active. Store which input pin detected the TRUE.
3. Now jump to another procedure to validate the 7th Signal
4. In the new procedure for the 7th signal, first allow a 15·second delay·for the signal to settle before verifying its TRUE or FALSE state
5. If the 7th signal is TRUE, output the applicable output pin associated with the 6 discrete input signals as determined by the data stored in (2) above·(e.g. IN1 = OUT8, IN2 = OUT9, etc).
6. If the 7th signal is FALSE,·return to (1) above and start scanning the 6 discetes again.
I'm a pretty poor programmer so any help by·yourself and all in the forum is indeed welcome.
I did use the Stamp chip a few years back to convert some RS232 data·so I could switch differnet relays to control differnt circuits based on the RS232 stream. I do recall the nightmare·
Thanks to all
Jay
·······
·······
····
···
Post Edited (PCB4U) : 6/30/2007 9:20:45 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
In the statement
DO·:·LOOP·UNTIL·INL···'·wait·for·input
Does the INL statement·take a snapshot at p0 thru p5 at one time (looks at low byte...in this case every 100ms)?
I really appreciate your assistance and patience
Jay
That loops very fast, on the order of 1000 times per second, and each time it takes a snapshot of all of the inputs and drops out of the loop if any of them goes high. Subsequently, the program has a 100 millisecond delay and then tests the inputs again to be sure the same one is still active.
You might want to include only pins p0 to p5 in the test, and also a little delay between samples, like this:
DO : PAUSE 9 : LOOP UNTIL INL & $3F ' wait for input on p0 to p5, sample interval about 10 milliseconds
Note that
... UNTIL INL & $3F
is shorthand for
... UNTIL INL & $3F > 0
It does not need the > 0, because any nonzero value evaluates as "TRUE".
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
How will INL associate·to INH?
In the schematic attached, I'd like the input/output relationship (keeps flow logical) as follows:
IN····· OUTPUT SET
p0
>p15
p1
>p14
p2
>p13
p3
>p12
p4
>p11
p5
>p10
Thanks once again
Jay
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
D Faust
>> A 100ms delay needs to be incorporated as it scans from one input to the next input. I just discoverd some settling time problems (relays)
Especially the settling time problems (relays). I thought you were talking about contact bounce, no?
Here is the program again with small changes. The OUTH is associated with INH in the next to last line of the program, after the label "makeDo". I changed it to match what you have in your schematic. We had been associating output p8 with p0, p9 with p1 and so on. But in your schematic you have p15 with p0, p14 with p1 and so on, so the program employs the REV instruction to reverse the order of the logical bits.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com