18f452 GLCD kullanım sorunu

Başlatan salih_arel, 20 Temmuz 2012, 09:09:13

salih_arel

Merhaba arkadaşlar. Elimde yapmaya çalıştığım projem 18f452 ile glcd ekrana yazı yazdırma fakat tüm bağlantıları doğru şekilde yapmama ragmen çalışmadı. İnternette araştırma yaptım erhan harmankaya diye bi arkadaşımızın aynı şekilde prjesini buldum. Benim tek değişikliğim 20 Mhz osilatör ile çalışıyorum.

İnternette bulduğum kaynak kod bu. Acaba bunu 20 Mhz de nasıl çalıştırabilirim. Sadece osilatör seçimini değiştirsem yetermi veya başka hesaplamalar yapmam gerekmi. Yardım lütfenn....


#include <18F452.h>

#use delay(clock=4000000)
#define GLCD_WIDTH   128

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES WDT128                   //Watch Dog Timer uses 1:128 Postscale
#FUSES HS                       //High speed Osc (> 4mhz)
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NOOSCSEN                 //Oscillator switching is disabled, main oscillator is source
#FUSES BROWNOUT                 //Reset when brownout detected
#FUSES BORV27                   //Brownout reset at 2.7V
#FUSES NOPUT                    //No Power Up Timer
#FUSES STVREN                   //Stack full/underflow will cause reset
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#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
#FUSES CCP2B3

#include "HDM64GS12.c"
#include "graphics.c"

/*
EKRANA RESMİ BASACAK ASM KODLARI BUNLAR BMP2ASM İLE OLUŞTURDUK
*/
   const int harmankaya[]= {
       0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x1F,0x1F,0x1F,0xFF,0xFF,0x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00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF
       0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x02,0xF7,0xE2,0x00,0x00,0x00,0xFE,0xFF,0xC0,0xC0,0xE0,0x60,0x30,0x38,0x1C,0x0E,0x06,0x03,0x00,0x00,0xC0,0xE0,0x60,0x30,0x30,0x30,0x30,0x60,0xE0,0xC0,0x00,0x00,0x80,0xC0,0xE0,0x60,0x30,0x30,0x30,0x30,0x30,0x60,0xC0,0x80,0x00,0x30,0xF0,0xE0,0x00,0x00,0x00,0x00,0x80,0xE0,0xE0,0xC0,0x00,0x00,0x00,0x00,0xC0,0xF0,0x70,0x00,0x00,0x00,0xFE,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF
       0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x7F,0x00,0x00,0x00,0x7F,0xFF,0x03,0x03,0x07,0x0E,0x0C,0x18,0x38,0x70,0x60,0xC0,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0x00,0x00,0x1F,0x3F,0x70,0x60,0xC0,0xC0,0xC0,0xC0,0x40,0x60,0x39,0x1F,0x07,0x00,0x01,0x07,0x3F,0xF8,0xF8,0x3E,0x0F,0x01,0x01,0x07,0x3F,0x78,0xF8,0x3E,0x0F,0x01,0x00,0x00,0x00,0x00,0x4F,0xCF,0x47,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF
       0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF
       0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF
                            };
   
 



//*********
unsigned int i,j, k;
unsigned int16 sayac=0;

//-------------------------{}----------------------------
void bitmap_world(int x, int y)
{

int width = 128;
int height = 64;
for(i=0;i<height;i+=8) {
   for(j=0;j<width;j++) {
      for(k=0;k<8;k++)
      {
            if(bit_test(harmankaya[sayac],k)){
               glcd_pixel(x+j,y+i+k,ON);
         
            } //ifin           
               
      }
      sayac++;
   }
}
}
//-------------------------{}----------------------------   
void ilkekran(int16 bekleme){
bitmap_world(0,0);

delay_ms(bekleme);
}
//-------------------------{}----------------------------

void main()
{
   setup_adc_ports(RA0_ANALOG);
   setup_adc(ADC_OFF);
   set_adc_channel(0);
   setup_psp(PSP_DISABLED);
   SETUP_SPI(SPI_MASTER | SPI_CLK_DIV_16 | SPI_H_TO_L |SPI_XMIT_L_TO_H ); //msdos
   setup_wdt(WDT_OFF);
   setup_timer_0(RTCC_INTERNAL);
   setup_timer_1( T1_INTERNAL | T1_DIV_BY_1);
   setup_timer_2(T2_DISABLED,0,1);
   setup_timer_2(T2_DIV_BY_4, 255,4);
   setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
   
   
   disable_interrupts(GLOBAL);
   
   glcd_init(ON);     

   ilkekran(1);

   while(TRUE){
   // DEVAM
   }
   




esensoy

vakti zamanında bu kodu mplab c18 de 18f4620 için çalıştırmışım,
https://hotfile.com/dl/163851227/96704a1/ks0108.rar.html
umarım işine yarar
En tehlikeli an "zafer" anıdır.