LINE
FOLLOWR ROBOT BASED ON
PIC 16F84
By: toko-elektronika.com


PIC16F84A is a robust microcontroller that has a total of 18 pins. It is most frequently found in a DIP18 type of case but can also be found in SMD case which is smaller from a DIP. DIP is an abbreviation for Dual In Package. SMD is an abbreviation for Surface Mount Devices suggesting that holes for pins to go through when mounting, aren't necessary in soldering this type of a component.

Figure 1. IC PIC 16f84/PIC 16F84A
Pins on PIC16F84/PIC 16F84A microcontroller have the following
meaning:
Pin no.1 RA2 Second pin
on port A. Has no additional function.
Pin no.2 RA3 Third pin
on port A. Has no additional function.
Pin no.3 RA4 Fourth pin
on port A. TOCK1 which functions as a timer is also found on this pin.
Pin no.4 MCLR Reset input and Vpp
programming voltage of a microcontroller.
Pin no.5 Vss Ground of power supply.
Pin no.6 RB0 Zero pin
on port B. Interrupt input is an additional function.
Pin no.7 RB1 First pin
on port B. No additional function.
Pin no.8 RB2 Second pin
on port B. No additional function.
Pin no.9 RB3 Third pin
on port B. No additional function.
Pin no.10 RB4
Fourth pin on port B. No additional function.
Pin no.11 RB5
Fifth pin on port B. No additional function.
Pin no.12 RB6
Sixth pin on port B. 'Clock' line in program mode.
Pin no.13 RB7
Seventh pin on port B. 'Data' line in program mode.
Pin no.14 Vdd Positive
power supply pole.
Pin no.15 OSC2 Pin
assigned for connecting with an oscillator.
Pin no.16 OSC1 Pin
assigned for connecting with an oscillator.
Pin no.17 RA2 Second
pin on port A. No additional function.
Pin no.18 RA1 First
pin on port A. No additional function.
In this project, we developed Line follower robot with components:
1. DT PROTO PIC 16F84A
2. DT Hiq ICSP Programmer
3. 2 pair IR sensor
4. Driver DC Motor and Wheel
5. DC Motor (You may order all of the components in www.toko-elektronika.com).

figure 2. Main Circuit of line follower robot

Figure 3. Driver using IC L293D or transistor
Use MPLAB in the CD for edit and compile the program :

Figure 4. Editor and compiler using MPLAB
Use IC-Prog for upload program to the IC. Please read manual in CD.

Figure 5. IC Prog for uploading the program to the IC
Here is a complete program:
Tesp16f84.asm:
#include p16f84a.inc
start: bSf STATUS, RP0
movlw B'11110000'; 4 input 4 output
movwf TRISB
bCf STATUS, RP0
clrf PORTB
ulang: movlw B'000000101';maju sebentar
movwf PORTB
call delay
btfss PORTB,5 ;detect IR sensor left
call kiri ; call left function
btfss PORTB,6 ; detect IR sensor right
call kanan ;c all right function
goto ulang
kanan movlw B'000001000';kanan
movwf PORTB
call delay ;beri delay panjang
return
kiri movlw B'00000010';kiri
movwf PORTB
call delay ;beri delay panjang
return
delay: clrf 0x01
delay0: clrf 0x01
delay1: decfsz 0x01, 1
goto delay1
delay2: decfsz 0x11, 1
goto delay0
return
END
For sensitivity, please arrange position of sensor near the
floor and
References : www.microchip.com
and many other sites