Question: bsII, checking inputs.
Archiver
Posts: 46,084
hi
this is what i like to do
i like to program a vending machine
if a coin is inserted (controlling a switch) a lamp must burn for 30
minutes
but if the lamp 10 minutes burn , another coin is inserted, the lamp
must burn 30-10=20 + 30 =50 minutes.
it is also possible to insert 2 coins in a row
so what's my problem?
during the "in use" time i find it hard to check the switch.
when i check the switch in a loop with a little pause sometimes i mis
a inserted coin and when i make the loop faster the loop must run
very many times
i like to do this with as less hardware as possible .
thanks a lot
martin van dijk (Holland)
this is what i like to do
i like to program a vending machine
if a coin is inserted (controlling a switch) a lamp must burn for 30
minutes
but if the lamp 10 minutes burn , another coin is inserted, the lamp
must burn 30-10=20 + 30 =50 minutes.
it is also possible to insert 2 coins in a row
so what's my problem?
during the "in use" time i find it hard to check the switch.
when i check the switch in a loop with a little pause sometimes i mis
a inserted coin and when i make the loop faster the loop must run
very many times
i like to do this with as less hardware as possible .
thanks a lot
martin van dijk (Holland)
Comments
latches the gate... once the stamp reads the state it clears the latch for
the next coin. as long as you are polling fast enough you should be ok. A
quad latch is available (74XXX serries dont remember the part right now) for
about $0.79 and in a DIP14.
MH
Original Message
From: <eurogames20@z...>
To: <basicstamps@yahoogroups.com>
Sent: Wednesday, March 28, 2001 3:41 AM
Subject: [noparse][[/noparse]basicstamps] Question: bsII, checking inputs.
> hi
>
> this is what i like to do
> i like to program a vending machine
> if a coin is inserted (controlling a switch) a lamp must burn for 30
> minutes
> but if the lamp 10 minutes burn , another coin is inserted, the lamp
> must burn 30-10=20 + 30 =50 minutes.
> it is also possible to insert 2 coins in a row
>
> so what's my problem?
>
> during the "in use" time i find it hard to check the switch.
> when i check the switch in a loop with a little pause sometimes i mis
> a inserted coin and when i make the loop faster the loop must run
> very many times
>
> i like to do this with as less hardware as possible .
>
> thanks a lot
> martin van dijk (Holland)
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
If you wait in a whole bunch of little bits instead of all at once you can do
it without any hardware.
What I do is: enter a loop.
Pause 1 ms.
Check the input(s)
Increment the counter.
If it reaches the time limit (in milliseconds adjusted for the routine)
Exit or return to the loop.
Here is a sample of code from a machine controller program.
Motion_Wait_PAC_500:
'
if PAC_Motion_In = 0 then Run_500
TMR1 = TMR1 + 1
pause 1
if TMR1 > 30000 then PAC_Misfire
if Plasma_Stop = 0 then PAC_500_Off
goto Motion_Wait_PAC_500
This way you can wait and look for other inputs at the same time.[/font]