Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

line follower robot

Status
Not open for further replies.
i just want to share it , if someone searching for it
and also i fixing the code , changing it to 16F628 not 628A
the circuit and code originally posted on
Simple Black Line Follower
here is the fixed code
Code:
list p=16f628
#include<p16f628.inc>
__CONFIG _MCLRE_ON & _CP_OFF & _WDT_OFF & _INTRC_OSC_NOCLKOUT
ERRORLEVEL -302
cblock 0x20
temp
temp_s
endc
org  0x00
goto main
org 0X04
inter:
	movwf temp
	swapf STATUS,w
	clrf STATUS
	movwf temp_s
	btfsc PORTB,0x00
	goto loop1
loop2:
	movlw b'00000101'
	movwf PORTA
	btfsc PORTB,0x05
	goto loop2
	goto loop_x
loop1:
	movlw b'10001000'
	movwf PORTA
	btfsc PORTB,0x00
	goto loop1
loop_x
	bcf INTCON,0x01
	bcf INTCON,0x00
	swapf temp_s,w
	movwf STATUS
	swapf temp,w
	retfie
main:
	bsf INTCON,0x07 
	bsf INTCON,0x04
	bsf INTCON,0x03 
	bcf INTCON, 0x01
	bcf INTCON, 0x00 
	bsf STATUS,RP0 
	movlw b'00100001'
	movwf TRISB 
	movlw b'00000000'
	movwf TRISA 
	bcf STATUS,RP0
	movlw 0x07 
	movwf CMCON
Loop:
	movlw b'00001001'
	movwf PORTA ;set pin 0 of port a HIGH
	goto Loop
END
try to convert the code by yourself using mplab
and good luck :)
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top