4x PLL kullanımı ve portlar

Başlatan ahmet2004, 21 Ocak 2009, 11:57:19

ahmet2004

#include <18F452.h>
#device adc=8

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES WDT128                   //Watch Dog Timer uses 1:128 Postscale
#FUSES H4                       //High speed osc with HW enabled 4X PLL
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NOOSCSEN                 //Oscillator switching is disabled, main oscillator is source
#FUSES NOBROWNOUT                 //Reset when brownout detected
#FUSES BORV20                   //Brownout reset at 2.0V
#FUSES NOPUT                    //No Power Up Timer
#FUSES STVREN                   //Stack full/underflow will cause reset
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES NOLVP                      //Low Voltage Programming on B3(PIC16) or B5(PIC18)
#FUSES NOWRT                    //Program memory not write protected
#FUSES NOWRTD                   //Data EEPROM not write protected
#FUSES NOWRTB                   //Boot block not write protected
#FUSES NOWRTC                   //configuration not registers write protected
#FUSES NOCPD                    //No EE protection
#FUSES NOCPB                    //No Boot Block code protection
#FUSES NOEBTR                   //Memory not protected from table reads
#FUSES NOEBTRB                  //Boot block not protected from table reads

#use delay(clock=40M, oscillator=10M)




void main()
{

   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);
   setup_psp(PSP_DISABLED);
   setup_spi(SPI_SS_DISABLED);
   setup_wdt(WDT_OFF);
   setup_timer_0(RTCC_INTERNAL);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_timer_3(T3_DISABLED|T3_DIV_BY_1);

   while(1)
   {
      output_toggle(PIN_B4);
   }

}




40Mhz clock sinyalinde output_toggle(PIN_B4) komutunda

şekilde görüleceği üzeri B4 çıkışı Periyot=800ns , Frekans 1250Khz.


output_toggle(PIN_B4) komutunun assembler yazılışı(3 komut kullanılıyor.)
***** BCF    TRISB.4
***** BTG    LATB.4
***** BRA    0052

Erol YILMAZ

"BCF    TRISB.4"  yi kaldırsan 2 komuta düşer.

ahmet2004

CCS in kendi komut'u öyle asm kullanmış toogle komutunda.

Benim bir katkım yok.O zaman C dilini kullanmak herzaman daha iyi.

Birde CCS nin komutları hep böyle şişikse kod bayaa uzayacaktır.