yukarı aşşağı tuş fonksiyonu grafik Lcd için ph metre demo

Başlatan ido2323, 14 Şubat 2014, 22:46:27

ido2323

yukarı ve aşşağı tuşu olan bir ph metrenin c kodunu yazmaya çalışıyorum ama bi yerde eksik var görüntü gelmiyor fark edemedim yardımcı olacak arkadaşlara şimdiden teşekkürler

videodeki menu geçişini yapabilmek istiyorum acaba bi yordamı varmı ? https://www.youtube.com/watch?v=P_HNk190fLY

#include <18f4550.h>
#include <wolwo.h>

#ifndef GLCD_DATA
#define GLCD_DATA    PORT_D   // Chip Selection 1
#endif

#ifndef MCUCLK
#define MCUCLK      Nop4   // Chip Selection 1
#endif

#ifndef KS0108_DATA
#define KS0108_DATA    PORT_D   // Chip Selection 1
#endif

#ifndef GLCD_CS1
#define GLCD_CS1     PIN_B0   // Chip Selection 1
#endif

#ifndef GLCD_CS2
#define GLCD_CS2     PIN_B1   // Chip Selection 2
#endif

#ifndef GLCD_DI
#define GLCD_DI      PIN_B2   // Data or Instruction input
#endif

#ifndef GLCD_RW
#define GLCD_RW      PIN_B4   // Read/Write
#endif

#ifndef GLCD_E
#define GLCD_E       PIN_B5   // Enable
#endif

#ifndef GLCD_RST
#define GLCD_RST     PIN_C0   // Reset



#fuses HS, NOWDT, NOPROTECT, NOBROWNOUT, NOLVP, NOPUT, NOWRT, NODEBUG, NOCPD
#use delay (clock=20000000)

#include <HDM64GS12.c>
#include <graphics.c>
#include <KS0108.c>

#use fast_io(a)

#define buton pin_a0
#define buton1 pin_a1
#define buton2 pin_a2
#define buton3 pin_a3



    char yazi1[]= "pH mesaurement";
    char yazi2[]= "pH calibration";
    char yazi3[]= "Settings";
    char yazi4[]= "Time mesaurement";
    char fig[]= ">";
     int k=0;
   
   
void glcd_showimage3()
{
  int16 n=0;
  int i,j;
  int1 cs=0;
   // Loop through the vertical pages
   for(i = 0; i <8; ++i)
   {
      output_low(GLCD_DI);                      // Set for instruction
      glcd_writeByte(GLCD_LEFT, 0b01000000);    // Set horizontal address to 0
      glcd_writeByte(GLCD_RIGHT, 0b01000000);
      glcd_writeByte(GLCD_LEFT, i | 0b10111000);// Set page address
      glcd_writeByte(GLCD_RIGHT, i | 0b10111000);
      output_high(GLCD_DI);                     // Set for data

      // Loop through the horizontal sections
      for(j = 0; j < 128;++j)
      {
         if(j<64) cs=GLCD_LEFT;else cs=GLCD_RIGHT;
         glcd_writeByte(cs,Resim[n]);  // Turn pixels on or off
         //delay_us(5);
        n++;
      }
   }
}   
 
void main()
{

      setup_psp(PSP_DISABLED);
      setup_timer_1(T1_DISABLED);
      setup_timer_2(T2_DISABLED,0,1);
      setup_adc_ports(NO_ANALOGS);
      setup_adc(ADC_OFF);
      setup_CCP1(CCP_OFF);
      setup_CCP2(CCP_OFF);
     
      set_tris_a(0Xff);
     
      output_a(0x00);

   //glcd_showimage3();
  //glcd_init(ON);
 
   
     
     
     
while(1)
   { 
 
   //--------------------------------------
    if(input(buton1))
    {
    delay_ms(15);

    k=k+1;
    while(input(buton1));
   
    if (k==5)
    {
    k=1;

    }
   
    }
//--------------------------------------
   if(input(buton2))
    {
    delay_ms(15);

    k=1-k;
    k=k*-1;
    while(input(buton2));
   
    if (k==0)
    {
    k=4;

    }
   
    }

     if(k=1)
     {
       glcd_text57(12, 5, yazi1, 1, ON);
    glcd_text57(12, 20, yazi2, 1, ON);
    glcd_text57(12, 35, yazi3, 1, ON);
    glcd_text57(12, 50, yazi4, 1, ON);
     glcd_text57(2, 5, fig, 1, ON);
     
     }
     
     
     else if(k=2)
     {
       glcd_text57(12, 5, yazi1, 1, ON);
    glcd_text57(12, 20, yazi2, 1, ON);
    glcd_text57(12, 35, yazi3, 1, ON);
    glcd_text57(12, 50, yazi4, 1, ON);
     glcd_text57(2, 20, fig, 1, ON);
     
     }
     
     
     else if(k=3)
     {
       glcd_text57(12, 5, yazi1, 1, ON);
    glcd_text57(12, 20, yazi2, 1, ON);
    glcd_text57(12, 35, yazi3, 1, ON);
    glcd_text57(12, 50, yazi4, 1, ON);
     glcd_text57(2, 35, fig, 1, ON);
   
     }
     
   
     else if(k=4)
     {
       glcd_text57(12, 5, yazi1, 1, ON);
    glcd_text57(12, 20, yazi2, 1, ON);
    glcd_text57(12, 35, yazi3, 1, ON);
    glcd_text57(12, 50, yazi4, 1, ON);
     glcd_text57(2, 50, fig, 1, ON);
   
     }
//--------------------------------------

//switch(i)
//{
//case 1:           continue;
//case 2:          continue;
//case 3:          continue;
//case 4:          continue;
//case 5:      continue;
//}

   }
}