1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Unicorn GLCD demo.

Discussion in 'Microcontrollers' started by Pommie, Jun 20, 2007.

  1. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,022
    Likes:
    317
    Location:
    Brisbane Australia
    Try this,
    Code (text):

    const rom unsigned char Logo[]={
        35,58,
        0x20,0x01,0x00,0x00,
        0xA0,0x03,0x00,0x20,
        0x01,0x00,0x00,0x00,
        0x08,0x10,0x00,0x00,
        0x00,0x00,0x00,0x00,
        0x90,0x00,0x08,0x01,
        0x00,0x00,0x00,0x00,
        0x00,0x21,0x00,0x40,
        0x00,0x16,0x00,0x08,
        0x09,0x20,0x12,0x00,
        0xF2,0x80,0x10,0x00,
        0x80,0x08,0x89,0x04,
        0x08,0xBC,0x54,0x00,
        0x40,0x40,0x12,0x02,
        0x00,0x30,0x0A,0x08,
        0x09,0x10,0x00,0x1C,
        0x02,0x80,0xB4,0x45,
        0x3E,0x00,0x04,0x00,
        0x01,0x10,0x40,0x00,
        0x18,0x00,0x80,0x8E,
        0x02,0x66,0x0B,0xD4,
        0x00,0x84,0xAC,0xA0,
        0x0D,0x08,0xAC,0x85,
        0x6B,0x00,0x60,0x2D,
        0xF0,0x04,0x00,0xAB,
        0x63,0x14,0x00,0x58,
        0x0F,0xB5,0x01,0xC0,
        0x9A,0xC1,0x08,0x00,
        0xD6,0xCB,0x3A,0x00,
        0xB0,0x02,0x6A,0x02,
        0x80,0x95,0xD2,0x13,
        0x00,0xB2,0x04,0x77,
        0x00,0x60,0x24,0x44,
        0x03,0x80,0x1A,0xC1,
        0x23,0x00,0xD2,0x08,
        0x23,0x02,0xC0,0x49,
        0xD0,0x2A,0x80,0x59,
        0x02,0x49,0x03,0xE8,
        0x12,0x38,0xF7,0x5A,
        0x8F,0x40,0x5A,0xAD,
        0x3B,0x04,0x4A,0x00,
        0x26,0xA4,0x90,0x47,
        0x50,0x87,0x84,0x02,
        0x22,0xD1,0x03,0xE4,
        0x49,0xD5,0x19,0xA0,
        0xA2,0x08,0xF2,0x00,
        0x2D,0xA7,0x64,0x01,
        0x48,0x96,0x5A,0x1C,
        0x40,0x73,0x45,0xB2,
        0x00,0x75,0xCE,0x68,
        0x02,0x70,0x8C,0x68,
        0x29,0x00,0x10,0x2B,
        0xB4,0x00,0x60,0x9A,
        0x7E,0x01,0x00,0x96,
        0x56,0x0E,0x00,0x98,
        0x43,0x0F,0x00,0x40,
        0x13,0x84,0x01,0x90,
        0x4A,0xD0,0x36,0x00,
        0x00,0x48,0x00,0x00,
        0x98,0x01,0x4C,0x51,
        0x60,0x4D,0x80,0x2A,
        0x05,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,
        0x00,0x00
    };
     
    As I said the code I wrote is a bit clunky and so I may have made a mistake. Let us know if it works.

    Mike.
     
  2. jorg1n

    jorg1n New Member

    Joined:
    Feb 11, 2009
    Messages:
    29
    Likes:
    0
    Hello,

    I want to display a "int". I have used the function of SuperBrew (displayNUM)
    Code (text):
    void displayNum(int x, int y, int theValue) {
        char toPrint[4];
       
        toPrint[0] = (theValue/1000)+48;
        toPrint[1] = ((theValue%1000)/100)+48;
        toPrint[2] = ((theValue%100)/10)+48;
        toPrint[3] = (theValue%10)+48;
       
        SetPos(x,y);
        PutChar(toPrint[0]);
        PutChar(toPrint[1]);
        PutChar(toPrint[2]);
        PutChar(toPrint[3]);
    }

    I use it like this:
    Code (text):

    int BacklightType;
    [...]
    BacklightType++;
    [...]
    displayNum(50,40, BacklightType);
    but I get this when I try to display "10" (see photo)
    I guess I have "0010" but my character does nothing ...

    I also post my glcd.c so you can see my function "putchar". But I find the strange outcome ...
    Have you any idea?

    Thank you in advance
     

    Attached Files:

  3. jorg1n

    jorg1n New Member

    Joined:
    Feb 11, 2009
    Messages:
    29
    Likes:
    0
    Hello,

    I return to you because I managed to correct my error display (declaration problem of my variables), but I would now like to add a function to write in large letters .. But I can not find a solution ..
    I thank you in advance
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US

    to write in large letters you have to make a new font. larger
     
  6. jorg1n

    jorg1n New Member

    Joined:
    Feb 11, 2009
    Messages:
    29
    Likes:
    0
    Hello AtomSoft,

    I already create a new policy of width 8 and height 13, but I don't know how to use this. I want to make a function "putchar" to display the font. Could you help me? Will you or may already be a policy of this kind with a function call?
    Thank you in advance

    I have another problem, I use the function to display a "INT" of SuperBrew, but sometimes it displays symbols like my previous photo! and sometimes it works, would you also an idea about this problem?

    Thank you in advance AtomSoft
     
  7. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
    just alter or copy the original "PutChar" function and edit it to the new font and change the size for the font.
     
  8. jorg1n

    jorg1n New Member

    Joined:
    Feb 11, 2009
    Messages:
    29
    Likes:
    0
    Hy,
    I'm stuck, I still can not display a large print, or "float" with the function of Pommie:
    Code (text):
    void ftoa(float f,char* String,char Places){
    long power;
    char n,i;
        power=1;
        while(power*10<=f)
            power*=10;
        while(power>=1){
            n=(char)(f/power);
            f-=n*power;
            power/=10;
            *String++=n+'0';
        }
        *String++='.';
        for(i=0;i<Places;i++){
            f*=10;
            n=(char)f;
            f-=n;
            *String++=n+'0';
        }
        *String=0;
    }
    How to use this function to convert a float into a string and display it with the GLCD library?


    And my second problem, I tried to understand how the display using the putchar function to create my display large font (I need to display from 0 to 9 and the dot ".".
    Could you help me, because I'm stuck for a few days, and your support since the beginning helped me a lot, and I hope that this will continue..

    Thank You
     
  9. jorg1n

    jorg1n New Member

    Joined:
    Feb 11, 2009
    Messages:
    29
    Likes:
    0
    Hi,

    I encounter a problem:
    I can not write where I want on the axis "y", I still lag 8.i only write on the lines 0, 8, 16, ... even if I do:
    Code (text):
    SetPos(50,7);
    PutChar('R');
    he writes to the line 0.

    Is it possible to solve this problem?
    Thank you in advance
     
  10. jorg1n

    jorg1n New Member

    Joined:
    Feb 11, 2009
    Messages:
    29
    Likes:
    0
    Hi,

    I have a little problem (yes another!), concerning to display a float ..
    this is what I do:

    Code (text):

    # include <ftoa.h>
    ...
    float voltage;
    DataToLcd char [30];
    ...
    voltage = 30.2359;
    ftoa (voltage, DataToLcd, 2);
     
    and after that, I have my "char" DataToLcd which is "30.23" is:
    DataToLcd [0] ='3 '
    DataToLcd [1] ='0 '
    DataToLcd [2] = ''.
    DataToLcd [3] ='2 '
    DataToLcd [4] ='3 '
    DataToLcd [5] = ''.
    ...
    DataToLcd [29] = ''.

    but then how to display it:
    I do fine:

    Putchar (DataToLcd);
    PutMessage (DataToLcd);

    it does not work!

    you have an idea?

    Thank you in advance
     
  11. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,022
    Likes:
    317
    Location:
    Brisbane Australia
    Something like,
    Code (text):

        i=0;
        while(DataToLcd[i]!=0)
            PutChar(DataToLcd[i++]);
     
    Mike.
     
  12. jorg1n

    jorg1n New Member

    Joined:
    Feb 11, 2009
    Messages:
    29
    Likes:
    0
    Pommie thank you ... it works very well ...
    Will you have an idea on my previous post on the writing area on the screen. By the coordinate "y" must always be a multiple of 8? can we change this?
    Thank you again
     
  13. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,022
    Likes:
    317
    Location:
    Brisbane Australia
    It is possible to write characters to any position on the screen. The way to do it is to load each vertical byte of the character into a 16 bit variable and scroll it the required number if pixel (0-6). You then inclusive or this with the screen to draw the character.

    Mike.
     
  14. jorg1n

    jorg1n New Member

    Joined:
    Feb 11, 2009
    Messages:
    29
    Likes:
    0
    Hi Pommie,

    can you tell me what level of the library I need to change something in order to write where I want?

    I can not..

    Thank you in advance
     
  15. jorg1n

    jorg1n New Member

    Joined:
    Feb 11, 2009
    Messages:
    29
    Likes:
    0
    Hi,
    I looked again the principle of transmission, and features in the documentation of my display, and I think the solution lies in this function and in the last line:
    Code (text):
    void WritePosition(void){
        if(XPos>63){
            b_GLCD_GCS1=1;
            b_GLCD_GCS2=0;
        }
        else{
            b_GLCD_GCS1=0;
            b_GLCD_GCS2=1;
        }
        GLCD_Write_Cmd(0x40+(XPos&0x3f));   //column=0
        GLCD_Write_Cmd(0xb8+((YPos&0x3f)>>3));  //row=0     //row=0
    }
    But I can not change it correctly to write to all the lines ...

    Can you help me please
    Thanks a lot
     
  16. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,022
    Likes:
    317
    Location:
    Brisbane Australia
    The routine that needs rewriting is the PutChar routine. Unfortunately, the changes required are extensive and I don't have the time to help.

    You could write a slower version that looked at each byte of the char and used the plot routine to draw it.

    Mike.
     
  17. jorg1n

    jorg1n New Member

    Joined:
    Feb 11, 2009
    Messages:
    29
    Likes:
    0
    Hi,

    Pommie, have you received my MP?
    can you answer my message MP, even if the answer is no?
    Thank you in advance.

    PS: attached documentation of my display, as on page 12, I looked at the controls and I find it odd that in the WritePosition, when we want to set the value of Y using the direction of X and vice versa.

    Thank you again
     

    Attached Files:

  18. jorg1n

    jorg1n New Member

    Joined:
    Feb 11, 2009
    Messages:
    29
    Likes:
    0
    Hi,

    For display on all "y" axes, I dropped (I failed ...), I do otherwise.

    For against, I'm still stuck on the display of a larger police, are what you could help me please.

    Thank you in advance
     
  19. powdermonkey

    powdermonkey New Member

    Joined:
    Aug 17, 2005
    Messages:
    2
    Likes:
    0
    Is their any problem regarding downloading attachements? coz i am not able to download. Please help.
     
  20. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,022
    Likes:
    317
    Location:
    Brisbane Australia
  21. powdermonkey

    powdermonkey New Member

    Joined:
    Aug 17, 2005
    Messages:
    2
    Likes:
    0
    Thanks Pommie.
     

Share This Page