Hi to all, I have a wee problem that i just cant figure out.
motor:
pause 1000 ;WAIT 1 SEC BEFORE START
let pins= %10000000 ;MOTOR STARTS ON O/P 7
if pin 6 = 1 then stall ;RECORD MICROSWITCH HIT, JUMP TO STALL
goto motor ;OR ELSE KEEP MOTOR RUNNING
stall:
let pins= %00000000 ;MOTOR OFF
pause 500 ;WAIT 1/2 SEC
let pins= %11000000 ;MOTOR 1 ON, 2 ON (WIRED TO REVERSE)
pause 2000 ;TURN FOR 2 SECS
let pins= %00000000 ;MOTORS OFF
pause 500 ;WAIT 1/2 SEC
goto motor ;START FROM BEGINNING
Here's the wee problem. when the microswitch gets a hit, it goes high, however, there is about a 1 second delay befor the program jumps to stall, i can only assume this is due to switch bounce. I have read the manual and it suggests a pause 100 delay, to de-bounce the switch. I need the pause 100 delay to come in as soon as the if....then part of the program receives a hit, but i'm pulling out what little hair i have left, to get it to work. Can anyone help before i go completely bald (not far to go). Rather than give me the code at this stage, it would be good to just give me a clue ( as YLP88 often does ) and let me try and work it out. The clue should not be " Find a shop in yellow pages that sells wigs " Many thanks in advance, almostbaldbill.
 
Edited by - wildbill on 1/20/2006 1:13:33 AM
motor:
pause 1000 ;WAIT 1 SEC BEFORE START
let pins= %10000000 ;MOTOR STARTS ON O/P 7
if pin 6 = 1 then stall ;RECORD MICROSWITCH HIT, JUMP TO STALL
goto motor ;OR ELSE KEEP MOTOR RUNNING
stall:
let pins= %00000000 ;MOTOR OFF
pause 500 ;WAIT 1/2 SEC
let pins= %11000000 ;MOTOR 1 ON, 2 ON (WIRED TO REVERSE)
pause 2000 ;TURN FOR 2 SECS
let pins= %00000000 ;MOTORS OFF
pause 500 ;WAIT 1/2 SEC
goto motor ;START FROM BEGINNING
Here's the wee problem. when the microswitch gets a hit, it goes high, however, there is about a 1 second delay befor the program jumps to stall, i can only assume this is due to switch bounce. I have read the manual and it suggests a pause 100 delay, to de-bounce the switch. I need the pause 100 delay to come in as soon as the if....then part of the program receives a hit, but i'm pulling out what little hair i have left, to get it to work. Can anyone help before i go completely bald (not far to go). Rather than give me the code at this stage, it would be good to just give me a clue ( as YLP88 often does ) and let me try and work it out. The clue should not be " Find a shop in yellow pages that sells wigs " Many thanks in advance, almostbaldbill.
 
Edited by - wildbill on 1/20/2006 1:13:33 AM