Hacer juegos de luces con PIC

Holaaaaaaaaaaaa:

Quiero hacer un juego de luces con el PIC12F508. Tengo el programa ya medio heco muy sencillo. Como puedes ver, no he calibrado el oscilador interno a 4 MHz que no se como se hace y la hoja de datos es muy mala para entender y vi este enlace en Inglés.

http://ww1.microchip.com/downloads/en/DeviceDoc/31002a.pdf
http://ww1.microchip.com/downloads/en/DeviceDoc/33023a.pdf

También quiero configurar o controlar el Timer. Por ejemplo, tener 0.5 segundos apagado y otros 0.5 seg. ensendidos.

El código que he hecho hasta ahora es:

Código:
LIST        P=12F508
    INCLUDE        <P12F508.INC>
    __FUSES    _MCLRE_OFF & _CP_OFF & _WDT_OFF & _IntRC_OSC

    CBLOCK   0x07    
    RAM_1
    ENDC

    ORG        0x00
;    movwf   OSCCAL
;    movlw   b'11000010'     ;CONFIGURA TMR0 PRESCALER = 1:8
;    OPTION                  ;OSCILADOR = 4MHZ
    movlw   b'00001000'     ;INICIALIZA TODOS LOS PUERTOS
    movwf   RAM_1       ;EN ALTO Y RAM_1
       tris       GPIO
    bcf        GPIO,0
    bcf        GPIO,1
    bcf        GPIO,2
    bcf        GPIO,4
    bcf        GPIO,5    
    clrw
Inicio
    btfss    GPIO,3
    goto    Led_1
    bcf        GPIO,0
    bcf        GPIO,1
    bcf        GPIO,2
    goto    Inicio

Led_1
    bcf        GPIO,4
    bcf        GPIO,5
    goto    Inicio


    END
fdsafdsafadsfds.gif


Saludo.





Edito:

Código:
;--------------------------------------------------------------------------

;                   +----------------------------------+
;                   | ESQUEMA DE CONEXIONES PIC12F508  |
;                   +----------------------------------+
;
;                            +------+  +------+
;                            |      +--+      |
;                       +5V ||1  PIC12F508   8|| MASA
;                            |                |
;                             ||2 GPIO5  GPIO0 7||                     
;                            |                |
;                              ||3 GPIO4  GPIO1 6||  
;                            |                |
;                           ||4 GPIO3  GPIO2 5||   
;                            |                |
;                            +________________+
;           
; 1 - +5VCC  - SIN COMENTARIOS
; 2 -- 
; 3 -- 
; 4 -- 
; 5 -- 
; 6 -- 
; 7 -- 
; 8 - MASA   - SIN COMENTARIOS
;--------------------------------------------------------------------------

    LIST        P=12F508
    INCLUDE        <P12F508.INC>
    __FUSES    _MCLRE_OFF & _CP_OFF & _WDT_OFF & _IntRC_OSC

    CBLOCK   0x07    
    RAM_1
    ENDC

    ORG        0x00
    call    0x1FF
    movwf   OSCCAL
;    movlw   b'11000010'     ;CONFIGURA TMR0 PRESCALER = 1:8
;    OPTION                  ;OSCILADOR = 4MHZ
    movlw   b'00001000'     ;INICIALIZA TODOS LOS PUERTOS
    movwf   RAM_1       ;EN ALTO Y RAM_1
;    movlw    b'00001000'
    movwf    GPIO
       tris       GPIO
    clrw
Inicio
    btfss    GPIO,3
    goto    Led_1
    bcf        GPIO,0
    bcf        GPIO,1
    bcf        GPIO,2
    goto    Inicio

Led_1
    bcf        GPIO,4
    bcf        GPIO,5
    goto    Inicio

    ORG        0x1FF
    retlw    b'11111111'


    END

Supuestamente está calibrado, pero me da error.

----------------------------------------------------------------------
Debug build of project `H:\PIC16F84A\12F508\12F508_decoder\12F508_decoder.mcp' started.
Language tool versions: MPASMWIN.exe v5.35, mplink.exe v4.35
Preprocessor symbol `__DEBUG' is defined.
Tue Jan 05 05:17:09 2010
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\Archivos de programa\Microchip\MPASM Suite\MPASMWIN.exe" /q /p12F508 "12F508_decoder.asm" /l"12F508_decoder.lst" /e"12F508_decoder.err" /d__DEBUG=1
Error[120] H:\PIC16F84A\12F508\12F508_DECODER\12F508_DECODER.ASM 38 : Call or jump not allowed at this address (must be in low half of page)
Halting build on first failure as requested.
----------------------------------------------------------------------
Debug build of project `H:\PIC16F84A\12F508\12F508_decoder\12F508_decoder.mcp' failed.
Language tool versions: MPASMWIN.exe v5.35, mplink.exe v4.35
Preprocessor symbol `__DEBUG' is defined.
Tue Jan 05 05:17:17 2010
----------------------------------------------------------------------
BUILD FAILED
 
Última edición:
Es tardia la respuesta pero quitando o eliminando la instrucción " call 0x1FF" al inicio te puede funcionar porque lo que te dice el error es que la instrucción call o jump o sea llamar o saltar no lo puede hacer a esa dirección.

asi te funcionaria:

LIST P=12F508
INCLUDE <P12F508.INC>
__FUSES _MCLRE_OFF & _CP_OFF & _WDT_OFF & _IntRC_OSC

CBLOCK 0x07
RAM_1
ENDC

ORG 0x00
; call 0x1FF
movwf OSCCAL
; movlw b'11000010' ;CONFIGURA TMR0 PRESCALER = 1:8
; OPTION ;OSCILADOR = 4MHZ
movlw b'00001000' ;INICIALIZA TODOS LOS PUERTOS
movwf RAM_1 ;EN ALTO Y RAM_1
movlw b'00001000'
movwf GPIO
tris GPIO
clrw
Inicio
btfss GPIO,3
goto Led_1
bcf GPIO,0
bcf GPIO,1
bcf GPIO,2
goto Inicio

Led_1
bSf GPIO,4
bSf GPIO,5
goto Inicio

; ORG 0x1FF
; retlw b'11111111'
END
 
Es tardia la respuesta pero quitando o eliminando la instrucción " call 0x1FF" al inicio te puede funcionar porque lo que te dice el error es que la instrucción call o jump o sea llamar o saltar no lo puede hacer a esa dirección.

asi te funcionaria:

LIST P=12F508
INCLUDE <P12F508.INC>
__FUSES _MCLRE_OFF & _CP_OFF & _WDT_OFF & _IntRC_OSC

CBLOCK 0x07
RAM_1
ENDC

ORG 0x00
; call 0x1FF
movwf OSCCAL
; movlw b'11000010' ;CONFIGURA TMR0 PRESCALER = 1:8
; OPTION ;OSCILADOR = 4MHZ
movlw b'00001000' ;INICIALIZA TODOS LOS PUERTOS
movwf RAM_1 ;EN ALTO Y RAM_1
movlw b'00001000'
movwf GPIO
tris GPIO
clrw
Inicio
btfss GPIO,3
goto Led_1
bcf GPIO,0
bcf GPIO,1
bcf GPIO,2
goto Inicio

Led_1
bSf GPIO,4
bSf GPIO,5
goto Inicio

; ORG 0x1FF
; retlw b'11111111'
END

Gracias por a probarlo.
 
Atrás
Arriba