Single Pulse Output with varying input pulse length - My Solution
DChap
Posts: 7
Hi all, great forum.
I have a need to generate a single pulse output of say 10 microseconds upon the receipt of an input.
I have tried several methods and because I am monitoring an input pin whose signal can be up to 50 milliseconds, my output is a series of 10 microsecond pulses for the duration of the input pulse length.
Basically what I need here is a One Shot.
For example, (BS2P-24)
DO
MAIN:
If IN0 = 0 THEN
PULSOUT 1, 85
DO
LOOP UNTIL IN0 = 1
ENDIF
LOOP
Shouldn't this generate 1 output pulse for each input regardless of how long the input pulse is?
Thanks
Don
Here is the code snipit that I have working the way I wanted:
DO
MAIN:
IF Set = 0 THEN MAIN
IF IN0 = 0 THEN
Set = 0
GOSUB FIRE
ENDIF
FIRE:
IF Set = 1 THEN Main
PULSOUT 4, 7000
DO UNTIL IN0 = 1
LOOP
Set = 1
GOTO MAIN
LOOP
I get my output upon receipt of an input LOW and I can control the output pulse width..
Thanks
Post Edited (DChap) : 2/3/2005 8:05:23 PM GMT
I have a need to generate a single pulse output of say 10 microseconds upon the receipt of an input.
I have tried several methods and because I am monitoring an input pin whose signal can be up to 50 milliseconds, my output is a series of 10 microsecond pulses for the duration of the input pulse length.
Basically what I need here is a One Shot.
For example, (BS2P-24)
DO
MAIN:
If IN0 = 0 THEN
PULSOUT 1, 85
DO
LOOP UNTIL IN0 = 1
ENDIF
LOOP
Shouldn't this generate 1 output pulse for each input regardless of how long the input pulse is?
Thanks
Don
Here is the code snipit that I have working the way I wanted:
DO
MAIN:
IF Set = 0 THEN MAIN
IF IN0 = 0 THEN
Set = 0
GOSUB FIRE
ENDIF
FIRE:
IF Set = 1 THEN Main
PULSOUT 4, 7000
DO UNTIL IN0 = 1
LOOP
Set = 1
GOTO MAIN
LOOP
I get my output upon receipt of an input LOW and I can control the output pulse width..
Thanks
Post Edited (DChap) : 2/3/2005 8:05:23 PM GMT
Comments
Or in this case a 'monostable mulitvibrator'...
http://focus.ti.com/docs/prod/folders/print/sn74121.html
Bean.
So:
InState VAR NIB
MAIN:
InState = 0
CheckClosed:
IF IN0 = 0 THEN
InState = InState + 1
ELSE
InState = 0
END IF
IF InState = 4 THEN IsClosed 'ie read switch until you get 4 reads of 'closed'
PAUSE 1
GOTO CheckClosed
IsClosed: ' Got 4 reads of closed. It really is closed.
PULSOUT 1, 85
InState = 0
CheckOpen:
IF IN0 = 1 THEN
InState = InState + 1
ELSE
InState = 0
END IF
IF InState = 4 THEN Main 'ie read switch until you get 4 reads of 'open'
PAUSE 1
GOTO CheckOpen
I will be looking at a train of cars on a track using a Banner world Beam NPN sensor. (No Switch Bounce)
The low going signal from this sensor will go to Pin0 as an input. When each car breaks the beam I will get an input.
I need to pass this signal out to an external device immediately on the falling edge of the signal, then ignore it for the remainder of the time it is low.
This total LOW time from the sensor is going to be all over the place as no two trains I will be looking at have the same physical dimensions or are traveling at the same speed.
Thanks much
Don
How important will a missed high be? You could just:
main:
if IN0=0 then train
pause 1
go to main
train:
PULSOUT whatever
trainwait:
if IN0=1 then main
pause 1
go to trainwait
Jim
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
League Bowling.... it's not a sport, it's a way of life
A missed high is no big deal - I cannot miss any of the lows.
Still playing..
Don
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
League Bowling.... it's not a sport, it's a way of life
I'll have to give this some more thought. I cannot tie up the stamp in a loop.
I may have to use two stamps to do what I want.
More thought...
Thanks
Don