Ik kan je maar beperkt helpen op het moment.. Maar mijn Config die ik gebruik voor 64mHz met de INTERNE osc.
Xtal = 64 ' = 16 mhz interne OSC * 4 PLL
Config_Start
FOSC = IRC ;HS ; Internal RC oscillator
PLLEN = On ; PLL is under software control
PCLKEN = OFF ; Primary clock is under software control
FCMEN = OFF ; Fail-Safe Clock Monitor disabled
IESO = Off ; Oscillator Switchover mode enabled
PWRTEN = Off ; PWRT enabled
BOREN = Off ; Brown-out Reset enabled and controlled by software (SBOREN is enabled)
BORV = 30 ; VBOR set to 2.2 V nominal
WDTEN = OFF ; WDT is controlled by SWDTEN bit of the WDTCON register
WDTPS = 64
MCLRE = OFF ; RE3 input pin enabled; MCLR disabled
HFOFST = On ; The system clock is held off until the HF-INTOSC is stable.
STVREN = Off ; Stack full/underflow will cause Reset
LVP = Off ; Single-Supply ICSP enabled
BBSIZ = OFF ; 1kW boot block size
XINST = Off ; Instruction set extension and Indexed Addressing mode enabled
Cp0 = Off ; Block 0 code-protected
CP1 = Off ; Block 1 (002000-003FFFh) code-protected
CPB = Off ; Boot block (000000-0007FFh) code-protected
CPD = Off ; Data EEPROM code-protected
WRT0 = OFF ; Block 0 (000800-001FFFh) not write-protected
WRT1 = OFF ; Block 1 (002000-003FFFh) not write-protected
WRTB = OFF ; Boot block (000000-0007FFh) not write-protected
WRTC = OFF ; Configuration registers (300000-3000FFh) not write-protected
WRTD = OFF ; Data EEPROM not write-protected
EBTR0 = OFF ; Block 0 (000800-001FFFh) not protected from table reads executed in other blocks
EBTR1 = OFF ; Block 1 (002000-003FFFh) not protected from table reads executed in other blocks
EBTRB = OFF ; Boot block (000000-0007FFh) not protected from table reads executed in other blocks
Config_End
' 76543210
OSCCON = %01110000 ' 16MHz, Internal oscillator ' Bit 1 en 0 moeten allebei op 0 staan om PPL te KUNNEN activeren.
OSCTUNE.6 = 1 ' Daadwerkelijk PLL ActiverenSkalTura
In the beginning there was nothing, but even that exploded
Ik heb dit programma er nu in geladen.
Een simpel knipperend LEDje op C4 en een LED die meteen aan gaat (om te testen of de PIC überhaupt iets doet) op C5.
Device 18F14K22
Config_Start
FOSC = IRC
PLLEN = On
PCLKEN = OFF
FCMEN = OFF
IESO = OFF
PWRTEN = OFF
BOREN = OFF
BORV = 30
WDTEN = OFF
WDTPS = 64
MCLRE = OFF
HFOFST = On
STVREN = OFF
LVP = Off
BBSIZ = OFF
XINST = Off
Cp0 = OFF
CP1 = OFF
CPB = OFF
CPD = OFF
WRT0 = OFF
WRT1 = OFF
WRTB = OFF
WRTC = OFF
WRTD = OFF
EBTR0 = OFF
EBTR1 = OFF
EBTRB = OFF
Config_End
Xtal 64
All_Digital TRUE
OSCCON = %01110000
OSCTUNE.6 = 1
LATC = %00000000
High LATC.5
DelayMS 500
loop:
Toggle LATC.4
DelayMS 250
GoTo loop
EndResultaat:
C5 is aan, verder gebeurd er niks...
Normaal als de kloksnelheid niet goed staat werkt het wel maar kloppen de delays niet.
Maar kijk eens naar je OSSCON en kijk dan eens naar de datasheet. Je hebt m nu ingesteld op 8mHz. Ook met PLL actief wordt dat geen 64mHz, die zal je dus op zijn minst op 16 moeten zetten. Daarnaast zeg je dat je een extern crystal hebt aangesloten maar je FOSC staat op IRC en dat is de Interne Osc dacht ik..
Ook heb ik in mijn opmerkingen dit gezet : ' 16MHz, Internal oscillator ' Bit 1 en 0 moeten allebei op 0 staan om PPL te KUNNEN activeren. .. Dat zal ik destijds niet voor niks hebben gedaan. Bij jou staat deze op 10 en niet op 00.
SkalTura
In the beginning there was nothing, but even that exploded
Op 2 januari 2017 10:41:42 schreef diebobo:
Daarnaast zeg je dat je een extern crystal hebt aangesloten maar je FOSC staat op IRC en dat is de Interne Osc dacht ik..
Ik heb die nu in mijn test programmatje inderdaad op interne clock gezet om te kijken of er überhaupt iets gebeurd... Dan kan ik de externe oscillator uitsluiten in mijn test setup.
Probeer onderstaande code eens.. Naast hetgeen ik eerder stuurde zit er hier ook nog het een en ander aan IO instellingen bij (ANSEL) in combinatie met je Test Led Stukje.. Dit zou toch echt moeten werken.
Device 18F14K22
Xtal = 64 ' = 16 mhz interne OSC * 4 PLL
Config_Start
FOSC = IRC ;HS ; Internal RC oscillator
PLLEN = On ; PLL is under software control
PCLKEN = OFF ; Primary clock is under software control
FCMEN = OFF ; Fail-Safe Clock Monitor disabled
IESO = Off ; Oscillator Switchover mode enabled
PWRTEN = Off ; PWRT enabled
BOREN = Off ; Brown-out Reset enabled and controlled by software (SBOREN is enabled)
BORV = 30 ; VBOR set to 2.2 V nominal
WDTEN = OFF ; WDT is controlled by SWDTEN bit of the WDTCON register
WDTPS = 64
MCLRE = OFF ; RE3 input pin enabled; MCLR disabled
HFOFST = On ; The system clock is held off until the HF-INTOSC is stable.
STVREN = Off ; Stack full/underflow will cause Reset
LVP = Off ; Single-Supply ICSP enabled
BBSIZ = OFF ; 1kW boot block size
XINST = Off ; Instruction set extension and Indexed Addressing mode enabled
Cp0 = Off ; Block 0 code-protected
CP1 = Off ; Block 1 (002000-003FFFh) code-protected
CPB = Off ; Boot block (000000-0007FFh) code-protected
CPD = Off ; Data EEPROM code-protected
WRT0 = OFF ; Block 0 (000800-001FFFh) not write-protected
WRT1 = OFF ; Block 1 (002000-003FFFh) not write-protected
WRTB = OFF ; Boot block (000000-0007FFh) not write-protected
WRTC = OFF ; Configuration registers (300000-3000FFh) not write-protected
WRTD = OFF ; Data EEPROM not write-protected
EBTR0 = OFF ; Block 0 (000800-001FFFh) not protected from table reads executed in other blocks
EBTR1 = OFF ; Block 1 (002000-003FFFh) not protected from table reads executed in other blocks
EBTRB = OFF ; Boot block (000000-0007FFh) not protected from table reads executed in other blocks
Config_End
' 76543210
OSCCON = %01110000 ' 16MHz, Internal oscillator ' Bit 1 en 0 moeten allebei op 0 staan om PPL te KUNNEN activeren.
OSCTUNE.6 = 1 ' Daadwerkelijk PLL Activeren
ANSEL = %00000000 ' Analoge kanalen instellen = 1, 0 = digitaal
ANSELH = %00000000 ' Idem
All_Digital TRUE ;Alle ingangen digitaal
; 76543210
PORTA = %00000000
PORTB = %00000000
PORTC = %00000000
TRISA = %00000000 ;
TRISB = %00000000 ;
TRISC = %00000000 ;
High LATC.5
DelayMS 500
loop:
Toggle LATC.4
DelayMS 250
GoTo loop
EndOp 2 januari 2017 19:16:16 schreef Arco:
@diebobo: volgens datasheet mag interne osc. + PLL alleen op 8MHz (zie boven)
Wauw, bijzonder... Ik zie het staan, ik neem dat het een copy/paste is ? Nu is een "oh bij mij werkt het al 2 jaar" niet echt een goede graadmeter of iets mag of niet, maar toch het werkt al 2 jaar
.. Datasheet is tegenstrijdig : http://ww1.microchip.com/downloads/en/DeviceDoc/41365E.pdf
In de summary bovenaan staat :
• Precision 16 MHz Internal Oscillator Block:
- Factory calibrated to ± 1%
- Software selectable frequencies range of
31 kHz to 16 MHz
- 64 MHz performance available using PLL –
no external components required
Dat interpreteer ik een beetje als Interne Osc.
Verderop staat :
• A Phase Lock Loop (PLL) frequency multiplier,
available to both the high-speed crystal and internal
oscillator modes, which allows clock speeds of
up to 64 MHz. Used with the internal oscillator, the
PLL gives users a complete selection of clock
speeds, from 31 kHz to 32 MHz – all without using
an external crystal or clock circuit..
Dus weer 32mHz 
En in de OSCCTUNE Register staat :
bit 6 PLLEN: Frequency Multiplier PLL bit
1 = PLL enabled (for HFINTOSC 8 MHz and 16 MHz only)
0 = PLL disabled
Ik neem aan dat dit je Copy/Paste stukje was waar alleen 8 mHz stond ? Of ik lees het verkeerd maar met deze tekst zou het dan weer wel mogen toch ?
hadv
Just find out what you like and let it kill you
Probeer het eerst eens met alleen intrc op 8 MHz en zonder pll
Verder heb ik je code in PicBasic geïmporteerd en de configuratie met de FuseConfigurator gedaan
;-------------------------------------------------------------------------------
;**** Added by Fuse Configurator ****
; Use the Fuse Configurator plug-in to change these settings
Device = 18F14K22
Config_Start
FOSC = IRC ;Internal RC oscillator
PLLEN = On ;Oscillator multiplied by 4
PCLKEN = On ;Primary clock enabled
FCMEN = OFF ;Fail-Safe Clock Monitor disabled
IESO = OFF ;Oscillator Switchover mode disabled
PWRTEN = OFF ;PWRT disabled
BOREN = OFF ;Brown-out Reset disabled in hardware and software
BORV = 19 ;VBOR set to 1.9 V nominal
WDTEN = OFF ;WDT is controlled by SWDTEN bit of the WDTCON register
WDTPS = 32768 ;1:32768
HFOFST = On ;HFINTOSC starts clocking the CPU without waiting for the oscillator to stablize.
MCLRE = On ;MCLR pin enabled, RA3 input pin disabled
STVREN = On ;Stack full/underflow will cause Reset
LVP = OFF ;Single-Supply ICSP disabled
BBSIZ = OFF ;1kW boot block size
XINST = OFF ;Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
Debug = OFF ;Background debugger disabled, RA0 and RA1 configured as general purpose I/O pins
Cp0 = OFF ;Block 0 not code-protected
CP1 = OFF ;Block 1 not code-protected
CPB = OFF ;Boot block not code-protected
CPD = OFF ;Data EEPROM not code-protected
WRT0 = OFF ;Block 0 not write-protected
WRT1 = OFF ;Block 1 not write-protected
WRTC = OFF ;Configuration registers not write-protected
WRTB = OFF ;Boot block not write-protected
WRTD = OFF ;Data EEPROM not write-protected
EBTR0 = OFF ;Block 0 not protected from table reads executed in other blocks
EBTR1 = OFF ;Block 1 not protected from table reads executed in other blocks
EBTRB = OFF ;Boot block not protected from table reads executed in other blocks
Config_End
;**** End of Fuse Configurator Settings ****
;-------------------------------------------------------------------------------
De belangrijkste verschillen:
- Debug = OFF
- PCLKEN = On
Ik heb het programma met MPLab SIM uitgeprobeerd en die had op een gegeven moment geen zin meer.
Ik heb toen het label 'loop:' vervangen door 'noggus:' en de bijbehorende goto van 'goto loop' door 'goto noggus'.
Probleemloos.
Je zou zomaar eens een rare PicBasic anomalie te pakken kunnen hebben. 'loop' is geen protected keyword, dus daar zal het niet aan liggen.
Welke versie van de compiler gebruik je (ik het het uitgeprobeerd met 3.5.8.6.)? Ik kan het wel 'voor het echie' uittesten, maar dan moet ik eerst even een printje fabrieken. Kan dus even duren.
[Bericht gewijzigd door hadv op (12%)]