pll ile seri iletişim

Başlatan mitec, 16 Nisan 2016, 11:01:59

mitec

18f46k22 işlemciyi 16 mhz kristal kullanarak pll ile 64 mhz de çalıştırıyorum.sistem gayet güzel çalışıyor

Device = 18F46K22
Declare Xtal = 16
Config_Start
  FOSC = HSMP ;HS oscillator (high power > 16 MHz)
  PLLCFG = On ;Oscillator multiplied by 4
  PRICLKEN = On ;Primary clock is always enabled
  FCMEN = OFF ;Fail-Safe Clock Monitor disabled
  IESO = OFF ;Oscillator Switchover mode disabled
  PWRTEN = OFF ;Power up timer disabled
  BOREN = SBORDIS ;Brown-out Reset enabled in hardware only (SBOREN is disabled)
  BORV = 190 ;VBOR set to 1.90 V nominal
  WDTEN = OFF ;Watch dog timer is always disabled. SWDTEN has no effect.
  WDTPS = 32768 ;1:32768
  CCP2MX = PORTC1 ;CCP2 input/output is multiplexed with RC1
  PBADEN = OFF ;PORTB<5:0> pins are configured as digital I/O on Reset
  CCP3MX = PORTB5 ;P3A/CCP3 input/output is multiplexed with RB5
  HFOFST = OFF ;HFINTOSC output and ready status are delayed by the oscillator stable status
  T3CMX = PORTC0 ;T3CKI is on RC0
  P2BMX = PORTD2 ;P2B is on RD2
  MCLRE = EXTMCLR ;MCLR pin enabled, RE3 input pin 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 ;Disabled
  CP0 = OFF ;Block 0 (000800-003FFFh) not code-protected
  CP1 = OFF ;Block 1 (004000-007FFFh) not code-protected
  CP2 = OFF ;Block 2 (008000-00BFFFh) not code-protected
  CP3 = OFF ;Block 3 (00C000-00FFFFh) not code-protected
  CPB = OFF ;Boot block (000000-0007FFh) not code-protected
  CPD = OFF ;Data EEPROM not code-protected
  WRT0 = OFF ;Block 0 (000800-003FFFh) not write-protected
  WRT1 = OFF ;Block 1 (004000-007FFFh) not write-protected
  WRT2 = OFF ;Block 2 (008000-00BFFFh) not write-protected
  WRT3 = OFF ;Block 3 (00C000-00FFFFh) 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-003FFFh) not protected from table reads executed in other blocks
  EBTR1 = OFF ;Block 1 (004000-007FFFh) not protected from table reads executed in other blocks
  EBTR2 = OFF ;Block 2 (008000-00BFFFh) not protected from table reads executed in other blocks
  EBTR3 = OFF ;Block 3 (00C000-00FFFFh) 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
OSCCON.6 = 1 '111 = 16Mhz
OSCCON.5 = 1
OSCCON.4 = 1
OSCTUNE.6 = 1 '(multiplier 4 on 16*4 =64 MHZ)
'
'
'
        Declare Hserial_Baud=9600 
        Declare Hserial_RCSTA=$90h 
        Declare Hserial_TXSTA=$20h 
        Declare Hserial_Clear=On   
        Declare Hserial_SPBRG=25   
   
            On_Hardware_Interrupt GoTo Kesme                 
           
            Symbol GIE  =INTCON.7   'genel interruptlar  aciyor
            Symbol PEIE =INTCON.6   'Cevresel kesmeleri  aciyor
            'Symbol INTE =INTCON.4   'RB0 Kesmesini aciyor
            'Symbol INTF =INTCON.1   'RB0 kesme bayragi
            Symbol RCIE =PIE1.5     'USART kesmesini aciyor
            Symbol RCIF =PIR1.5     'USART Receive interrupt flag bit
            Symbol INTEDG0 = INTCON2.6
   
            GIE=1     'Butun kesmeler devrede
            'INTE=1    'RB0 kesmesi devrede       
            RCIE=1    'USART kesmesi devrede
            PEIE=1    'Cevresel kesmeler devrede
            INTEDG0 = 0

fakat seri haberleşme yapamıyorum
Declare Xtal = 16 yerine Declare Xtal =64
Declare Hserial_SPBRG=25  yerine de Declare Hserial_SPBRG=103 verince seri haberleşme sorunsuz çalışıyor fakat sistem yavaş çalışmaya başlıyor acaba pll ile seri haberleşme için yapmam gereken farklı bir şeyler mi var yardımlarınızı bekliyorum


Powered by EzPortal