Jump to content
ELFORUM - Forumul Electronistilor
aetius

GLCD kS0108

Recommended Posts

// Glcd module connections
char GLCD_DataPort at PORTB;

sbit GLCD_CS1 at RC5_bit;
sbit GLCD_CS2 at RC4_bit;
sbit GLCD_RS  at RC3_bit;
sbit GLCD_RW  at RC2_bit;
sbit GLCD_EN  at RC1_bit;
sbit GLCD_RST at RC0_bit;

sbit GLCD_CS1_Direction at TRISC5_bit;
sbit GLCD_CS2_Direction at TRISC4_bit;
sbit GLCD_RS_Direction  at TRISC3_bit;
sbit GLCD_RW_Direction  at TRISC2_bit;
sbit GLCD_EN_Direction  at TRISC1_bit;
sbit GLCD_RST_Direction at TRISC0_bit;
// End Glcd module connections



 unsigned long TensADC;
 unsigned long V,V1;


const unsigned short Tahoma31x44[] = {
   0x00,
   0x00,
   0x2F,0x00,
   0x39,0x00,
   0x2C,
   0x00,
   0x1F,0x34,0x00,0x00,
   0x1D,0xE4,0x00,0x00,
   0x1C,0x94,0x01,0x00,
   0x1E,0x44,0x02,0x00,
   0x1D,0xF4,0x02,0x00,
   0x1E,0xA4,0x03,0x00,
   0x1D,0x54,0x04,0x00,
   0x1D,0x04,0x05,0x00,
   0x1D,0xB4,0x05,0x00,
   0x1E,0x64,0x06,0x00,
   0x1D,0x14,0x07,0x00,
   0xFF,0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0x7F,0xFF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,0x0F,0xF8,0x0F,0xF8,0x0F,0xF8,0x0F,0xF8,0x0F,0xF8,0x0F,0xF0,0x1F,0xFC,0x07,0xF0,0x3F,0xFE,0x07,0xE0,0xFF,0xFF,0x03,0xE0,0xFF,0xFF,0x03,0xC0,0xFF,0xFF,0x01,0x80,0xFF,0xFF,0x00,0x00,0xFE,0x3F,0x00,0x00,0xF8,0x0F,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, // Code for char num 48
   0x00,0x00,0x00,0x00,0x00,0xE0,0x1F,0x00,0x00,0xE0,0x1F,0x00,0x00,0xF0,0x1F,0x00,0x00,0xF8,0x1F,0x00,0x00,0xFE,0x1F,0x00,0xE0,0xFF,0x1F,0x00,0xE0,0xFF,0x1F,0x00,0xE0,0xFF,0x1F,0x00,0xE0,0xFF,0x1F,0x00,0xE0,0xFF,0x1F,0x00,0xE0,0xFF,0x1F,0x00,0x00,0xF0,0x1F,0x00,0x00,0xF0,0x1F,0x00,0x00,0xF0,0x1F,0x00,0x00,0xF0,0x1F,0x00,0x00,0xF0,0x1F,0x00,0x00,0xF0,0x1F,0x00,0x00,0xF0,0x1F,0x00,0x00,0xF0,0x1F,0x00,0x00,0xF0,0x1F,0x00,0x00,0xF0,0x1F,0x00,0x00,0xF0,0x1F,0x00,0x00,0xF0,0x1F,0x00,0x00,0xF0,0x1F,0x00,0x00,0xF0,0x1F,0x00,0x00,0xF0,0x1F,0x00,0x00,0xF0,0x1F,0x00,0x00,0xF0,0x1F,0x00,0x00,0xF0,0x1F,0x00,0xE0,0xFF,0xFF,0x0F,0xE0,0xFF,0xFF,0x0F,0xE0,0xFF,0xFF,0x0F,0xE0,0xFF,0xFF,0x0F,0xE0,0xFF,0xFF,0x0F,0xE0,0xFF,0xFF,0x0F,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, // Code for char num 49
   0x00,0xF8,0x0F,0x00,0x80,0xFF,0x7F,0x00,0xE0,0xFF,0xFF,0x00,0xE0,0xFF,0xFF,0x01,0xE0,0xFF,0xFF,0x03,0xE0,0xFF,0xFF,0x07,0xE0,0xFF,0xFF,0x07,0xE0,0x07,0xFF,0x0F,0xE0,0x00,0xFC,0x0F,0x20,0x00,0xFC,0x0F,0x00,0x00,0xF8,0x0F,0x00,0x00,0xF8,0x0F,0x00,0x00,0xF8,0x0F,0x00,0x00,0xF8,0x0F,0x00,0x00,0xF8,0x0F,0x00,0x00,0xFC,0x07,0x00,0x00,0xFC,0x07,0x00,0x00,0xFE,0x03,0x00,0x00,0xFE,0x03,0x00,0x00,0xFF,0x01,0x00,0x80,0xFF,0x01,0x00,0xC0,0xFF,0x00,0x00,0xE0,0x7F,0x00,0x00,0xF0,0x3F,0x00,0x00,0xF8,0x1F,0x00,0x00,0xFC,0x0F,0x00,0x00,0xFE,0x07,0x00,0x00,0xFF,0x03,0x00,0x80,0xFF,0x01,0x00,0xC0,0x7F,0x00,0x00,0xF0,0xFF,0xFF,0x3F,0xF0,0xFF,0xFF,0x3F,0xF0,0xFF,0xFF,0x3F,0xF0,0xFF,0xFF,0x3F,0xF0,0xFF,0xFF,0x3F,0xF0,0xFF,0xFF,0x3F,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, // Code for char num 50
   0x00,0xFE,0x0F,0x00,0xE0,0xFF,0x7F,0x00,0xF8,0xFF,0xFF,0x01,0xF8,0xFF,0xFF,0x03,0xF8,0xFF,0xFF,0x07,0xF8,0xFF,0xFF,0x07,0xF8,0xFF,0xFF,0x0F,0xF8,0x03,0xFE,0x0F,0x78,0x00,0xFC,0x0F,0x18,0x00,0xF8,0x0F,0x00,0x00,0xF8,0x0F,0x00,0x00,0xF8,0x0F,0x00,0x00,0xF8,0x07,0x00,0x00,0xFC,0x07,0x00,0x00,0xFF,0x03,0x00,0xFC,0xFF,0x01,0x00,0xFC,0xFF,0x00,0x00,0xFC,0x3F,0x00,0x00,0xFC,0xFF,0x00,0x00,0xFC,0xFF,0x03,0x00,0xFC,0xFF,0x07,0x00,0x00,0xFE,0x0F,0x00,0x00,0xF8,0x0F,0x00,0x00,0xF0,0x1F,0x00,0x00,0xF0,0x1F,0x00,0x00,0xF0,0x1F,0x00,0x00,0xF0,0x1F,0x0C,0x00,0xF8,0x1F,0x3C,0x00,0xF8,0x1F,0xFC,0x01,0xFE,0x0F,0xFC,0xFF,0xFF,0x0F,0xFC,0xFF,0xFF,0x07,0xFC,0xFF,0xFF,0x07,0xFC,0xFF,0xFF,0x03,0xFC,0xFF,0xFF,0x00,0xF0,0xFF,0x3F,0x00,0x00,0xFF,0x07,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, // Code for char num 51
   0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0x01,0x00,0x80,0xFF,0x01,0x00,0xC0,0xFF,0x01,0x00,0xE0,0xFF,0x01,0x00,0xE0,0xFF,0x01,0x00,0xF0,0xFF,0x01,0x00,0xF8,0xFF,0x01,0x00,0xFC,0xFF,0x01,0x00,0xFC,0xFF,0x01,0x00,0x7E,0xFF,0x01,0x00,0x3F,0xFF,0x01,0x00,0x1F,0xFF,0x01,0x80,0x1F,0xFF,0x01,0xC0,0x0F,0xFF,0x01,0xE0,0x07,0xFF,0x01,0xE0,0x07,0xFF,0x01,0xF0,0x03,0xFF,0x01,0xF8,0x01,0xFF,0x01,0xF8,0x01,0xFF,0x01,0xFC,0x00,0xFF,0x01,0x7E,0x00,0xFF,0x01,0xFE,0xFF,0xFF,0x3F,0xFE,0xFF,0xFF,0x3F,0xFE,0xFF,0xFF,0x3F,0xFE,0xFF,0xFF,0x3F,0xFE,0xFF,0xFF,0x3F,0xFE,0xFF,0xFF,0x3F,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x01,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, // Code for char num 52
   0x00,0x00,0x00,0x00,0xE0,0xFF,0xFF,0x0F,0xE0,0xFF,0xFF,0x0F,0xE0,0xFF,0xFF,0x0F,0xE0,0xFF,0xFF,0x0F,0xE0,0xFF,0xFF,0x0F,0xE0,0xFF,0xFF,0x0F,0xE0,0x1F,0x00,0x00,0xE0,0x1F,0x00,0x00,0xE0,0x1F,0x00,0x00,0xE0,0x1F,0x00,0x00,0xE0,0x1F,0x00,0x00,0xE0,0x1F,0x00,0x00,0xE0,0xFF,0x1F,0x00,0xE0,0xFF,0xFF,0x00,0xE0,0xFF,0xFF,0x01,0xE0,0xFF,0xFF,0x03,0xE0,0xFF,0xFF,0x07,0xE0,0xFF,0xFF,0x0F,0xE0,0x00,0xFE,0x0F,0x00,0x00,0xFC,0x1F,0x00,0x00,0xF8,0x1F,0x00,0x00,0xF0,0x1F,0x00,0x00,0xF0,0x1F,0x00,0x00,0xF0,0x1F,0x00,0x00,0xF0,0x1F,0x00,0x00,0xF0,0x1F,0x18,0x00,0xF8,0x1F,0x78,0x00,0xFC,0x0F,0xF8,0x01,0xFF,0x0F,0xF8,0xFF,0xFF,0x07,0xF8,0xFF,0xFF,0x07,0xF8,0xFF,0xFF,0x03,0xF8,0xFF,0xFF,0x01,0xF8,0xFF,0xFF,0x00,0xE0,0xFF,0x3F,0x00,0x00,0xFE,0x07,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, // Code for char num 53
   0x00,0x80,0xFF,0x03,0x00,0xF0,0xFF,0x03,0x00,0xFC,0xFF,0x03,0x00,0xFF,0xFF,0x03,0x80,0xFF,0xFF,0x03,0xC0,0xFF,0xFF,0x03,0xC0,0xFF,0x01,0x03,0xE0,0x7F,0x00,0x00,0xF0,0x3F,0x00,0x00,0xF0,0x1F,0x00,0x00,0xF8,0x0F,0x00,0x00,0xF8,0x0F,0x00,0x00,0xF8,0x0F,0x00,0x00,0xF8,0x87,0x3F,0x00,0xFC,0xE7,0xFF,0x00,0xFC,0xFF,0xFF,0x03,0xFC,0xFF,0xFF,0x07,0xFC,0xFF,0xFF,0x07,0xFC,0xFF,0xFF,0x0F,0xFC,0x0F,0xFE,0x0F,0xFC,0x07,0xF8,0x1F,0xFC,0x07,0xF8,0x1F,0xFC,0x07,0xF0,0x1F,0xFC,0x07,0xF0,0x1F,0xFC,0x07,0xF0,0x1F,0xFC,0x07,0xF0,0x1F,0xF8,0x07,0xF0,0x1F,0xF8,0x0F,0xF0,0x1F,0xF8,0x0F,0xF8,0x0F,0xF0,0x1F,0xF8,0x0F,0xF0,0x3F,0xFC,0x0F,0xE0,0xFF,0xFF,0x07,0xE0,0xFF,0xFF,0x03,0xC0,0xFF,0xFF,0x01,0x80,0xFF,0xFF,0x00,0x00,0xFE,0x7F,0x00,0x00,0xF0,0x0F,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, // Code for char num 54
   0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x1F,0xF8,0xFF,0xFF,0x1F,0xF8,0xFF,0xFF,0x1F,0xF8,0xFF,0xFF,0x1F,0xF8,0xFF,0xFF,0x1F,0xF8,0xFF,0xFF,0x1F,0x00,0x00,0xF8,0x1F,0x00,0x00,0xFC,0x0F,0x00,0x00,0xFC,0x0F,0x00,0x00,0xFE,0x07,0x00,0x00,0xFE,0x07,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x03,0x00,0x80,0xFF,0x01,0x00,0x80,0xFF,0x01,0x00,0xC0,0xFF,0x00,0x00,0xC0,0xFF,0x00,0x00,0xE0,0x7F,0x00,0x00,0xE0,0x7F,0x00,0x00,0xF0,0x3F,0x00,0x00,0xF0,0x3F,0x00,0x00,0xF8,0x1F,0x00,0x00,0xFC,0x1F,0x00,0x00,0xFC,0x0F,0x00,0x00,0xFE,0x0F,0x00,0x00,0xFE,0x07,0x00,0x00,0xFF,0x07,0x00,0x00,0xFF,0x03,0x00,0x80,0xFF,0x03,0x00,0x80,0xFF,0x01,0x00,0xC0,0xFF,0x00,0x00,0xC0,0xFF,0x00,0x00,0xE0,0x7F,0x00,0x00,0xE0,0x7F,0x00,0x00,0xF0,0x3F,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, // Code for char num 55
   0x00,0xF8,0x1F,0x00,0x00,0xFF,0xFF,0x00,0xC0,0xFF,0xFF,0x01,0xE0,0xFF,0xFF,0x07,0xF0,0xFF,0xFF,0x0F,0xF8,0xFF,0xFF,0x0F,0xF8,0x1F,0xFC,0x1F,0xFC,0x0F,0xF8,0x1F,0xFC,0x07,0xF0,0x1F,0xFC,0x07,0xF0,0x1F,0xFC,0x07,0xF0,0x1F,0xFC,0x0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,0xFF,0x1F,0x80,0xFF,0xF3,0x0F,0x00,0xFE,0xF0,0x0F,0x00,0x00,0xF8,0x0F,0x00,0x00,0xF8,0x0F,0x00,0x00,0xF8,0x07,0x00,0x00,0xFC,0x07,0x00,0x00,0xFE,0x07,0x00,0x00,0xFF,0x03,0x60,0xC0,0xFF,0x01,0xE0,0xFF,0xFF,0x01,0xE0,0xFF,0xFF,0x00,0xE0,0xFF,0x3F,0x00,0xE0,0xFF,0x1F,0x00,0xE0,0xFF,0x07,0x00,0xE0,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 // Code for char num 57
};





void main()
{

     ADCON0  = 0b00000101;
     ADCON1 = 0b00001110;
     PORTA = 0b00001111;         // bitii 0 si 1 si 3 ai portului A sunt intrari analogice.
     TRISA = 0b00001111;
     PORTB = 0;
     TRISB = 0;
     TRISC = 0;
     PORTC = 0;

     CMCON = 0b00000111;
     CVRCON = 0;

   Glcd_Init();
   ADC_Init();
   Glcd_Fill(0x00);

  while(1)
  {

            TensADC = ADC_Read(0);
            V = (long)TensADC*5000;
            V = V/1023;


     if((V/1000)%10 > (V1/1000)%10)
      {
         Glcd_Set_Font_Adv(&Tahoma31x44, 0,0);
         Glcd_Write_Char_Adv(47, 5, 22);
         Glcd_Write_Char_Adv(47, 35, 22);
         Glcd_Set_Font_Adv(&Tahoma31x44, 1,0);
         Glcd_Write_Char_Adv(V/1000 + 48, 5, 22);

      }
  else
      {
         Glcd_Set_Font_Adv(&Tahoma31x44, 1,0);
         Glcd_Write_Char_Adv(V/1000 + 48, 5, 22);
      }

      if((V/100)%10 > (V1/100)%10)
      {
          Glcd_Set_Font_Adv(&Tahoma31x44, 0,0);
          Glcd_Write_Char_Adv(47, 35, 22);
          Glcd_Set_Font_Adv(&Tahoma31x44, 1,0);
          Glcd_Write_Char_Adv((V/100)%10 + 48, 35, 22);

      }
      else
      {
         Glcd_Set_Font_Adv(&Tahoma31x44, 1,0);
         Glcd_Write_Char_Adv((V/100)%10 + 48, 35, 22);

      }
      Glcd_Set_Font_Adv(&Tahoma31x44, 0,0);
      Glcd_Write_Char_Adv(47, 65, 22);
      Glcd_Set_Font_Adv(&Tahoma31x44, 1,0);
      Glcd_Write_Char_Adv((V%10)+ 48, 65, 22);
      Glcd_Fill(0x00);
      //Delay_ms(5);

     V1 = V;

  }
}
//end

Buna seara,

Incerc in jurul acestui glcd s-a construiesc pentru sursa cu pic ,un voltmetru/ampermetru…(avantaj cifre mai mari).

Dar intampin o problema cifrele flickeresc si exista o perioada de timp destul de mare pina ,arata valoarea citita ...

Codul este luat de pe net...aveti atasat simularea in proteus si hex-ul.

Multumesc pentru citire ,orice ideeie si exemplu sunt binevenite.

New Project.pdsprj Interfacing GLCD with PIC Microcontroller MikroC.hex

Share this post


Link to post
Share on other sites

KS0108 este foarte comun, nimic special.

 

Cateva chestii:

1. Impartiti la 1024, caci aveti 10b completi acolo. Ca valorile sunt intre 0 si 1023 este alta chestie. V=V/1024.

2. Nu lucrez in C, insa ca regula de baza nu fac refresh la ecran decat daca valoarea citita s-a modificat. Citesc in continuu, dar afisez doar daca noua valoare este diferita de precedenta.

3. Comanda Glcd_Fill(0x00) sterge ecranul complet. Trebuie rescrisa numai zona de interes. Nu folositi Fill cu 00 sau FF decat la initializare.

Edited by Thunderer

Share this post


Link to post
Share on other sites

GLCD kS0108 este dintre primele generatii si are un timp de refresh optic de circa 0,5 sec, in consecinta orice s-ar face

 nu se poate decat micsorarea flick-erului, asa cum sunt zeci de postari de pe internet, totusi modelul fizic are

 acest inconvenient diminuat. Pentru semnale cvasiconstante 2-3 secunde, se poate folosi metoda memorarii

 esantionului Vold=V si daca sunt egale nu se face refresh-ul, nu stiu sa schimb fontul.

 Click pentru marire.

ST7735R-atmega328P.thumb.jpg.3f74488fe4cdcffcdab621c0b7e79a8f.jpg

Scuze pentru deturnarea de la titlul topicului, , insa in exemplul urmator se poate face,

ba mai mult imaginea si textul se pot roti si colora iar pretul este acceptabil de mic.

 

Daca va intereseaza am mai multe variante cu PIC si arduino functionale si cu diverse TFT-uri ST7735R si ILI9341

 

@gsabac

TFTDisplayST7735R.rar

Share this post


Link to post
Share on other sites
Posted (edited)

Va salut si va multumesc @gsabac.

Glcd l-am primit cadou de MosCraciun , si variantele de afisare folosite la "sursa cu pic" mi s-au parut mici ca cifre.

La afisare text sau desen este ok ,dar la citire adc apare acel flicker ...am incercat diferite variante de remediere dar nu am reusit, ori la cautarea cu gogu nu am avut noroc.

Multumesc.

P.S.

Codul a mai suferit ceva modificari , nu sunt linga calculator sa-l postez.

Edited by aetius

Share this post


Link to post
Share on other sites
Posted (edited)

Nu cunosc acest afisaj in particular insa pot sa va spun c-am avut acelasi gen de problema (flicker, rata mica de reinprospatare) si cu alte afisaje grafice.

Fara sa am pretentia ca asa lucreaza toate driverele, pot sa spun ca alea pe care le-am studiat au un buffer in RAM cu corespondenta 1:1 cu fiecare pixel de pe ecran.

Daca de ex. modifici o "virgula" undeva, ca sa devina vizibila trebuie sa faci refresh LA TOT ecranul adica sa transferi tot buffer-ul.

Aici este problema in cazul procesoarelor cu viteza mica sau in cazul afisajelor cu bus care nu permite o viteza f. mare de transfer (de ex. I2C).

Personal am implementat in majoritatea cazurilor un "simulator" de afisaj alfanumeric cu X randuri si Y coloane astfel incat sa pot face refresh partial.

Exista si alte solutii pt. refresh local (paginand memoria grafica de ex.) dar eu n-am avut nevoie, de cele mai multe ori afisand text.

Just FYI... :) 

 

 

Edited by informer

Share this post


Link to post
Share on other sites

Dupa exemplul cu Arduino pentru ST7735R in postare este programarea in mikroC.

 Schema si exemplu cu afisare "float" cu "wwTFT text source PIC18F46K22 ST7735"

     schema.thumb.png.6bac969cbf2e21c754616abde7f80ff8.png

Se remarca functia display_setTextColor(ST7735_GREEN, ST7735_BLACK); care face simultan scrisul si fondul in culorile alese

 si astfel ecranul nu mai are licariri. Ar fi bine ca asemenea functie sa existe si la alte drivere, pentru ILI9341 de exemplu.

 

Toate capabilitatile sunt in exemplul  "wwTFT probe PIC18F46K22 ST7735" din atasament.

 

@gsabac

wwTFT probe PIC18F46K22 ST7735.rar wwTFT text source PIC18F46K22 ST7735.rar

Edited by gsabac

Share this post


Link to post
Share on other sites
La 29.12.2019 la 23:27, aetius a spus:

Buna seara,

Incerc in jurul acestui glcd s-a construiesc pentru sursa cu pic ,un voltmetru/ampermetru…(avantaj cifre mai mari).

Dar intampin o problema cifrele flickeresc si exista o perioada de timp destul de mare pina ,arata valoarea citita ...

Codul este luat de pe net...aveti atasat simularea in proteus si hex-ul.

Multumesc pentru citire ,orice ideeie si exemplu sunt binevenite.

Afisorul ILI9341 este color, maricel, destul de ieftin si are librarii pentru arduino care au putut fi transformate pentru mikroC.

Schema afisorului ILI9341 cu PIC programat in mikroC ca sa redea texte dinamice fara flicker este in poza.

 Click pentru marire.

  580736145_ILI9341text.thumb.png.7e92d898ff644cd26f0523968bd68be5.png

Am utilizat un set de functii adaptate la 5 cifre semnificative, care asigura un refresh rapid doar pentru textul rescris.

 

 display_setCursor(15, 25);
    display_setTextColor(ILI9341_RED, ILI9341_BLACK);  // set text color to white with transparant background
    display_setTextSize(5);
    rex=(rex+0.101);
    FloatToStr(rex,dat);
    strncpy(dat1,dat,5);    // trunchiat la 5 cifre semnificative
    display_puts(dat1);

 

 display_setTextColor(ILI9341_CYAN, ILI9341_BLACK);
 display_setCursor(15, 176);
  display_puts(dat1);

Trebuie remarcat ca modelul din Proteus dupa mai multi autori nu functioneaza corect decat prin seriala SPI iar

  sursele de program mikroC si Proteus sunt in atasament.

Din gama afisoarelor inteligente fac parte si tipurile Nextion, care poseda "touch screen" rezistiv sau capacitiv, cu preturi putin mai mari decat cele expuse.

Acestea au un limbaj propriu de programare, permit legaturi duplex si pot fi utilizate cu succes in arduino sau mikroC.

 

@gsabac

wwTFT text PIC18F46K22 ILI9341.rar

Share this post


Link to post
Share on other sites
La 29.01.2020 la 15:36, gsabac a spus:

Din gama afisoarelor inteligente fac parte si tipurile Nextion, care poseda "touch screen" rezistiv sau capacitiv, cu preturi putin mai mari decat cele expuse.

Acestea au un limbaj propriu de programare, permit legaturi duplex si pot fi utilizate cu succes in arduino sau mikroC.

Un alt tip de afisaje inteligente sunt cele produse de 4DSystems (se gasesc (si) la TME).

Avand procesorul lor nu mai trebuie sa ne batem noi capul cu managementul pixelilor... daca platim pretul nu prea mic, evident :) 

Cei de la 4DSystem ofera gratuit si IDE-ul pt. realizarea interfetei grafice si nu numai... sistemul are resursele necesare pt. realizarea doar cu el a unor automatizari nu deosebit de complexe.

Un client a ales acest afisaj pt. realizarea device-urilor sale asa ca o sa fiu in masura sa ofer mai multe informatii in viitorul apropiat... presupunand ca cineva va fi interesat. :) 

Share this post


Link to post
Share on other sites

Pana la urma ai reusit sa afisezi acel font pe LCD ? Ma refer fizic nu in proteus. Intreb deoarece  marimea caracterelor este mai mari de 8 biti si teoretic nu merge cu libraria standard GLCD, trebuie X--GLCD.  Ai putea pune o poza la cum arata fontul pe LCD ?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.