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.

I'm trying to compile this but it shows error

Status
Not open for further replies.

jair_ie

New Member
Hi im trying to compile this program in PBP 2.33 but i show this errors
'Undefined symbol T2CON"
'Undefined symbol ADCON1"
'Undefined symbol TRISC'

CAN ANYBODY TELL me whats wrong.?
It is for a PIC 16F873

The program is this

Include "bs1defs.bas"

rdy var porta.0
ird var porta.1
iri var porta.2
estop var porta.3
sen var porta.4
maskh var byte
maskl var byte
bird var bit
biri var bit
b2ird var bit
b2iri var bit
datos var portb
dir var byte
f var byte
badela var bit
beuno var bit
bedos var bit

f=25000
trisa = %00010001
trisb = %11111111
T2CON=%00000111
ADCON1=%00000110
trisc = 0
PR2=%11111111

inicio: maskl=portb &%00001111 'cojo las unidades que salen del recono.
maskh=portb &%11110000 'ahora las decenas
if maskl=6 and maskh!=%01100000 then vaya 'miro si dijeron NACHO
if badela=1 then goto esquiv
gosub eli 'rutinas de IR
gosub eld
pause 10
goto inicio

eli: freqout iri,100,f 'emito por el IRi
if sen=0 then alto
return 'vuelvo a donde llamaron la rutina

eld: freqout ird,100,f
if sen=0 then alto
return

vaya: pause 200
maskh=portb &%11110000
if maskh=%01010000 then inicio
maskl=portb &%00001111
branch maskl,[inicio,izq,der,adela,atras,alto] 'escoge para donde ir
gosub eli
gosub eld
goto vaya

esquiv: freqout iri,100,f 'emito IR por izq
if sen=0 then
beuno=1 'si el sensor es 0
goto der 'vaya derecha y b1=1
else
beuno=0 'sino b1=0
endif
freqout ird,100,f 'emito por dere
if sen=0 then
bedos=1 'si sensor=0 entonces bedos=1
goto izq 'dele pa la iq\zquierda
else
bedos=0 'si no b2=0
endif
goto inicio

alto: badela=0
estop=1
CCP1CON=%00000000
CCP2CON=%00000000
pause 200
goto inicio

adela: estop=0
CCP2CON=0
CCP1CON=0
CCPR2L=%00110101
CCP2CON=%00001100
pause 20
CCPR1L=%01111101
CCP1CON=%00001100
pause 200 'activo los servos, y prendo la rutina
badela=1 'de esquivar
goto vaya 'espero nueva direccion


atras: badela=0
estop=0
CCP2CON=0
CCP1CON=0
CCPR2L=%01111101
CCP2CON=%00001100
pause 20
CCPR1L=%00110101
CCP1CON=%00001100
pause 200
goto vaya

izq: badela=0
estop=0
CCP2CON=0
CCP1CON=0
CCPR1L=%01111101
CCP1CON=%00001100
pause 200
if bedos=1 then 'miro si vengo de esquivar
freqout ird,100,f 'emito de nuevo
if sen=0 then 'si de nuevo hay obstaculo
goto izq 'le doy pa la izquierda
else
goto adela 'si no, pa lante
endif
endif
if bedos=0 then goto vaya 'si no vengo de esquivar espero nueva orden

der: badela=0
estop=0
CCP2CON=0
CCP1CON=0
CCPR2L=%00110101
CCP2CON=%00001100
pause 200
if beuno=1 then
freqout iri,100,f
if sen=0 then
goto der
else
goto adela
endif
endif
if beuno=0 then goto vaya
end
 
Pic Basic Pro compiles for the pic16f84 by default...
Since the 16f84 doen't have a ADCON,... it is not defined and the compiler doesn't know it

To compile for a diffirent mcu use the command line:

PBP -cpu filename.bas

For example

PBP -p16f877 filename.bas
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top