Guest User

MikroC

a guest
Nov 19th, 2013
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 7.44 KB | None | 0 0
  1.  
  2. sbit GLCD_D0 at RB7_bit;
  3. sbit GLCD_D1 at RB8_bit;
  4. sbit GLCD_D2 at RB9_bit;
  5. sbit GLCD_D3 at RB10_bit;
  6. sbit GLCD_D4 at RB12_bit;
  7. sbit GLCD_D5 at RB13_bit;
  8. sbit GLCD_D6 at RB14_bit;
  9. sbit GLCD_D7 at RB15_bit;
  10.  
  11. sbit GLCD_D0_Direction at TRISB7_bit;
  12. sbit GLCD_D1_Direction at TRISB8_bit;
  13. sbit GLCD_D2_Direction at TRISB9_bit;
  14. sbit GLCD_D3_Direction at TRISB10_bit;
  15. sbit GLCD_D4_Direction at TRISB12_bit;
  16. sbit GLCD_D5_Direction at TRISB13_bit;
  17. sbit GLCD_D6_Direction at TRISB14_bit;
  18. sbit GLCD_D7_Direction at TRISB15_bit;
  19.  
  20.  
  21. sbit GLCD_CS1 at LATB5_bit;
  22. sbit GLCD_CS2 at LATB4_bit;
  23. sbit GLCD_RS at LATB3_bit;
  24. sbit GLCD_RW at LATB1_bit;
  25. sbit GLCD_EN at LATB6_bit;
  26. sbit GLCD_RST at LATB11_bit;
  27.  
  28. sbit GLCD_CS1_Direction at TRISB5_bit;
  29. sbit GLCD_CS2_Direction at TRISB4_bit;
  30. sbit GLCD_RS_Direction at TRISB3_bit;
  31. sbit GLCD_RW_Direction at TRISB1_bit;
  32. sbit GLCD_EN_Direction at TRISB6_bit;
  33. sbit GLCD_RST_Direction at TRISB11_bit;
  34.  
  35.  
  36. // ------------------------------------------------------
  37. // GLCD Picture name: K1.BMP
  38. // GLCD Model: KS0108 128x64
  39. // ------------------------------------------------------
  40.  
  41.  
  42. void Glcd_Image(code const unsigned short *image);
  43. void Glcd_Dot(unsigned short x_pos, unsigned short y_pos, unsigned short color);
  44. void Glcd_Fill(unsigned short pattern);
  45. void GLCD_Rectangle(unsigned char x, unsigned char y, unsigned char b, unsigned char a);
  46. unsigned long adc_result = 0;
  47. char ertek[12];
  48. int ff;
  49.  
  50. // ------------------------------------------------------
  51. // GLCD Picture name: Névtelen.bmp
  52. // GLCD Model: KS0108 128x64
  53. // ------------------------------------------------------
  54.  
  55. const code char k1[1024] = {
  56.   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
  57.   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
  58.   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
  59.   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
  60.   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   4,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
  61.   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
  62.   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
  63.   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
  64. };
  65.  
  66.  
  67.  
  68.  
  69.  
  70. void main() {
  71.  
  72.   //  PORT A és PORTB = 0;
  73.     PORTA = 0x0000;
  74.     PORTB = 0x0000;
  75.  
  76.    
  77.  
  78.   //PORTA analóg, PORTB digitális láb (section 11.1.2 of the PIC32MX1XX/2XX datasheet)
  79.     ANSELA = 1;
  80.     ANSELB = 0;
  81.  
  82.  
  83.  
  84.  
  85.     TRISA = 1;          // PORTA bemenet, PORTB kimenet
  86.     TRISB = 0;
  87.     JTAGEN_bit = 0;     // JTAG lábak letiltása
  88.     Glcd_Init();                                   // GLCD Inicializálás
  89.     Glcd_Fill(0x00);                               // Képernyő kitöltés fehérrel (törlés)
  90.     ADC1_Init();
  91.  
  92.     CM1CON = 0;
  93.     CM2CON = 0;
  94.     CM3CON = 0; // Komparátorok;
  95.  
  96.  
  97.  
  98.  
  99.   do {
  100.      Glcd_Image(k1);
  101.      delay_ms(1000);
  102.      Glcd_Dot(20,20,1);
  103.      delay_ms(1000);
  104.      Glcd_Rectangle(20,20,40,40,1);
  105.      delay_ms(1000);
  106.  
  107.    } while(1);
  108. }
Advertisement
Add Comment
Please, Sign In to add comment