mikroC PRO for AVR 2008 Glcd proje_1

Başlatan ahmet2004, 29 Aralık 2008, 19:32:22

ahmet2004

mikroC PRO for AVR 2008 derleyicisi kullanılarak yapılmış(kendi kodu)
Glcd 128x64 ile grafik komutları kullanılmıştır.

İşlemci: ATmega16
Xtal:     16Mhz
Glcd:    KS0108


// ------------------------------------------------------
// GLCD Picture name: ataturk3a.bmp
// GLCD Model: KS0108 128x64
// ------------------------------------------------------

unsigned char const ataturk3a_bmp[1024] = {
   
073,  042,128166640,  1,148643716,1386441,
 
13232,148661674,16010,16021,1607432,1496436,
 
1467237,14474,16018,20136,1466524,19618,20037,
 
20036,21040,194,169,212,162,23282,233,180,210,104,213,104,
 
178,201,116,16090,22584,200,114,168,242,169,240,173,240,217,
 
116,217,24489,24489,244,216,106,213,104,218,104,213,168,114,
 
200,114,164,161,21233,19618,201,  4,17017406950,137,
 
100,14673,178,  9,22826,19342,20810,22818,20152,129,
   
0,169,  4,16184106540,14964,149,104,  5,2104069,
 
17016,20253,136,101,146,108,  2,249,  4,106,149,104,133,122,
 
129,124,131,120,198,185,23686,249,214,125,235,252,175,250,255,
 
170,255,119,25395,246,127,219,254,111,251,190,235,255,186,237,
 
255,170,255,237,191,247,221,25587,253,111,25095,251,238,187,
 
255,173,255,213,127,235,255,173,255,181,255,215,125,24794,251,
 
109,255,170,255,106,189,24691,173,11889,1668936,14664,
  
1032,13142,  5,154,101,154,109,21045,218,101,154,109,146,
  
1674,16418,20136,14677,16026,1964281,172,  2,249,
   
6,23320,23520,23421,23421,23453,202,117,138,117,170,
 
213,18784,207,117,254,183,221,25587,25387,254,171,127,234,
 
191,237,183,251,223,109,247,19185,255,173,247,190,219,111,250,
 
175,25387,254,171,255,218,111,247,189,215,25585,255,170,255,
 
213,127,234,191,213,255,170,25585,25586,25193,175,24595,
 
24591,174,245,18777,242,16986,161,19617,160,  51674,
   
0,169,  480,  272,  2,136,16384,171,221,102,153,11083,
  
6641,1489821,20038,217,  2,252,  3,21639,21639,216,
  
39,216,103,152,23918,23786,169,21491,22891,172,119,169,
 
110,18794,23539,221,10326,111,15145,1593731,14187,
  
14,17179,134277921,17591,175,149,255,154,23985,223,
 
102,155,239,  5,219,  6,171,  7,16571,150,13123,19739,210,
 
13521,19919,19819,13483,13383,165,134,211,109,166,219,
 
173,251,173,118,219,109,182,219,109,183,218,173,118,173,246,169,
 
222,10822,106,183,  3,249,16580,17164,215,122,141,24393,
  
6528,19556,133,122,133,114,140,115,136,119,136,247,  8,247,
   
8,24742,213,110,17778,25137,218,109,182,107,182,219,173,
 
123,173,21561,22353,222,123,173,126,213,250,111,249,190,235,
 
189,246,221,122,223,106,253,174,245,254,171,255,254,171,25593,
 
24793,24691,237,182,253,151,25255,218,126,171,253,186,237,
 
222,117,190,235,126,181,223,106,191,109,151,25411,25315,246,
  
11,18970,1557739,153,102,137,119,136,119,17287,250,223,
 
106,255,213,126,213,12619461731851063,  9,18213,
  
8112,22724,103,144,111,144,10720,23520,23520,23521,
 
23851,204,119,153,102,189,21161,202,117,207,117,154,24790,
 
173,247,170,127,168,247,168,21541,21358,19759,196,17973,
 
23049,218,111,17977,24378,179,20798,14399,20271,227,
   
5,24369,17973,11473,18190,10190,11116,127,136,115,
  
24,16781,17085,170,117,142,113,15865,1906546,145,110,
 
145,1108146,20914,24110,116113618,  534,  5,  0,
   
132,  464,  0,  0,136,  116,128,  2,  017,  068,  0,
   
8,1658244,131,120,  6,23322,105,150,105,150,105,150,105,
 
18275,24526,23158,213,174,117,171934261,  7,188,  7,
  
42,141,  6,163,  574,  134,129,  833,134,  1,1503718,
  
79499443,244,19182,25482,25274,24478,24292,162,
 
252,166,216,110,210,173,118,218,165,25485,238,18191,24675,
 
12522,1091815321532,  241,  02074,  122,  1,
  
66,  9,  233,  2,  116,  2,  032,  1,  0,136,  0,  132,
   
264,  0,  4,  064,  8,  0,128,  0,  8,129,  0,  0,136,  0,
   
0854069,146417049,1429730,16194333033,
  
30,  146,  1,  717,  1,  417,  0,  4,  116,  0,  232,
   
07432,146,10422,16982,13752,1398410,  466,  0,
   
9,  033,  0,  2,200,187,225,181,195,165,203,  5,163,133,195,
 
133,194,135,193,  7,193,  7,161,  6,129,  316,  3,  0,  1,  8,
   
0,  1,  016,  132,  0,  017,  0,  018,  0,  016,  2,
   
0,  018,  0,  0,  1,  8,  0,  1,  0,  8,  016,  0,  0,  2,
   
016,  0,  2,  0,  8,  0,  0,  8,  0,  0,  8,  0,  0,  8,  0
};


// Glcd module connections
char GLCD_DataPort at PORTC;
char GLCD_DataPort_Direction at DDRC;

sbit GLCD_CS1 at PORTD.B2;
sbit GLCD_CS2 at PORTD.B3;
sbit GLCD_RS  at PORTD.B4;
sbit GLCD_RW  at PORTD.B5;
sbit GLCD_EN  at PORTD.B6;
sbit GLCD_RST at PORTD.B7;

sbit GLCD_CS1_Direction at DDRD.B2;
sbit GLCD_CS2_Direction at DDRD.B3;
sbit GLCD_RS_Direction  at DDRD.B4;
sbit GLCD_RW_Direction  at DDRD.B5;
sbit GLCD_EN_Direction  at DDRD.B6;
sbit GLCD_RST_Direction at DDRD.B7;
// End Glcd module connections

void delay2S(){                             // 2 seconds delay function
  
Delay_ms(2000);
}

void main() {
  
unsigned short ii;
  
char *someText;

  
Glcd_Init();                              // Initialize GLCD
  
Glcd_Fill(0x00);                          // Clear GLCD

  
while(1) {
    
Glcd_Image(ataturk3a_bmp);                  // Draw image
    
delay2S(); delay2S();

    
Glcd_Fill(0x00);                        // Clear GLCD

    
Glcd_Box(62,40,124,56,1);               // Draw box
    
Glcd_Rectangle(5,5,84,35,1);            // Draw rectangle
    
Glcd_Line(0, 0, 127, 63, 1);            // Draw line
    
delay2S();

    
for&#40;ii = 5; ii < 60; ii+=5 &#41;&#123;           // Draw horizontal and vertical lines
      
Delay_ms&#40;250&#41;;
      
Glcd_V_Line&#40;2, 54, ii, 1&#41;;
      
Glcd_H_Line&#40;2, 120, ii, 1&#41;;
    
&#125;

    
delay2S&#40;&#41;;

    
Glcd_Fill&#40;0x00&#41;;                        // Clear GLCD

    
Glcd_Set_Font&#40;Character8x7, 8, 7, 32&#41;;  // Choose font, see __Lib_GLCDFonts.c in Uses folder
    
Glcd_Write_Text&#40;"picproje", 1, 7, 2&#41;;     // Write string

    
for &#40;ii = 1; ii <= 10; ii++&#41;            // Draw circles
      
Glcd_Circle&#40;63,32, 3*ii, 1&#41;;
    
delay2S&#40;&#41;;

    
Glcd_Box&#40;12,20, 70,57, 2&#41;;              // Draw box
    
delay2S&#40;&#41;;

    
Glcd_Fill&#40;0xFF&#41;;                        // Fill GLCD

    
Glcd_Set_Font&#40;Character8x7, 8, 7, 32&#41;;  // Change font
    
someText "8x7 Font";
    
Glcd_Write_Text&#40;someText, 5, 0, 2&#41;;     // Write string
    
delay2S&#40;&#41;;

    
Glcd_Set_Font&#40;System3x5, 3, 5, 32&#41;;     // Change font
    
someText "3X5 CAPITAL";
    
Glcd_Write_Text&#40;someText, 60, 2, 2&#41;;    // Write string
    
delay2S&#40;&#41;;

    
Glcd_Set_Font&#40;font5x7, 5, 7, 32&#41;;       // Change font
    
someText "5x7 Font";
    
Glcd_Write_Text&#40;someText, 5, 4, 2&#41;;     // Write string
    
delay2S&#40;&#41;;

    
Glcd_Set_Font&#40;FontSystem5x7_v2, 5, 7, 32&#41;; // Change font
    
someText "5x7 Font &#40;v2&#41;";
    
Glcd_Write_Text&#40;someText, 50, 6, 2&#41;;     // Write string
    
delay2S&#40;&#41;;
  
&#125;
&#125;