Hi everyone, im making the PIC-Based, Obstacle-Avoiding Robot that i found in this page. I got some errors at making the assembly program. Here’s the code, i made it exactly the way it says on this forum.
List p=16f628A
#INCLUDE "P16F628A.INC"
__Config 3D28
;******Equivalencias*******************
Bank0RAM equ 020h ;empieza en banco 0 del area en RAM
SMC_PORT equ PORTB ;controlador del motor en puerto b
BMP_PORT equ PORTB ;interruptores de parachoques en puerto b
;Equivalencias en bits
SOUT equ 2 ;salida serial para el controlador de motor
SRST equ 3 ;para reiniciar pin en el controlador de motor
LBMP equ 4 ;interruptor de parachoques izquierdo
RBMP equ 5 ;interruptor de parachoques derecho
;******Variables*********
cblock Bank0RAM
ARG1L
ARG1H
BYTE3 ;para almacenar bytes 3 y 4 en el protocolo serial
BYTE4
endc
;*****Subrutinas********
milliDelay
movlw .250 ;bucle externo
addlw 0XFF ;bucle interno
btfss STATUS,Z
goto $-2 ;ve al bucle interno
movlw 1 ;16-bit decremento
subwf ARG1L,f
btfss STATUS,C
decf ARG1H,f
movf ARG1H,f ;16-bit si es cero
btfsc STATUS,Z
movf ARG1L,f
btfsc STATUS,Z
return
goto milliDelay
;******Programa principal*********
org 0X05
startMain
;configura los puertos I/O y el puerto serial para 19,200 baundios UART
bsf STATUS,RP0
movlw b'11110111' ;smc reset es el unico normal
movwf TRISB
bcf OPTION_REG,NOT_RBPU
;activa los resistores del puerto B
movlw .12
movwf SPBRG ;direccion 99h
movlw b'00100100' ;bit 6 clear - 8-bit transmision
;bit 5 set - habilita transmision
;bit 4 set - UART modo ascincrono
;bit 2 set - alto baudios modo
;bit 7,3,1,0 - no importa
movwf TXSTA ;direccion 98h
bcf STATUS,RP0 ;banco 0
movlw b'10010000' ;bit 7 set - habilita puerto serial
;bit 6 clear - 8-bit recepcion
;bit 4 set - recibimiento continuo
;bits 5,3:0 - no importa
movwf RCSTA ;direccion 18h
;resetear el controlador de motor
bcf SMC_PORT,SRST
nop
nop
bsf SMC_PORT,SRST
movlw 0X00
movwf ARG1H
movlw 0X02
movwf ARG1L
call milliDelay
mainLoop
btfss BMP_PORT,LBMP
goto left_bump
btfss BMP_PORT,RBMP
goto right_bump
;no hay colision, sigue derecho
movlw 0X00 ;motor derecho sigue adelante
movwf BYTE3
movlw 0X7F ;Maxima velocidad
movwf BYTE4
call updateMotor
movlw 0X02 ;motor derecho sigue adelante
movwf BYTE3
movlw 0X7F ;maxima velocidad
movwf BYTE4
call updateMotor
goto mainLoop
left_bump
call pause
movlw 0x03 ;motor derecho, hacia atras
movwf BYTE3
movlw 0X7F ;maxima velocidad
movwf BYTE4
call updateMotor
movlw 0X01 ;motor izquierdo, hacia atras
movwf BYTE3
movlw 0X3F ;velocidad media
movwf BYTE4
call updateMotor
movlw HIGH .1500 ;pausa 1.5 segundos
movwf ARG1H
movlw LOW .1500
movwf ARG1L
call milliDelay
call pause
goto mainLoop
right_bump
call pause
movlw 0X03 ;motor derecho, hacia atras
movwf BYTE3
movlw 0X3F ;velocidad media
movwf BYTE4
call updateMotor
movlw 0X01 ;motor izquierdo, hacia atras
movwf BYTE3
movlw 0X7F ;maxima velocidad
movwf BYTE4
call updateMotor
movlw HIGH .1500
movwf ARG1H
movlw LOW .1500
movwf ARG1L
call milliDelay
call pause
goto mainLoop
updateMotor
btfss PIR1,TXIF
goto updateMotor
movlw 0X80
movwf TXREG
nop
updateMotor2
btfss PIR1,TXIF
goto updateMotor2
movlw 0X00
movwf TXREG
nop
updateMotor3
btfss PIR1,TXIF
goto updateMotor3
movf BYTE3,W
movwf TXREG
nop
updateMotor4
btfss PIR1,TXIF
goto updateMotor4
movf BYTE4,W
movwf TXREG
return
pause
movlw 0X02 ;motor derecho apagado
movwf BYTE3
movlw 0X00
movwf BYTE4
call updateMotor
movlw 0X00 ;motor izquierdo apagado
movwf BYTE3
movlw 0X00
movwf BYTE4
call updateMotor
movlw HIGH .50 ;pausa 0.05 segundos (50 ms)
movwf ARG1H
movlw LOW .50
movwf ARG1L
call milliDelay
return
END
Here are the errors i got
I dont know why im getting these errors, I think i colocated labels, operations, operands and comments correctly
PLease help mee! im new at this :d