Hola:
Estoy intentado hacer con un PIC 12F629 que me vino en el "USB PIC Programmer" que compré y lo quiero aprovechar. En ensamblador quiero aprender a configurar los puertos de entrada y salida más el oscilador interno a 4 MHZ. Por ahora estoy siguiendo el ejemplo aquí. Si hay más Web bien explicada me lo dicen.
La prueba que estoy haciendo solamente es que parpadee un led durante un segundo en cada ciclo. 1 segundo apagado y otro encendido mediante retardo cuyo ejemplo puedes ver en la subrutina. En la pata 5 del 12F629 o la salida GP2 tengo conectado una resistencia de 220 Ohmios y un Led a masa.
Por ahora este es el error.
Otra cosa. La mejor configuración que he visto para el 16F84A es este que lo uso como plantilla, lo mismo quiero aprender hacerlo con el 12F629.
Un cordial saludo.
Estoy intentado hacer con un PIC 12F629 que me vino en el "USB PIC Programmer" que compré y lo quiero aprovechar. En ensamblador quiero aprender a configurar los puertos de entrada y salida más el oscilador interno a 4 MHZ. Por ahora estoy siguiendo el ejemplo aquí. Si hay más Web bien explicada me lo dicen.
La prueba que estoy haciendo solamente es que parpadee un led durante un segundo en cada ciclo. 1 segundo apagado y otro encendido mediante retardo cuyo ejemplo puedes ver en la subrutina. En la pata 5 del 12F629 o la salida GP2 tengo conectado una resistencia de 220 Ohmios y un Led a masa.
Código:
; ZONA DE DATOS *********************************************************************
LIST P=12F629 ; Procesador utilizado.
INCLUDE <P12F629.INC> ; Definición de algunos operandos utilizados.
__CONFIG _MCLRE_OFF & _CP_OFF & _WDT_OFF & _INTRC_OSC_NOCLKOUT & _PWRTE_ON
CBLOCK 0x20
ENDC
#DEFINE LED GPIO,2 ; Salida del Led
#DEFINE INT GPIO,3 ; Entrada del interruptor.
; ZONA DE CÓDIGOS *******************************************************************
ORG 0
Inicio
bsf STATUS,RP0 ; Pone a 1 el bit 5 del STATUS. Acceso al Banco 1.
ORG 0x3FF ; 0x03FF
retlw 0x20 ; Valor de calibración.
movwf OSCCAL
movfw b'00001000' ; Activar GP3 como entrada.
movwf TRISIO
bcf STATUS,RP0 ; Pone a 0 el bit 5 de STATUS. Acceso al Banco 0.
Principal
call Reatrdo
; SUBRUTINA *************************************************************************
; Delay = 1 seconds
; Clock frequency = 4 MHz
; Actual delay = 1 seconds = 1000000 cycles
; Error = 0 %
cblock
d0
d1
d2
endc
Reatrdo
;999990 cycles
movlw 0x07
movwf d0
movlw 0x2F
movwf d1
movlw 0x03
movwf d2
Reatrdo_0
decfsz d0, f
goto $+2
decfsz d1, f
goto $+2
decfsz d2, f
goto Reatrdo_0
;6 cycles
goto $+1
goto $+1
goto $+1
;4 cycles (including call)
return
END
Por ahora este es el error.
----------------------------------------------------------------------
Debug build of project `C:\PIC16F84\12F629_01.disposable_mcp' started.
Preprocessor symbol `__DEBUG' is defined.
Sun Nov 16 18:52:11 2008
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\Archivos de programa\Microchip\MPASM Suite\MPASMWIN.exe" /q /p12F629 "12F629_01.asm" /l"12F629_01.lst" /e"12F629_01.err" /d__DEBUG=1
Message[313] C:\PIC16F84\12F629_01.ASM 6 : CBLOCK constants will start with a value of 0.
Message[302] C:\PIC16F84\12F629_01.ASM 19 : Register in operand not in bank 0. Ensure that bank bits are correct.
Warning[220] C:\PIC16F84\12F629_01.ASM 19 : Address exceeds maximum range for this processor.
Warning[219] C:\PIC16F84\12F629_01.ASM 20 : Invalid RAM location specified.
Warning[220] C:\PIC16F84\12F629_01.ASM 20 : Address exceeds maximum range for this processor.
Message[302] C:\PIC16F84\12F629_01.ASM 21 : Register in operand not in bank 0. Ensure that bank bits are correct.
Warning[220] C:\PIC16F84\12F629_01.ASM 21 : Address exceeds maximum range for this processor.
Warning[220] C:\PIC16F84\12F629_01.ASM 22 : Address exceeds maximum range for this processor.
Error[126] C:\PIC16F84\12F629_01.ASM 25 : Argument out of range (0405 not between 0000 and 03FF)
Warning[220] C:\PIC16F84\12F629_01.ASM 25 : Address exceeds maximum range for this processor.
Warning[220] C:\PIC16F84\12F629_01.ASM 43 : Address exceeds maximum range for this processor.
Warning[220] C:\PIC16F84\12F629_01.ASM 44 : Address exceeds maximum range for this processor.
Warning[220] C:\PIC16F84\12F629_01.ASM 45 : Address exceeds maximum range for this processor.
Warning[220] C:\PIC16F84\12F629_01.ASM 46 : Address exceeds maximum range for this processor.
Warning[220] C:\PIC16F84\12F629_01.ASM 47 : Address exceeds maximum range for this processor.
Warning[220] C:\PIC16F84\12F629_01.ASM 48 : Address exceeds maximum range for this processor.
Warning[220] C:\PIC16F84\12F629_01.ASM 50 : Address exceeds maximum range for this processor.
Error[126] C:\PIC16F84\12F629_01.ASM 51 : Argument out of range (040E not between 0000 and 03FF)
Warning[220] C:\PIC16F84\12F629_01.ASM 51 : Address exceeds maximum range for this processor.
Warning[220] C:\PIC16F84\12F629_01.ASM 52 : Address exceeds maximum range for this processor.
Error[126] C:\PIC16F84\12F629_01.ASM 53 : Argument out of range (0410 not between 0000 and 03FF)
Warning[220] C:\PIC16F84\12F629_01.ASM 53 : Address exceeds maximum range for this processor.
Warning[220] C:\PIC16F84\12F629_01.ASM 54 : Address exceeds maximum range for this processor.
Error[126] C:\PIC16F84\12F629_01.ASM 55 : Argument out of range (040B not between 0000 and 03FF)
Warning[220] C:\PIC16F84\12F629_01.ASM 55 : Address exceeds maximum range for this processor.
Error[126] C:\PIC16F84\12F629_01.ASM 58 : Argument out of range (0412 not between 0000 and 03FF)
Warning[220] C:\PIC16F84\12F629_01.ASM 58 : Address exceeds maximum range for this processor.
Error[126] C:\PIC16F84\12F629_01.ASM 59 : Argument out of range (0413 not between 0000 and 03FF)
Warning[220] C:\PIC16F84\12F629_01.ASM 59 : Address exceeds maximum range for this processor.
Error[126] C:\PIC16F84\12F629_01.ASM 60 : Argument out of range (0414 not between 0000 and 03FF)
Warning[220] C:\PIC16F84\12F629_01.ASM 60 : Address exceeds maximum range for this processor.
Warning[220] C:\PIC16F84\12F629_01.ASM 63 : Address exceeds maximum range for this processor.
Halting build on first failure as requested.
----------------------------------------------------------------------
Debug build of project `C:\PIC16F84\12F629_01.disposable_mcp' failed.
Preprocessor symbol `__DEBUG' is defined.
Sun Nov 16 18:52:12 2008
----------------------------------------------------------------------
BUILD FAILED
Otra cosa. La mejor configuración que he visto para el 16F84A es este que lo uso como plantilla, lo mismo quiero aprender hacerlo con el 12F629.
Código:
bsf STATUS,RP0 ; Acceso al Banco 1.
clrf TRISB ; Las líneas del Puerto B se configuran como salida.
movlw b'00011111' ; Las 5 líneas del Puerto A se configuran como entrada.
movwf TRISA
bcf STATUS,RP0 ; Acceso al Banco 0.
Un cordial saludo.