Autor Tema: AYUDA PIC 16F877A COMPARADOR  (Leído 1450 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado Kaferartz

  • PIC10
  • *
  • Mensajes: 1
AYUDA PIC 16F877A COMPARADOR
« en: 22 de Septiembre de 2020, 18:01:41 »
Necesito ayuda con un programa de un PDF, tengo que arreglarlo pero no encuentro el error.
Al momento de compilar salen varios errores que no comprendo

Message[301] C:\PROGRAM FILES (X86)\MICROCHIP\MPLABX\V5.35\MPASMX\P16F877.INC 34 : MESSAGE: (Processor-header file mismatch.  Verify selected processor.)
Warning[207] ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 4 : Found label after column 1. (CONF_ADCON1)
Warning[207] ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 5 : Found label after column 1. (DATO_A)
Warning[207] ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 6 : Found label after column 1. (DATO_B)
Warning[205] ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 8 : Found directive in column 1. (org)
Message[302] ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 15 : Register in operand not in bank 0.  Ensure that bank bits are correct.
Message[302] ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 17 : Register in operand not in bank 0.  Ensure that bank bits are correct.
Message[302] ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 20 : Register in operand not in bank 0.  Ensure that bank bits are correct.
Error[113]   ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 38 : Symbol not previously defined (EVALUA1)
Error[113]   ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 40 : Symbol not previously defined (ESCRIBE)
Error[113]   ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 40 : Symbol not previously defined (EVALUA1)
Error[112]   ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 40 : Missing operator
Error[113]   ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 42 : Symbol not previously defined (EVALUA2)
Error[113]   ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 44 : Symbol not previously defined (ESCRIBE)
Error[113]   ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 44 : Symbol not previously defined (EVALUA2)
Error[112]   ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 44 : Missing operator
Warning[205] ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 49 : Found directive in column 1. (END)
make[2]: Leaving directory 'C:/Users/HOGAR/MPLABXProjects/EJERCICIO4.X'
make[1]: Leaving directory 'C:/Users/HOGAR/MPLABXProjects/EJERCICIO4.X'
make[2]: *** [nbproject/Makefile-default.mk:111: build/default/production/_ext/1773727881/Ejercicio4.o] Error 1
make[1]: *** [nbproject/Makefile-default.mk:91: .build-conf] Error 2
make: *** [nbproject/Makefile-impl.mk:39: .build-impl] Error 2

BUILD FAILED (exit value 2, total time: 1s)


CODIGO

list p=16F877
    include "p16f877.inc"
   
    CONF_ADCON1 EQU b'00000110' ; PA como puerto digital
    DATO_A EQU 0x20 ; Dato A
    DATO_B EQU 0x21 ; Dato B

org 0x000 ; Origen del codigo 
    nop ; No operacion
    nop ; No operacion   
    bsf STATUS,RP0 ; Ir banco 1
    bcf STATUS,RP1     

    movlw CONF_ADCON1 ; Configurar el PORTA como digital
    movwf ADCON1
    movlw 0xFF ; PORTB como entrada
    movwf TRISB   

    movlw 0x00 ; PORTA como salida
    movwf TRISA
    bcf STATUS,RP0 ; Ir banco 0
    bcf STATUS,RP1 

BUCLE 
    movf PORTB,W ; W=PORTB
    movwf DATO_A ; RAM[DATO_A]=W
    movwf DATO_B ; RAM[DATO_B]=W   

    swapf DATO_B,F ; Invertimos los nibles Ej: si 0xA5 => 0x5A
    movlw 0x0F ; W=0x0F
    andwf DATO_A,F ; RAM[DATO_A]= 0x0F AND RAM[DATO_A]
    andwf DATO_B,F ; RAM[DATO_B]= 0x0F AND RAM[DATO_B]   

    movf DATO_A,W ; W=RAM[DATO_A]
    subwf DATO_B,W ; W=RAM[DATO_B]-RAM[DATO_A](W)     

    btfsc STATUS,C ; ACARREO=0 SALTA
    goto EVALUA1
    movlw b'00000100' ; A>B => PB=100
    goto ESCRIBE EVALUA1 
    btfsc STATUS,Z ; CERO=0 SALTA
    goto EVALUA2
    movlw b'00000001' ; A>B => PB=001
    goto ESCRIBE EVALUA2
    movlw b'00000010' ; A=B => PB=010  ESCRIBE 
    movwf PORTA ; PA=Resultado
    goto BUCLE   

END ; Fin del programa



Desconectado KILLERJC

  • Colaborador
  • DsPIC33
  • *****
  • Mensajes: 8242
Re:AYUDA PIC 16F877A COMPARADOR
« Respuesta #1 en: 22 de Septiembre de 2020, 23:04:50 »
Hola Kaferartz, vi cerca de 3 post tuyos con casi lo mismo. Por lo que te diria que no vuelvas a postear de nuevo, el que postees varias veces no significa que vas a obtener una respuesta mas rapida.


Los errores son simples de ver....

Citar
Message[301] C:\PROGRAM FILES (X86)\MICROCHIP\MPLABX\V5.35\MPASMX\P16F877.INC 34 : MESSAGE: (Processor-header file mismatch.  Verify selected processor.)
Message[302] ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 15 : Register in operand not in bank 0.  Ensure that bank bits are correct.
Message[302] ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 17 : Register in operand not in bank 0.  Ensure that bank bits are correct.
Message[302] ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 20 : Register in operand not in bank 0.  Ensure that bank bits are correct.

Empezando por el primer mensaje, te dice que el  archivo inc que incorporaste con el include, pertenece a otro procesador que el usado en el proyecto, lo podes cambiar haciendo click derecho en el proyecto, y luego propiedades. Para darte un ejemplo el codigo usa un PIC16F877 y en el proyecto puede estar seleccionado PIC16F887, que son distintos micros, con disintas posiciones de memoria.
Los demas mensajes son solamente un recuerdo que los registros que estas usando no estan en el banco 0, por lo tanto deberias haber tomado la precaucion de cambiar los bancos antes.


Luego tenes Warning o para que te asegures que es correcto:

Citar
Warning[207] ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 4 : Found label after column 1. (CONF_ADCON1)
Warning[207] ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 5 : Found label after column 1. (DATO_A)
Warning[207] ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 6 : Found label after column 1. (DATO_B)
Warning[205] ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 8 : Found directive in column 1. (org)
Warning[205] ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 49 : Found directive in column 1. (END)

El numero que tenes luego del .ASM es la linea donde se encuentra el fallo ( lo marque en negrita).
ASM es estricto con las posiciones, si no pones un espacio o un tab al frente de donde definis DATO_A te va a decir que esta en la columna 1, espacio reservado unicamente para las etiquetas, se soluciona poniendo un tab. Ejemplo:

Código: ASM
  1. ;MAL
  2. DATO_A EQU 0x20 ; Dato A
  3. ;BIEN
  4.     DATO_A EQU 0x20 ; Dato A

Ahora si los errores:

Citar
Error[113]   ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 38 : Symbol not previously defined (EVALUA1)
Error[113]   ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 40 : Symbol not previously defined (ESCRIBE)
Error[113]   ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 40 : Symbol not previously defined (EVALUA1)
Error[112]   ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 40 : Missing operator
Error[113]   ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 42 : Symbol not previously defined (EVALUA2)
Error[113]   ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 44 : Symbol not previously defined (ESCRIBE)
Error[113]   ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 44 : Symbol not previously defined (EVALUA2)
Error[112]   ..\..\DOCUMENTS\FERNANDA\MPLAB\EJERCICIO4.ASM 44 : Missing operator

Veamos el primero apunta a la linea que dice goto EVALUA1 ,,, y la pregunta es ¿donde esta la etiqueta EVALUA1? para que hagas el GOTO ? Es une error que tuviste al copiarlo, en esta linea:

Código: ASM
  1. goto ESCRIBE EVALUA1

Donde es

Código: ASM
  1. goto ESCRIBE
  2. EVALUA1:

Al poner dos cosas y el goto solo admite una, te dice que falta un operador. Nada mas, arreglando cada uno de esos como lo hice estaria compilando. Los errores se encuentran en la linea 40 y 44

------------------------------

Si todo lo que te digo te parece Chino basico, te recomiendo que estudies ASM y empieces con programas mas basicos, corregirte el codigo es algo que NO voy a hacer, y considero para TU beneficio nadie lo haga.


 

anything