Glcd_Write_Text_Adv

General discussion on mikroC PRO for PIC.
Post Reply
Author
Message
HyperUniverse
Posts: 282
Joined: 17 Jun 2009 10:42

Glcd_Write_Text_Adv

#1 Post by HyperUniverse » 30 May 2014 08:52

Hi,

I am trying to use Glcd_Write_Text_Adv and Glcd_Write_Char_Adv, but it seems it doesn't work properly.

For example I want to read an ADC value and display it on GLCD.

Code: Select all

    ADCON0.ADON = 1 ;     //Turn ON the AD module
    adc_rd  = ADC_read(1);     // get ADC value from 1st channel
    ADCON0.ADON = 0 ;        //Turn OFF the AD module

    tlong = (long)adc_rd * 4990; 
    tlong = tlong / 1023;          // 0..1023 -> 0-5000mV

    ch     = tlong / 1000;     
  Glcd_Set_Font(Character8x7, 8, 7, 32);
  //   Glcd_Write_Char(48+ch, 41, 0, 1);         
    Glcd_Write_Char_Adv(48+ch, 41, 3);

    ch    = (tlong / 100) % 10;
  //  Glcd_Write_Char(48+ch, 49, 0, 1);         
    Glcd_Write_Char_Adv(48+ch, 49, 3);

    ch    = (tlong / 10) % 10;   
  //  Glcd_Write_Char(48+ch, 57, 0, 1);           
    Glcd_Write_Char_Adv(48+ch, 57, 3);
   
    Glcd_Dot(65,11,1) ;
    Glcd_Dot(66,11,1) ;
    Glcd_Dot(65,11,1) ;
    Glcd_Dot(66,11,1) ;

     ch    = tlong % 10;       // extract 0.001 volts digit
  //   Glcd_Write_Char(48+ch, 68, 0, 1);     
     Glcd_Write_Char_Adv(48+ch, 68, 3);

    Delay_ms(1);
I also use the Glcd_Write_Text_Adv command to display some Text received via UART.
And to clear the old message I had to implement a trick:

Code: Select all

     Glcd_Box(1, 44, 126, 54, 0);
    Glcd_Write_Text_Adv(UART_output, 1, 44);  // Write string
right before a string is being displayed, I create a box filled with nothing over the old text.
This seems to be working, but it takes a bit of time for the box to be created and the new string to be displayed.


With Glcd_Write_Char command it work perfect, that is every time a new character is being written on GLCD, the old one is being deleted.
But with Glcd_Write_Char_Adv command, the old character is not being deleted, and the new one is being written over the previous one, and the next character is being written over the previous two, and so on all the readings are written over the old ones, making it impossible to use.

Any help here?

Also it seems that Glcd_Write_Char_Adv is overriding the previous command: Glcd_Set_Font(Character8x7, 8, 7, 32); as the characters are NOT 8x7, but something more like 4x7???....yes, it looks like 4x7, not even 5x7

I have found an old post of filip, from mikroElektronika team, that says this:
Hi,

In order to use Glcd_Write_Text_Adv, you must create a custom font using the GLCD Font Creator Software :
http://www.mikroe.com/glcd-font-creator/

Once you have created the font, paste the generated code (array) to your project and use the font with Glcd_Write_Text_Adv routine.

Regards,
Filip.
Does this mean that Glcd_Write_Text_Adv and Glcd_Write_Char_Adv commands can not be used with variables that change while the program is running?



Thanks.

Jim Walsh
Posts: 55
Joined: 06 Mar 2014 01:38
Location: Pittsburgh, PA

Re: Glcd_Write_Text_Adv

#2 Post by Jim Walsh » 30 May 2014 14:15

Hi,

Yes, you can use variables with the advanced GLCD functions. As Filip mentioned, they only work with fonts you create using MikroE's GLCD font creator tool (be sure to use the "Export for TFT and new GLCD" button when exporting your font). You also need to use Glcd_Set_Font_Adv() function to load the font you created. Instead of drawing a box to clear the old text, I just set the font to the background color and write over the old line then set the font back to foreground color to write the new text. Here is an quick example....sorry about the size...most of it is from the font code. :lol:

Peace,
Jim

Code: Select all

//Font Generated by MikroElektronika GLCD Font Creator 1.2.0.0
//MikroElektrnika 2011 
//http://www.mikroe.com 

//GLCD FontName : Tahoma10x11
//GLCD FontSize : 10 x 11

const unsigned short Tahoma10x11[] = {
   0x00,
   0x00,
   0x20,0x00,
   0x7F,0x00,
   0x0B,
   0x00,
   0x01,0x88,0x01,0x00,
   0x02,0x93,0x01,0x00,
   0x03,0x9E,0x01,0x00,
   0x07,0xA9,0x01,0x00,
   0x05,0xB4,0x01,0x00,
   0x0A,0xBF,0x01,0x00,
   0x07,0xD5,0x01,0x00,
   0x01,0xE0,0x01,0x00,
   0x03,0xEB,0x01,0x00,
   0x03,0xF6,0x01,0x00,
   0x05,0x01,0x02,0x00,
   0x07,0x0C,0x02,0x00,
   0x02,0x17,0x02,0x00,
   0x03,0x22,0x02,0x00,
   0x02,0x2D,0x02,0x00,
   0x03,0x38,0x02,0x00,
   0x05,0x43,0x02,0x00,
   0x04,0x4E,0x02,0x00,
   0x05,0x59,0x02,0x00,
   0x05,0x64,0x02,0x00,
   0x05,0x6F,0x02,0x00,
   0x05,0x7A,0x02,0x00,
   0x05,0x85,0x02,0x00,
   0x05,0x90,0x02,0x00,
   0x05,0x9B,0x02,0x00,
   0x05,0xA6,0x02,0x00,
   0x02,0xB1,0x02,0x00,
   0x02,0xBC,0x02,0x00,
   0x07,0xC7,0x02,0x00,
   0x07,0xD2,0x02,0x00,
   0x07,0xDD,0x02,0x00,
   0x04,0xE8,0x02,0x00,
   0x09,0xF3,0x02,0x00,
   0x06,0x09,0x03,0x00,
   0x05,0x14,0x03,0x00,
   0x06,0x1F,0x03,0x00,
   0x06,0x2A,0x03,0x00,
   0x05,0x35,0x03,0x00,
   0x05,0x40,0x03,0x00,
   0x06,0x4B,0x03,0x00,
   0x06,0x56,0x03,0x00,
   0x03,0x61,0x03,0x00,
   0x04,0x6C,0x03,0x00,
   0x05,0x77,0x03,0x00,
   0x04,0x82,0x03,0x00,
   0x07,0x8D,0x03,0x00,
   0x06,0x98,0x03,0x00,
   0x07,0xA3,0x03,0x00,
   0x05,0xAE,0x03,0x00,
   0x07,0xB9,0x03,0x00,
   0x06,0xC4,0x03,0x00,
   0x05,0xCF,0x03,0x00,
   0x05,0xDA,0x03,0x00,
   0x06,0xE5,0x03,0x00,
   0x05,0xF0,0x03,0x00,
   0x09,0xFB,0x03,0x00,
   0x05,0x11,0x04,0x00,
   0x05,0x1C,0x04,0x00,
   0x05,0x27,0x04,0x00,
   0x03,0x32,0x04,0x00,
   0x03,0x3D,0x04,0x00,
   0x03,0x48,0x04,0x00,
   0x07,0x53,0x04,0x00,
   0x06,0x5E,0x04,0x00,
   0x03,0x69,0x04,0x00,
   0x05,0x74,0x04,0x00,
   0x05,0x7F,0x04,0x00,
   0x04,0x8A,0x04,0x00,
   0x05,0x95,0x04,0x00,
   0x05,0xA0,0x04,0x00,
   0x03,0xAB,0x04,0x00,
   0x05,0xB6,0x04,0x00,
   0x05,0xC1,0x04,0x00,
   0x01,0xCC,0x04,0x00,
   0x02,0xD7,0x04,0x00,
   0x05,0xE2,0x04,0x00,
   0x01,0xED,0x04,0x00,
   0x07,0xF8,0x04,0x00,
   0x05,0x03,0x05,0x00,
   0x05,0x0E,0x05,0x00,
   0x05,0x19,0x05,0x00,
   0x05,0x24,0x05,0x00,
   0x03,0x2F,0x05,0x00,
   0x04,0x3A,0x05,0x00,
   0x03,0x45,0x05,0x00,
   0x05,0x50,0x05,0x00,
   0x05,0x5B,0x05,0x00,
   0x07,0x66,0x05,0x00,
   0x05,0x71,0x05,0x00,
   0x05,0x7C,0x05,0x00,
   0x04,0x87,0x05,0x00,
   0x04,0x92,0x05,0x00,
   0x02,0x9D,0x05,0x00,
   0x04,0xA8,0x05,0x00,
   0x07,0xB3,0x05,0x00,
   0x03,0xBE,0x05,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,                          // Code for char num 32
   0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x02,0x00,0x00,                          // Code for char num 33
   0x05,0x05,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,                          // Code for char num 34
   0x00,0x28,0x28,0x7E,0x14,0x14,0x3F,0x0A,0x0A,0x00,0x00,                          // Code for char num 35
   0x04,0x04,0x1E,0x05,0x05,0x0E,0x14,0x14,0x0F,0x04,0x04,                          // Code for char num 36
   0x00,0x00,0x46,0x00,0x49,0x00,0x29,0x00,0x26,0x00,0x90,0x01,0x50,0x02,0x48,0x02,0x88,0x01,0x00,0x00,0x00,0x00, // Code for char num 37
   0x00,0x06,0x09,0x09,0x26,0x29,0x11,0x31,0x4E,0x00,0x00,                          // Code for char num 38
   0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,                          // Code for char num 39
   0x04,0x02,0x02,0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x04,                          // Code for char num 40
   0x01,0x02,0x02,0x04,0x04,0x04,0x04,0x04,0x02,0x02,0x01,                          // Code for char num 41
   0x04,0x15,0x0E,0x15,0x04,0x00,0x00,0x00,0x00,0x00,0x00,                          // Code for char num 42
   0x00,0x00,0x08,0x08,0x08,0x7F,0x08,0x08,0x08,0x00,0x00,                          // Code for char num 43
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x01,                          // Code for char num 44
   0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,                          // Code for char num 45
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x00,0x00,                          // Code for char num 46
   0x04,0x04,0x04,0x02,0x02,0x02,0x02,0x02,0x01,0x01,0x01,                          // Code for char num 47
   0x00,0x0E,0x11,0x11,0x11,0x11,0x11,0x11,0x0E,0x00,0x00,                          // Code for char num 48
   0x00,0x04,0x06,0x04,0x04,0x04,0x04,0x04,0x0E,0x00,0x00,                          // Code for char num 49
   0x00,0x0E,0x11,0x10,0x08,0x04,0x02,0x01,0x1F,0x00,0x00,                          // Code for char num 50
   0x00,0x0E,0x11,0x10,0x0C,0x10,0x10,0x11,0x0E,0x00,0x00,                          // Code for char num 51
   0x00,0x08,0x0C,0x0A,0x09,0x1F,0x08,0x08,0x08,0x00,0x00,                          // Code for char num 52
   0x00,0x1F,0x01,0x01,0x0F,0x10,0x10,0x11,0x0E,0x00,0x00,                          // Code for char num 53
   0x00,0x0C,0x02,0x01,0x0F,0x11,0x11,0x11,0x0E,0x00,0x00,                          // Code for char num 54
   0x00,0x1F,0x10,0x08,0x08,0x04,0x04,0x02,0x02,0x00,0x00,                          // Code for char num 55
   0x00,0x0E,0x11,0x11,0x0E,0x11,0x11,0x11,0x0E,0x00,0x00,                          // Code for char num 56
   0x00,0x0E,0x11,0x11,0x11,0x1E,0x10,0x08,0x06,0x00,0x00,                          // Code for char num 57
   0x00,0x00,0x00,0x02,0x02,0x00,0x00,0x02,0x02,0x00,0x00,                          // Code for char num 58
   0x00,0x00,0x00,0x02,0x02,0x00,0x00,0x02,0x02,0x02,0x01,                          // Code for char num 59
   0x00,0x00,0x40,0x30,0x0C,0x02,0x0C,0x30,0x40,0x00,0x00,                          // Code for char num 60
   0x00,0x00,0x00,0x00,0x7F,0x00,0x7F,0x00,0x00,0x00,0x00,                          // Code for char num 61
   0x00,0x00,0x02,0x0C,0x30,0x40,0x30,0x0C,0x02,0x00,0x00,                          // Code for char num 62
   0x00,0x07,0x08,0x08,0x04,0x02,0x02,0x00,0x02,0x00,0x00,                          // Code for char num 63
   0x00,0x00,0x7C,0x00,0x82,0x00,0x39,0x01,0x25,0x01,0x25,0x01,0x25,0x01,0xF9,0x00,0x02,0x00,0x3C,0x00,0x00,0x00, // Code for char num 64
   0x00,0x0C,0x0C,0x12,0x12,0x12,0x3F,0x21,0x21,0x00,0x00,                          // Code for char num 65
   0x00,0x0F,0x11,0x11,0x0F,0x11,0x11,0x11,0x0F,0x00,0x00,                          // Code for char num 66
   0x00,0x3C,0x02,0x01,0x01,0x01,0x01,0x02,0x3C,0x00,0x00,                          // Code for char num 67
   0x00,0x0F,0x11,0x21,0x21,0x21,0x21,0x11,0x0F,0x00,0x00,                          // Code for char num 68
   0x00,0x1F,0x01,0x01,0x0F,0x01,0x01,0x01,0x1F,0x00,0x00,                          // Code for char num 69
   0x00,0x1F,0x01,0x01,0x1F,0x01,0x01,0x01,0x01,0x00,0x00,                          // Code for char num 70
   0x00,0x3C,0x02,0x01,0x01,0x39,0x21,0x22,0x3C,0x00,0x00,                          // Code for char num 71
   0x00,0x21,0x21,0x21,0x3F,0x21,0x21,0x21,0x21,0x00,0x00,                          // Code for char num 72
   0x00,0x07,0x02,0x02,0x02,0x02,0x02,0x02,0x07,0x00,0x00,                          // Code for char num 73
   0x00,0x0E,0x08,0x08,0x08,0x08,0x08,0x08,0x07,0x00,0x00,                          // Code for char num 74
   0x00,0x11,0x09,0x05,0x03,0x03,0x05,0x09,0x11,0x00,0x00,                          // Code for char num 75
   0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x0F,0x00,0x00,                          // Code for char num 76
   0x00,0x63,0x63,0x55,0x55,0x49,0x49,0x41,0x41,0x00,0x00,                          // Code for char num 77
   0x00,0x23,0x23,0x25,0x25,0x29,0x29,0x31,0x31,0x00,0x00,                          // Code for char num 78
   0x00,0x1C,0x22,0x41,0x41,0x41,0x41,0x22,0x1C,0x00,0x00,                          // Code for char num 79
   0x00,0x0F,0x11,0x11,0x11,0x0F,0x01,0x01,0x01,0x00,0x00,                          // Code for char num 80
   0x00,0x1C,0x22,0x41,0x41,0x41,0x41,0x22,0x1C,0x10,0x60,                          // Code for char num 81
   0x00,0x0F,0x11,0x11,0x11,0x0F,0x09,0x11,0x21,0x00,0x00,                          // Code for char num 82
   0x00,0x1E,0x01,0x01,0x0E,0x10,0x10,0x10,0x0F,0x00,0x00,                          // Code for char num 83
   0x00,0x1F,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00,0x00,                          // Code for char num 84
   0x00,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x1E,0x00,0x00,                          // Code for char num 85
   0x00,0x11,0x11,0x11,0x0A,0x0A,0x0A,0x04,0x04,0x00,0x00,                          // Code for char num 86
   0x00,0x00,0x11,0x01,0x11,0x01,0x11,0x01,0xAA,0x00,0xAA,0x00,0xAA,0x00,0x44,0x00,0x44,0x00,0x00,0x00,0x00,0x00, // Code for char num 87
   0x00,0x11,0x11,0x0A,0x04,0x04,0x0A,0x11,0x11,0x00,0x00,                          // Code for char num 88
   0x00,0x11,0x11,0x0A,0x0A,0x04,0x04,0x04,0x04,0x00,0x00,                          // Code for char num 89
   0x00,0x1F,0x10,0x08,0x04,0x04,0x02,0x01,0x1F,0x00,0x00,                          // Code for char num 90
   0x07,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x07,                          // Code for char num 91
   0x01,0x01,0x01,0x02,0x02,0x02,0x02,0x02,0x04,0x04,0x04,                          // Code for char num 92
   0x07,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x07,                          // Code for char num 93
   0x00,0x08,0x14,0x22,0x41,0x00,0x00,0x00,0x00,0x00,0x00,                          // Code for char num 94
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,                          // Code for char num 95
   0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,                          // Code for char num 96
   0x00,0x00,0x00,0x0E,0x10,0x1E,0x11,0x11,0x1E,0x00,0x00,                          // Code for char num 97
   0x01,0x01,0x01,0x0F,0x11,0x11,0x11,0x11,0x0F,0x00,0x00,                          // Code for char num 98
   0x00,0x00,0x00,0x0E,0x01,0x01,0x01,0x01,0x0E,0x00,0x00,                          // Code for char num 99
   0x10,0x10,0x10,0x1E,0x11,0x11,0x11,0x11,0x1E,0x00,0x00,                          // Code for char num 100
   0x00,0x00,0x00,0x0E,0x11,0x1F,0x01,0x11,0x0E,0x00,0x00,                          // Code for char num 101
   0x06,0x01,0x01,0x07,0x01,0x01,0x01,0x01,0x01,0x00,0x00,                          // Code for char num 102
   0x00,0x00,0x00,0x1E,0x11,0x11,0x11,0x11,0x1E,0x10,0x0E,                          // Code for char num 103
   0x01,0x01,0x01,0x0F,0x11,0x11,0x11,0x11,0x11,0x00,0x00,                          // Code for char num 104
   0x00,0x01,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,                          // Code for char num 105
   0x00,0x02,0x00,0x03,0x02,0x02,0x02,0x02,0x02,0x02,0x01,                          // Code for char num 106
   0x01,0x01,0x01,0x09,0x05,0x03,0x05,0x09,0x11,0x00,0x00,                          // Code for char num 107
   0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,                          // Code for char num 108
   0x00,0x00,0x00,0x37,0x49,0x49,0x49,0x49,0x49,0x00,0x00,                          // Code for char num 109
   0x00,0x00,0x00,0x0F,0x11,0x11,0x11,0x11,0x11,0x00,0x00,                          // Code for char num 110
   0x00,0x00,0x00,0x0E,0x11,0x11,0x11,0x11,0x0E,0x00,0x00,                          // Code for char num 111
   0x00,0x00,0x00,0x0F,0x11,0x11,0x11,0x11,0x0F,0x01,0x01,                          // Code for char num 112
   0x00,0x00,0x00,0x1E,0x11,0x11,0x11,0x11,0x1E,0x10,0x10,                          // Code for char num 113
   0x00,0x00,0x00,0x05,0x03,0x01,0x01,0x01,0x01,0x00,0x00,                          // Code for char num 114
   0x00,0x00,0x00,0x0E,0x01,0x03,0x0C,0x08,0x07,0x00,0x00,                          // Code for char num 115
   0x00,0x01,0x01,0x07,0x01,0x01,0x01,0x01,0x06,0x00,0x00,                          // Code for char num 116
   0x00,0x00,0x00,0x11,0x11,0x11,0x11,0x11,0x1E,0x00,0x00,                          // Code for char num 117
   0x00,0x00,0x00,0x11,0x11,0x0A,0x0A,0x04,0x04,0x00,0x00,                          // Code for char num 118
   0x00,0x00,0x00,0x49,0x49,0x55,0x55,0x22,0x22,0x00,0x00,                          // Code for char num 119
   0x00,0x00,0x00,0x11,0x0A,0x04,0x04,0x0A,0x11,0x00,0x00,                          // Code for char num 120
   0x00,0x00,0x00,0x11,0x11,0x0A,0x0A,0x04,0x04,0x02,0x02,                          // Code for char num 121
   0x00,0x00,0x00,0x0F,0x08,0x04,0x02,0x01,0x0F,0x00,0x00,                          // Code for char num 122
   0x08,0x04,0x04,0x04,0x04,0x03,0x04,0x04,0x04,0x04,0x08,                          // Code for char num 123
   0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,                          // Code for char num 124
   0x01,0x02,0x02,0x02,0x02,0x0C,0x02,0x02,0x02,0x02,0x01,                          // Code for char num 125
   0x00,0x00,0x00,0x00,0x46,0x49,0x31,0x00,0x00,0x00,0x00,                          // Code for char num 126
   0x00,0x07,0x05,0x05,0x05,0x05,0x05,0x05,0x07,0x00,0x00                           // Code for char num 127
        };

// Glcd module connections
char GLCD_DataPort at PORTD;

sbit GLCD_CS1 at LATB0_bit;
sbit GLCD_CS2 at LATB1_bit;
sbit GLCD_RS  at LATB2_bit;
sbit GLCD_RW  at LATB3_bit;
sbit GLCD_EN  at LATB4_bit;
sbit GLCD_RST at LATB5_bit;

sbit GLCD_CS1_Direction at TRISB0_bit;
sbit GLCD_CS2_Direction at TRISB1_bit;
sbit GLCD_RS_Direction  at TRISB2_bit;
sbit GLCD_RW_Direction  at TRISB3_bit;
sbit GLCD_EN_Direction  at TRISB4_bit;
sbit GLCD_RST_Direction at TRISB5_bit;
// End Glcd module connections


void main() {

   char *newText;
  char *oldText;
  
  ANSELB = 0;                        // Configure PORTB pins as digital I/O
  ANSELD = 0;                        // Configure PORTD pins as digital I/O

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

  while(1) {
    newText = "This is a line of text";
    oldText = newText;
    Glcd_Set_Font_Adv(&Tahoma10x11,1,0);
    Glcd_Write_Text_Adv(newText,1,1);
    delay_ms(2000);
    newText = "Now it's a new line of text";
    Glcd_Set_Font_Adv(&Tahoma10x11,0,0);
    Glcd_Write_Text_Adv(oldText,1,1);
    Glcd_Set_Font_Adv(&Tahoma10x11,1,0);
    Glcd_Write_Text_Adv(newText,1,1);
    oldText = newText;
    delay_ms(2000);
    Glcd_Set_Font_Adv(&Tahoma10x11,0,0);
    Glcd_Write_Text_Adv(oldText,1,1);
    
  }

}

HyperUniverse
Posts: 282
Joined: 17 Jun 2009 10:42

Re: Glcd_Write_Text_Adv

#3 Post by HyperUniverse » 30 May 2014 14:37

thanks for reply Jim.

I can't make it work, there's no characters on my display.

I found another piece of info, that says to add some files to the project:
(hard_specific.c, xglcd_lib.c and propfont.h)
so I did add them, but the compiler warns me :
50 1161 Variable 'yy' has been declared, but not used xglcd_lib.c
127 1162 Variable 'CurCharDt' has been eliminated by optimizer xglcd_lib.c
what shall I do?

thanks

Jim Walsh
Posts: 55
Joined: 06 Mar 2014 01:38
Location: Pittsburgh, PA

Re: Glcd_Write_Text_Adv

#4 Post by Jim Walsh » 30 May 2014 15:04

thanks for reply Jim.

I can't make it work, there's no characters on my display.

I found another piece of info, that says to add some files to the project:
Quote:
(hard_specific.c, xglcd_lib.c and propfont.h)

so I did add them, but the compiler warns me :
Quote:
50 1161 Variable 'yy' has been declared, but not used xglcd_lib.c
127 1162 Variable 'CurCharDt' has been eliminated by optimizer xglcd_lib.c


what shall I do?

thanks

Hi,

I don't think you need to use the additional files (Xglcd etc) unless you have an older version of MikroC . The newer versions are already set up to use the advanced features. I assume you tried adjusting the Glcd contrast? Did you check the connections to see if they matched the ones in the code? I used the Glcd on EasyPic7 for the example...your Glcd might be connected to different pins.

Peace,
Jim

HyperUniverse
Posts: 282
Joined: 17 Jun 2009 10:42

Re: Glcd_Write_Text_Adv

#5 Post by HyperUniverse » 30 May 2014 15:06

well, to understand better how this works, I've made it simple:

Code: Select all

//WARNING: This Font Require X-GLCD Lib.
//         You can not use it with MikroE GLCD Lib.

//Font Generated by MikroElektronika GLCD Font Creator 1.2.0.0
//MikroElektronika 2011 
//http://www.mikroe.com 

//GLCD FontName : seven8x12
//GLCD FontSize : 8 x 12

const unsigned short seven8x12[] = {
        0x08, 0x06, 0x00, 0x47, 0x08, 0x43, 0x0E, 0xC3, 0x07, 0xE3, 0x01, 0x7B, 0x00, 0x5F, 0x00, 0x0F, 0x00   // Code for char 7
        };

then I try to display number 7 with the font I just created above:

Code: Select all

void Show_Display_1() {
    Glcd_Fill(0x00)                    ;  // Clear GLCD
    Glcd_Set_Font_Adv(&seven8x12, 1, 0);
    Glcd_Write_Char_Adv('7', 31, 53);
}
but my display is blank.

what's wrong here?

seems that these files (hard_specific.c, xglcd_lib.c and propfont.h) are not needed since compiler v4.80

p.s. my display works fine with other variables that I display them as standard on pages.
I just want to be able to print some chars & text between pages too.

thanks

Jim Walsh
Posts: 55
Joined: 06 Mar 2014 01:38
Location: Pittsburgh, PA

Re: Glcd_Write_Text_Adv

#6 Post by Jim Walsh » 30 May 2014 15:21

Code: Select all

//WARNING: This Font Require X-GLCD Lib.
//         You can not use it with MikroE GLCD Lib.

//Font Generated by MikroElektronika GLCD Font Creator 1.2.0.0
//MikroElektronika 2011
//http://www.mikroe.com

//GLCD FontName : seven8x12
//GLCD FontSize : 8 x 12

const unsigned short seven8x12[] = {
        0x08, 0x06, 0x00, 0x47, 0x08, 0x43, 0x0E, 0xC3, 0x07, 0xE3, 0x01, 0x7B, 0x00, 0x5F, 0x00, 0x0F, 0x00   // Code for char 7
        };


Ahhhh I see, it looks like you exported your font in the old style. That is why you you get the warning about requiring X-GLCD library. When you export your font from the GLCD Font Creator, you should use the button that says "Export for TFT and new GLCD (new library)". That code will work with the advanced GLCD functions.

Peace,
Jim

HyperUniverse
Posts: 282
Joined: 17 Jun 2009 10:42

Re: Glcd_Write_Text_Adv

#7 Post by HyperUniverse » 30 May 2014 15:35

Jim Walsh wrote:
Ahhhh I see, it looks like you exported your font in the old style. That is why you you get the warning about requiring X-GLCD library. When you export your font from the GLCD Font Creator, you should use the button that says "Export for TFT and new GLCD (new library)". That code will work with the advanced GLCD functions.

Peace,
Jim

Sorry, but there is no such buttons in my Font Creator, and just to be sure I've got the latest I just download it and re-installed it again.
My previous version was 1.200, and today version is the same.

There must be something else......

Jim Walsh
Posts: 55
Joined: 06 Mar 2014 01:38
Location: Pittsburgh, PA

Re: Glcd_Write_Text_Adv

#8 Post by Jim Walsh » 30 May 2014 16:39

Sorry, but there is no such buttons in my Font Creator, and just to be sure I've got the latest I just download it and re-installed it again.
My previous version was 1.200, and today version is the same.

There must be something else......
Hmmm that's odd. I have had mine for while but it's still the same version (1.2.0.0). The 'export for TFT and new GLCD' button should be right next to the 'export for GLCD' button like this...

Image


Peace,
Jim

HyperUniverse
Posts: 282
Joined: 17 Jun 2009 10:42

Re: Glcd_Write_Text_Adv

#9 Post by HyperUniverse » 02 Jun 2014 11:53

Thanks for your help Jim.

Indeed I didn't have that button.
But, this was because I was using the program in "window" mode, not full screen.
As soon as I've made it "full screen" there is the button missing, popping where you pointed.

(or at lest you need the program to run in a wide enough window to be able to see that button)!!!

Now I see my big "7" on the screen.
Thanks again for your help Jim.

Jim Walsh
Posts: 55
Joined: 06 Mar 2014 01:38
Location: Pittsburgh, PA

Re: Glcd_Write_Text_Adv

#10 Post by Jim Walsh » 02 Jun 2014 13:01

Sweet! No problem my friend, I'm glad that you were able to get it working. I have had similar experience with some of my programs. I would be missing parts even when I maximized the window. Turned out it was because I had set Windows to 'magnify mode' in order to make it easy to read stuff on the monitor, which worked great as long as it was all text, but not so much with some other programs. :lol:

Peace,
Jim

emb
Posts: 8
Joined: 20 Feb 2020 10:01

Re: Glcd_Write_Text_Adv

#11 Post by emb » 31 Oct 2023 11:12

Hello,
I have tried the custom font using the GLCD Font creator by Mikroe on GLCD 240x128. I have set the font size using the T6963C_Set_Font_Adv() function and writing to it using T6963C_write_char_adv() and T6963C_Write_Text_Adv() functions.
It has been observed that it does not clear the text after writing. Instead it overwrite the new text over the old text.
I have the complete business logic on GLCD 128x64 and now I have to shift it to the 240x128 GLCD.
Please suggest the solution how the previous character or text can be cleared after writing new one.
Thanks in advance.

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Glcd_Write_Text_Adv

#12 Post by filip » 03 Nov 2023 11:37

Hi,

There are two ways to do this :
1. Draw a box on the place on the character that you want do delete,
2. Write a string with where you would replace this character with blank space.

Regards,
Filip.

Post Reply

Return to “mikroC PRO for PIC General”