Hi All ,
i have a problem with this program , i'm using proton picbasic .
my problem is this program is working well with motors but it doesn't take effect and stop when my sensors dectect something.
although i'm writing the program to check if there are anything in front of it and if not it continue , but if anything appears it should stop , but it doesn't ,
note : the ultrasonic signal is about 2.5 volts , is it enough?
i'm using ultrasonic detectors and pic 16f877
please read it and tell me what's wrong
Device = 16f877
XTAL = 4
ADCON1 =7
IF PORTC.3=1 THEN STOP ;check for the right sensor
IF PORTA.5=1 THEN STOP ;check for the left sensor
MAIN:
IF PORTC.3=1 THEN STOP ;check again
IF PORTA.5=1 THEN STOP ;check again
HIGH PORTB.5 ;go forward
HIGH PORTB.6 ;go forward
IF PORTC.3=1 THEN GOTO STOP ;check for the right sensor
IF PORTA.5=1 THEN GOTO STOP ;check for the left sensor
STOP:
LOW PORTB.5 ;stop the motors
LOW PORTB.6 ;stop the motors
DELAYMS 2000
HIGH PORTB.7 ;go reverse for 2 seconds
HIGH PORTB.4 ;go reverse for 2 seconds
DELAYMS 2000
LOW PORTB.5 ;stop
LOW PORTB.6
HIGH PORTB.5 ;turn for 1.5 second
HIGH PORTB.7 ;turn for 1.5 second
DELAYMS 1500
LOW PORTB.5 stop
LOW PORTB.7 stop
GOTO MAIN