TODOPIC
Microcontroladores PIC => Primeros pasos - Iniciación a los microcontroladores => Mensaje iniciado por: PROFE_FARFAN99 en 01 de Septiembre de 2021, 23:01:46
-
Hola
Esperando se encuentren bien , estoy tratando de desarrollar el programa del microcontrolador pic16f628A, pero me marca error el programa es el siguiente
LIST P=16F628A
#INCLUDE <P16F628A.INC>
__CONFIG _CP_OFF&_WDT_OFF&_BODEN_OFF&_PWRTE_ON&_INTOSC_OSC_NOCLKOUT&_DATA_CP_OFF&_LVP_OFF&_MCLRE_OFF
;Declaramos las variables de la rutina de la subrutina de retardo
DEL_1S EQU 0X20
DEL_1AS EQU 0X21
DEL_1AAS EQU 0X22
ORG 0H
Inicio
; CONFIGURAR LAS ENTRADAS Y SALIDAS
movlw b'00000111' ; Ponemos los ultimos 3 bits en 1 para que las entradas que pudieran ser analogicas sean digitales.
movwf CMCON ; Eso lo pasamos en el registro correspondiente para que las entradas sean digitales
bcf STATUS,IRP ;Estaria trabajando con el banco 0 y 1 (si quisiera el banco 3 y 4 seria bsf)
bcf STATUS,RP1
bsf STATUS,RP0 ; Acceso al banco 1 configurar (las entradas son 1 y las salidas son cero)
movlw b'11011111' ; Se colocan entradas , salvo RB5 que va a ser salida
movwf TRISB ; Solo vamos a tener una entrada por lo que solo RB5 va a ser salida
movlw b'11111111' ;Se configura todo el puerto A como entrada por eso ponemos 8 unos
movwf TRISA ; Se pasa ese valor de w al puerto A para que sean entradas
bsf PCON, OSCF ;Defino este bit pero no me deja me marca error en CONFIG
bcf STATUS,RP0 ; Camiamos de banco para iniciar el programa
CHECAR
btfsc PORTB, 5 ; Explora el bit 5 de el puerto B y salta la siguiente instrucción si es cero
call ENCENDERLED
call CHECAR
ENCENDERLED
movlw b'00000001' ;Para que se encienda el led
movwf PORTA ; Se visualiza en el purto de salida
call retardo
movlw b'00000000'
movwf PORTA ; Se visualiza en el purto de salida
call retardo
return
; SUBRUTINA DE RETARDO DE 1 SEGUNDO
retardo
DELAY_1S: MOVLW .14
MOVWF DEL_1S
DEL_111:MOVLW .72
MOVWF DEL_1AS
DEL_11:MOVLW .247
MOVWF DEL_1AAS
DEL_1:NOP
DECFSZ DEL_1AAS,1
GOTO DEL_1
DECFSZ DEL_1AS,1
GOTO DEL_11
DECFSZ DEL_1S,1
GOTO DEL_111
GOTO DEL_1FIN
DEL_1FIN:NOP
RETURN
END
Y a la hora que lo compilo me sale lo siguiente, no entiendo porque el error
Release build of project `C:\Users\Armando\Desktop\PRUEBA PIC 16F628A\PIC16F628A.disposable_mcp' started.
Language tool versions: MPASMWIN.exe v5.51, mplink.exe v4.49, mplib.exe v4.49
Wed Sep 01 20:58:43 2021
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\Program Files (x86)\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F628A "PIC16F628A.ASM" /l"PIC16F628A.lst" /e"PIC16F628A.err"
Error[113] C:\USERS\ARMANDO\DESKTOP\PRUEBA PIC 16F628A\PIC16F628A.ASM 3 : Symbol not previously defined (_DATA_CP_OFF)
Warning[207] C:\USERS\ARMANDO\DESKTOP\PRUEBA PIC 16F628A\PIC16F628A.ASM 6 : Found label after column 1. (DEL_1S)
Warning[207] C:\USERS\ARMANDO\DESKTOP\PRUEBA PIC 16F628A\PIC16F628A.ASM 7 : Found label after column 1. (DEL_1AS)
Warning[207] C:\USERS\ARMANDO\DESKTOP\PRUEBA PIC 16F628A\PIC16F628A.ASM 8 : Found label after column 1. (DEL_1AAS)
Warning[207] C:\USERS\ARMANDO\DESKTOP\PRUEBA PIC 16F628A\PIC16F628A.ASM 12 : Found label after column 1. (Inicio)
Message[302] C:\USERS\ARMANDO\DESKTOP\PRUEBA PIC 16F628A\PIC16F628A.ASM 21 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\USERS\ARMANDO\DESKTOP\PRUEBA PIC 16F628A\PIC16F628A.ASM 23 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\USERS\ARMANDO\DESKTOP\PRUEBA PIC 16F628A\PIC16F628A.ASM 24 : Register in operand not in bank 0. Ensure that bank bits are correct.
Warning[207] C:\USERS\ARMANDO\DESKTOP\PRUEBA PIC 16F628A\PIC16F628A.ASM 27 : Found label after column 1. (CHECAR)
Warning[207] C:\USERS\ARMANDO\DESKTOP\PRUEBA PIC 16F628A\PIC16F628A.ASM 32 : Found label after column 1. (ENCENDERLED)
Warning[207] C:\USERS\ARMANDO\DESKTOP\PRUEBA PIC 16F628A\PIC16F628A.ASM 43 : Found label after column 1. (retardo)
Warning[207] C:\USERS\ARMANDO\DESKTOP\PRUEBA PIC 16F628A\PIC16F628A.ASM 44 : Found label after column 1. (DELAY_1S)
Warning[207] C:\USERS\ARMANDO\DESKTOP\PRUEBA PIC 16F628A\PIC16F628A.ASM 46 : Found label after column 1. (DEL_111)
Warning[207] C:\USERS\ARMANDO\DESKTOP\PRUEBA PIC 16F628A\PIC16F628A.ASM 48 : Found label after column 1. (DEL_11)
Warning[207] C:\USERS\ARMANDO\DESKTOP\PRUEBA PIC 16F628A\PIC16F628A.ASM 50 : Found label after column 1. (DEL_1)
Warning[207] C:\USERS\ARMANDO\DESKTOP\PRUEBA PIC 16F628A\PIC16F628A.ASM 58 : Found label after column 1. (DEL_1FIN)
Halting build on first failure as requested.
----------------------------------------------------------------------
Release build of project `C:\Users\Armando\Desktop\PRUEBA PIC 16F628A\PIC16F628A.disposable_mcp' failed.
Language tool versions: MPASMWIN.exe v5.51, mplink.exe v4.49, mplib.exe v4.49
Wed Sep 01 20:58:44 2021
----------------------------------------------------------------------
BUILD FAILED
Lo que no entiendo , es porque me dice que no esta definido, su lo pongo tal cual en la hoja de datos
-
¿Y si remplazas _DATA_CP_OFF por _CPD_OFF ?
-
Lo que no entiendo , es porque me dice que no esta definido, su lo pongo tal cual en la hoja de datos
No tenes que fijarte el nombre del bit del datasheet. Tenes que fijarte lo que esta definido en el archivo: P16F628A.INC
Buscalo en tu carpeta de microchip, abrilo con el bloc de notas y anda al final donde suelen estar definidas todas las opciones de los bit de configuracion