Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Robotics Chat


Robotics Chat Specific to discussions about robots and the making of.

Reply
 
Tools
Old 19th August 2005, 09:42 PM   #1
Default Line follower program

Having problems with creating a LF program for my bot. I got an example from the net (Linbot) and tried to modify it to work for me. But I'm using 3 sensors instead of 4 so I'm guessing there's something about SENSOR_REG that I have missed or overlooked. Probably wrong bits or something... Any ideas?

Code:

CLRF SENSOR_REG       
MOVF L_AD_REG,W
SUBWF VR_AD_REG,W
BTFSC STATUS,C
BSF SENSOR_REG,0       

MOVF C_AD_REG,W
SUBWF VR_AD_REG,W
BTFSC STATUS,C
BSF SENSOR_REG,1

MOVF R_AD_REG,W 
SUBWF VR_AD_REG,W
BTFSC STATUS,C
BSF SENSOR_REG,2



MOVLW B'00000111'  
ANDWF SENSOR_REG,W  
ADDWF PCL   
GOTO NO_LINE   
GOTO LEFT_LINE  
GOTO CENTER_LINE  
GOTO LEFT_CENTER_LINE 
GOTO RIGHT_LINE  
GOTO NUL_LINE   
GOTO RIGHT_CENTER_LINE 
GOTO CENTER_LINE
__________________
Here...let me improve it for you!

*Puff of smoke* ....oops...
raitl is offline  
Old 23rd August 2005, 01:16 AM   #2
Default

does the program compile?
__________________
when you post that reply, im just kidding.
danielsmusic is offline  
Old 23rd August 2005, 09:24 PM   #3
Default

compiles fine and even works when covering left sensor.

And would like to post another question without making a new topic... how do I change first 4 or last 4 bits of a port? Controlling two stepper motors with PORTB and would like to give the steppers different speeds via changing the pause between steps. That means I need to change one motor status without touching the other... can't figure this out...
__________________
Here...let me improve it for you!

*Puff of smoke* ....oops...
raitl is offline  
Old 24th August 2005, 03:07 PM   #4
Default

http://www.electro-tech-online.com/v...ic.php?t=3573&
Exo is offline  
Reply

Tags
follower, line, program

Thread Tools
Display Modes




All times are GMT. The time now is 02:11 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker