avatar_Hattuşa

18F45K20 config ayarı

Başlatan Hattuşa, 02 Şubat 2015, 21:21:32

Hattuşa

slm arkadaşlar;
özellikle proton kullanıcılarından bir ricada bulunmak istiyorum. 1-2 tane 18F45K20 temin ettim 126MHZ kristal bağladım ve PLL yi aktif edip 64 MHz de kullanmak istiyorum. sizden ricam söylediğim şekliyle config ayarlarını protonda yazarak paylaşırsanız memnun olurum.


EDIT: kristal 16MHZ olacaktı yanlış yazmışım ustam  ;D

Maxim


gergy

Programınıza göre diğer configürasyon parametrelerini ayarlarsınız.



Device = 18F45K20
Xtal = 64

Config_Start
  FOSC = HSPLL ;HS oscillator, PLL enabled (Clock Frequency = 4 x FOSC1)
  FCMEN = On ;Fail-Safe Clock Monitor enabled
  IESO = On ;Oscillator Switchover mode enabled
  PWRT = OFF ;PWRT disabled
  BOREN = OFF ;Brown-out Reset disabled in hardware and software
  BORV = 18 ;VBOR set to 1.8 V nominal
  WDTEN = OFF ;WDT is controlled by SWDTEN bit of the WDTCON register
  WDTPS = 32768 ;1:32768
  CCP2MX = PORTC ;CCP2 input/output is multiplexed with RC1
  PBADEN = On ;PORTB<4:0> pins are configured as analog input channels on Reset
  LPT1OSC = OFF ;Timer1 configured for higher power operation
  HFOFST = On ;HFINTOSC starts clocking the CPU without waiting for the oscillator to stablize.
  MCLRE = On ;MCLR pin enabled; RE3 input pin disabled
  STVREN = On ;Stack full/underflow will cause Reset
  LVP = On ;Single-Supply ICSP enabled
  XINST = OFF ;Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
  Debug = OFF ;Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins
  CP0 = OFF ;Block 0 (000800-001FFFh) not code-protected
  CP1 = OFF ;Block 1 (002000-003FFFh) not code-protected
  CP2 = OFF ;Block 2 (004000-005FFFh) not code-protected
  CP3 = OFF ;Block 3 (006000-007FFFh) not code-protected
  CPB = OFF ;Boot block (000000-0007FFh) not code-protected
  CPD = OFF ;Data EEPROM not code-protected
  WRT0 = OFF ;Block 0 (000800-001FFFh) not write-protected
  WRT1 = OFF ;Block 1 (002000-003FFFh) not write-protected
  WRT2 = OFF ;Block 2 (004000-005FFFh) not write-protected
  WRT3 = OFF ;Block 3 (006000-007FFFh) not write-protected
  WRTC = OFF ;Configuration registers (300000-3000FFh) not write-protected
  WRTB = OFF ;Boot Block (000000-0007FFh) 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
  EBTR2 = OFF ;Block 2 (004000-005FFFh) not protected from table reads executed in other blocks
  EBTR3 = OFF ;Block 3 (006000-007FFFh) 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


Hattuşa

F.T. hocam;
bir devremde 18F45K20 kullandım yukarıdaki osc config ayarlarını kullandım, devre çalışıyor sorunum ise;
bir pini 3uS boyunca hihg-low yapıyorum skopta 2uS un altında çıkıyor. timer calculatorle timer1 i ayarladığımda ayarladığım süre çıkmıyor daha küçük bir süre çıkıyor. 64MHZ de PLL ile çalışıyorum 16. mhz kristal kullanarak. kodu 16mhz e de ayarladığım halde bir türlü doğru zamanlamayı yakalayamadım. OSC ayarlarından şüpheleniyorum. nerde hata yapmış olabilirim? sizde doğru configre edilmiş OSC ayarı varsa paylaşabilirmisiniz?

F®T

#4
Aşağıdaki ayarlar dediğiniz gergy arkadaşın paylaştığı ayarlarsa orda pll aktif görünüyor.Bence önce pll yi devre dışı bırakın 16 mhz ile çalışın daha sonra pll devrede çalışın aradaki farka bakalım.Protonun ne zaman ne yapacağı belli olmuyor.

Bu kodları bir denermisin.
Device = 18F45K20
Xtal=64
'-------------------------------------------------------------------------
Config_Start
FOSC = INTIO67  ;Internal oscillator block, port function on RA6 and RA7
FCMEN = On      ;Fail-Safe Clock Monitor enabled
IESO = On       ;Oscillator Switchover mode enabled
PWRT = OFF      ;PWRT disabled
BOREN = SBORDIS ;Brown-out Reset enabled in hardware only (SBOREN is disabled)
BORV = 18       ;VBOR set to 1.8 V nominal
WDTEN = OFF     ;WDT is controlled by SWDTEN bit of the WDTCON register
WDTPS = 32768   ;1:32768
CCP2MX = PORTC  ;CCP2 input/output is multiplexed with RC1
PBADEN = OFF    ;PORTB<4:0> pins are configured as digital I/O on Reset
LPT1OSC = OFF   ;Timer1 configured for higher power operation
HFOFST = On     ;HFINTOSC starts clocking the CPU without waiting for the oscillator to stablize.
MCLRE = OFF     ;RE3 input pin enabled; MCLR disabled
STVREN = On     ;Stack full/underflow will cause Reset
LVP = OFF       ;Single-Supply ICSP disabled
XINST = OFF     ;Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
Debug = OFF     ;Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins
CP0 = OFF       ;Block 0 (000800-001FFFh) not code-protected
CP1 = OFF       ;Block 1 (002000-003FFFh) not code-protected
CP2 = OFF       ;Block 2 (004000-005FFFh) not code-protected
CP3 = OFF       ;Block 3 (006000-007FFFh) not code-protected
CPB = OFF       ;Boot block (000000-0007FFh) not code-protected
CPD = OFF       ;Data EEPROM not code-protected
WRT0 = OFF      ;Block 0 (000800-001FFFh) not write-protected
WRT1 = OFF      ;Block 1 (002000-003FFFh) not write-protected
WRT2 = OFF      ;Block 2 (004000-005FFFh) not write-protected
WRT3 = OFF      ;Block 3 (006000-007FFFh) not write-protected
WRTC = OFF      ;Configuration registers (300000-3000FFh) not write-protected
WRTB = OFF      ;Boot Block (000000-0007FFh) 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
EBTR2 = OFF     ;Block 2 (004000-005FFFh) not protected from table reads executed in other blocks
EBTR3 = OFF     ;Block 3 (006000-007FFFh) 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

' osc con setup to run at 64mhz
'-------------------------------------------------------------------------------
OSCCON = $74 'lower 3 bits must be zero
OSCTUNE= $40 'to run 64mhz
"Hakk" şerleri hayr eyler Zannetme ki gayr eyler Ârif anı seyreyler Mevlâ görelim neyler Neylerse güzel eyler.

Powered by EzPortal