I wondered what happened to my program
anyone here knows on PicBasicPro compiler?
I used PicBasic Pro to Program my PIC, but at first my vehicle works fine with that program, but later on, the PIC just couldnt work at all.
this is the program
cl var byte
trisb = 224 'port5,port6,port7 input
start:
Low portb
cl = portb
'cl.5 is from left sensor
'cl.6 is from center sensor
'cl.7 is from right sensor
if cl.5 = 1 and cl.7 = 0 and cl.6=1 then left
if cl.5 = 1 and cl.7 = 0 and cl.6=0 then left
if cl.6 = 1 and cl.5 = 0 and cl.7=0 then straight
if cl.5 = 0 and cl.7 = 1 and cl.6=0 then right
if cl.5 = 0 and cl.7 = 1 and cl.6=1 then right
if cl.5 = 0 and cl.6 = 0 and cl.7=0 then stationary
'portb.4 is controlling left motor
'portb.3 is controlling right motor
stationary:
low portb.4
low portb.3
low portb.2
goto start
left:
Low PORTB.4
High PORTB.3
pause 500
high PORTB.2
pause 100
low PORTB.2
goto start
right:
High PORTB.4
LOw PORTB.3
pause 500
high PORTB.2
pause 100
low PORTB.2
goto start
straight:
LOw PORTB.3
LOw PORTB.4
high PORTB.2
goto start
this program was working at first, but now i doesnt know what happened to the PIC even i had changed with a new PIC
Murphy law just happens any time. I project presentation is drawing closer and a lot of things do not seem right.
The PIC cant give output signals.
anyone here knows on PicBasicPro compiler?
I used PicBasic Pro to Program my PIC, but at first my vehicle works fine with that program, but later on, the PIC just couldnt work at all.
this is the program
cl var byte
trisb = 224 'port5,port6,port7 input
start:
Low portb
cl = portb
'cl.5 is from left sensor
'cl.6 is from center sensor
'cl.7 is from right sensor
if cl.5 = 1 and cl.7 = 0 and cl.6=1 then left
if cl.5 = 1 and cl.7 = 0 and cl.6=0 then left
if cl.6 = 1 and cl.5 = 0 and cl.7=0 then straight
if cl.5 = 0 and cl.7 = 1 and cl.6=0 then right
if cl.5 = 0 and cl.7 = 1 and cl.6=1 then right
if cl.5 = 0 and cl.6 = 0 and cl.7=0 then stationary
'portb.4 is controlling left motor
'portb.3 is controlling right motor
stationary:
low portb.4
low portb.3
low portb.2
goto start
left:
Low PORTB.4
High PORTB.3
pause 500
high PORTB.2
pause 100
low PORTB.2
goto start
right:
High PORTB.4
LOw PORTB.3
pause 500
high PORTB.2
pause 100
low PORTB.2
goto start
straight:
LOw PORTB.3
LOw PORTB.4
high PORTB.2
goto start
this program was working at first, but now i doesnt know what happened to the PIC even i had changed with a new PIC
Murphy law just happens any time. I project presentation is drawing closer and a lot of things do not seem right.
The PIC cant give output signals.