Los PICs ultimamente me estan rayando, no consigo que me oscile bien ni por asomo.... y no se que me esta pasando....
En este momento que estoy con un PIC18F25K20 Haciendolo oscilar con el oscilador interno, para no tener problemas con el cristal, anulandole el Watchdog para que no se me pueda resetear, anulandole el PWRT = OFF , por si acaso,
Y me da le ponga a oscilar a 8 Mhz o a 16 Mhz el oscilador interno con PLL o sin el No oscila, solamente cuando pongo el dedo sobre la pista de la tierra parece que le inyecto algun tipo de señal y empieza a oscilar.
Me esta ocurriendo con distintos tipos de PICs y les aplico una distintas fuentes de alimentacion y lo mismo, los PICs que estoy comprando son en Mouser originales no en ninguna web china...
En fin hasta el gorro.. Este es el programa para apagar el led y encenderlo..... Saludos.
Se me olvidaba el MCLR anulado por si esto tambien me da algun problema.
;************************************************************************
;*
;* El siguiente proyecto es para empezar a funcionar con el 18f25k20
;*
;* MICROPROCESADOR FUNCIONANDO CON PLL RELOJ INTERNO Y PLL 4X A 64 MHZ
; LO QUE IMPLICARIA QUE IRIA MAS RAPIDO.
;************************************************************************
list p=18f25k20
#include p18f25k20.inc
; CONFIG1H
CONFIG FOSC = INTIO7 ; Oscillator Selection bits (Internal oscillator block, CLKOUT function on RA6, port function on RA7)
CONFIG FCMEN = OFF ; Fail-Safe Clock Monitor Enable bit (Fail-Safe Clock Monitor disabled)
CONFIG IESO = OFF ; Internal/External Oscillator Switchover bit (Oscillator Switchover mode disabled)
; CONFIG2L
CONFIG PWRT = OFF ; Power-up Timer Enable bit (PWRT disabled)
CONFIG BOREN = SBORDIS ; Brown-out Reset Enable bits (Brown-out Reset enabled in hardware only (SBOREN is disabled))
CONFIG BORV = 18 ; Brown Out Reset Voltage bits (VBOR set to 1.8 V nominal)
; CONFIG2H
CONFIG WDTEN = OFF ; Watchdog Timer Enable bit (WDT is controlled by SWDTEN bit of the WDTCON register)
CONFIG WDTPS = 32768 ; Watchdog Timer Postscale Select bits (1:32768)
; CONFIG3H
CONFIG CCP2MX = PORTBE ; CCP2 MUX bit (CCP2 input/output is multiplexed with RB3)
CONFIG PBADEN = ON ; PORTB A/D Enable bit (PORTB<4:0> pins are configured as analog input channels on Reset)
CONFIG LPT1OSC = OFF ; Low-Power Timer1 Oscillator Enable bit (Timer1 configured for higher power operation)
CONFIG HFOFST = OFF ; HFINTOSC Fast Start-up (The system clock is held off until the HFINTOSC is stable.)
CONFIG MCLRE = OFF ; MCLR Pin Enable bit (RE3 input pin enabled; MCLR disabled)
; CONFIG4L
CONFIG STVREN = ON ; Stack Full/Underflow Reset Enable bit (Stack full/underflow will cause Reset)
CONFIG LVP = ON ; Single-Supply ICSP Enable bit (Single-Supply ICSP enabled)
CONFIG XINST = OFF ; Extended Instruction Set Enable bit (Instruction set extension and Indexed Addressing mode disabled (Legacy mode))
; CONFIG5L
CONFIG CP0 = OFF ; Code Protection Block 0 (Block 0 (000800-001FFFh) not code-protected)
CONFIG CP1 = OFF ; Code Protection Block 1 (Block 1 (002000-003FFFh) not code-protected)
CONFIG CP2 = OFF ; Code Protection Block 2 (Block 2 (004000-005FFFh) not code-protected)
CONFIG CP3 = OFF ; Code Protection Block 3 (Block 3 (006000-007FFFh) not code-protected)
; CONFIG5H
CONFIG CPB = OFF ; Boot Block Code Protection bit (Boot block (000000-0007FFh) not code-protected)
CONFIG CPD = OFF ; Data EEPROM Code Protection bit (Data EEPROM not code-protected)
; CONFIG6L
CONFIG WRT0 = OFF ; Write Protection Block 0 (Block 0 (000800-001FFFh) not write-protected)
CONFIG WRT1 = OFF ; Write Protection Block 1 (Block 1 (002000-003FFFh) not write-protected)
CONFIG WRT2 = OFF ; Write Protection Block 2 (Block 2 (004000-005FFFh) not write-protected)
CONFIG WRT3 = OFF ; Write Protection Block 3 (Block 3 (006000-007FFFh) not write-protected)
; CONFIG6H
CONFIG WRTC = OFF ; Configuration Register Write Protection bit (Configuration registers (300000-3000FFh) not write-protected)
CONFIG WRTB = OFF ; Boot Block Write Protection bit (Boot Block (000000-0007FFh) not write-protected)
CONFIG WRTD = OFF ; Data EEPROM Write Protection bit (Data EEPROM not write-protected)
; CONFIG7L
CONFIG EBTR0 = OFF ; Table Read Protection Block 0 (Block 0 (000800-001FFFh) not protected from table reads executed in other blocks)
CONFIG EBTR1 = OFF ; Table Read Protection Block 1 (Block 1 (002000-003FFFh) not protected from table reads executed in other blocks)
CONFIG EBTR2 = OFF ; Table Read Protection Block 2 (Block 2 (004000-005FFFh) not protected from table reads executed in other blocks)
CONFIG EBTR3 = OFF ; Table Read Protection Block 3 (Block 3 (006000-007FFFh) not protected from table reads executed in other blocks)
; CONFIG7H
CONFIG EBTRB = OFF ; Boot Block Table Read Protection bit (Boot Block (000000-0007FFh) not protected from table reads executed in other blocks)
org 00h
goto star
star
org 20h
movlw b'01100110'
movwf OSCCON ; ACTIVA EL OSCILADOR PARA INTERNO, Y 16 MHZ LA FRECUENCIA DE DE OSCILADOR INTERNO.
movlw b'11000000'
movwf OSCTUNE ; ACTIVA EL PLL A 4X
movlw 0ffh
movwf TRISB
movwf TRISA
; INICIALIZANDO EL PUERTO C POR EL LIBRO
clrf PORTC
movlw 0x0f0
movwf LATC
movlw 0x0f0
movwf TRISC ; HACE RB0 A RB3 SALIDAS Y RB4 A RB7 SAIDAS.
clrf INTCON ; que no tenga interrupciones
luces
movlw 00h ;
movwf PORTC
call retardo
movlw 01h
movwf PORTC
call retardo
goto luces
retardo
movlw 0x0FF
movwf 20h
movwf 21h
movlw 09h
movwf 22h
loop
decfsz 20
goto loop
decfsz 21
goto loop
decfsz 22
goto loop
return
end