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. Electronic2050

    Electronic2050 New Member

    Joined:
    Apr 28, 2007
    Messages:
    37
    Likes:
    0
    Location:
    Iran
    wow...
    thanks a lot dear jason it work very nice
    really you are professional.
     
  2. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
    na lol i wish i was. I would be making money lol. This is for fun and you are very welcome.
     
  3. jorg1n

    jorg1n New Member

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

    I made the change so that I can write in black on a white background, it works very well with the function "PutMessage", but why can't i view my logo when i do "PutLogo", whereas before making the change I got to do what I wanted. I wish that my logo is black on a white background..

    I think it would be nice to add some features like draw a circle, or add another size of font.
    I would also perform a function that clears a defined area, a function like: ClearScreenZone (x1, y1, x2, y2).
    Thank you in advance
     
  4. dave

    Dave New Member

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


     
  5. jorg1n

    jorg1n New Member

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

    I watched the "PutLogo" and it involves the "plot", so I presume it must change (reverse) data as you do in the function "putchar", but it does not work correctly. ..
    I inpression that the data are inverted, but they are not sent correctly.
    Here is the update:

    Code (text):
    void plot(unsigned char x,unsigned char y){
    unsigned char d;
        if(x>63){
            b_GLCD_GCS1=1;
            b_GLCD_GCS2=0;
            x-=64;
        }
        else
        {
            b_GLCD_GCS1=0;
            b_GLCD_GCS2=1;
        }
        GLCD_Write_Cmd(0x40+x);         //write column address
        GLCD_Write_Cmd(0xb8+(y>>3));    //write row address
        d=GLCD_Read_Data();             //dummy read
        d=GLCD_Read_Data();
        d=~d;                                            /////ADD
        GLCD_Write_Cmd(0x40+x);         //write column address again
        d=d&(0xff-(1<<(y&7)));
        GLCD_Write_Data(d);
    }
    Can you help me please..
    Thanks in advance
     
  6. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
    i just started on the GLCD clock again. I thought since i had gained so much knowledge ill finish my first clock then continue. The pics below are all the clocks i have made and the last would be GLCD one but im still developing the menu for setting the time/date/alarm.

    The first one is the best TIME shower. I can see the time across the room at night when im sleepy and it doesn't disturb the eyes. The middle is my desk clock for now until the glcd is done.
     

    Attached Files:

    • rev1.jpg
      rev1.jpg
      File size:
      67.7 KB
      Views:
      219
    • rev2.jpg
      rev2.jpg
      File size:
      105.9 KB
      Views:
      214
    • rev3.jpg
      rev3.jpg
      File size:
      107.5 KB
      Views:
      256
  7. superbrew

    superbrew Member

    Joined:
    Oct 1, 2007
    Messages:
    117
    Likes:
    2
    Location:
    Nashua, NH
    I am using almost the same code and it functions properly for me. My plot function has this line different:

    Yours
    Code (text):

            d=d&(0xff-(1<<(y&7)));
     
    Mine
    Code (text):

            if(color)d=d|(1<<(y&7));
        else d=d&(0xff-(1<<(y&7)));
     
    Also, here is a function to draw a circle:
    Code (text):

    void bhsmcircle(int xc,int yc,int r)
    {
        int x=0,y=r,dp;
        dp=1-r;
        for(;x<y;x++)
        {
            if(dp<0)
            {
                dp+=2*x+3;
            }
            else
            {
                dp+=2*(x-y)+5;
                y--;
            }
            plot(x+xc,y+yc,1);
            plot(-x+xc,-y+yc,1);
                plot(x+xc,-y+yc,1);
            plot(-x+xc,y+yc,1);
            plot(y+xc,x+yc,1);
            plot(-y+xc,-x+yc,1);
            plot(-y+xc,x+yc,1);
            plot(y+xc,-x+yc,1);
        }
    }
    EDIT: Be aware that the circle will look more like an ellipse due the rectangular shape of the pixels on the GLCD.
     
    Last edited: Feb 25, 2009
  8. jorg1n

    jorg1n New Member

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

    Thank you for your help.
    But according to your function "bhsmcircle",you call the function "plot", but there is 3 arguments: "plot(x+xc,y+yc,1)", the "1" corresponds to the variable "color"?

    Should we add the argument "color" has all the functions?
    Thank you again
     
  9. jorg1n

    jorg1n New Member

    Joined:
    Feb 11, 2009
    Messages:
    29
    Likes:
    0
    I want to do a function for Clear a zone of the glcd as :
    ClearScreenZone (x1, y1, x2, y2)
    But I can not ...
    Can you help me if you like ...
    Thank you in advance
     
  10. Pommie

    Pommie Well-Known Member Most Helpful Member

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

    void ClearScreenZone(char x1,char y1,char x2,char y2){
    char i,j;
        for(i=y1;i<y2;i++){
            for(j=x1;j<x2;j++)
                unplot(i,j);
        }
    }
     
    Mike.
     
  11. jorg1n

    jorg1n New Member

    Joined:
    Feb 11, 2009
    Messages:
    29
    Likes:
    0
    Thank you,

    But i don't have function "unplot"...
    I think to do :
    Code (text):
    void ClearScreenZone(unsigned char x1,unsigned char y1,unsigned char x2,unsigned char y2){
    unsigned char m,n;
            for(m=y1;m<y2;m++)
                {
                for(n=x1;n<x2;n++)
                    {
                    if(n>63){
                        b_GLCD_GCS1=1;
                        b_GLCD_GCS2=0;
                        n-=64;
                        }
                    else
                        {
                        b_GLCD_GCS1=0;
                        b_GLCD_GCS2=1;
                        }
                    GLCD_Write_Cmd(0x40+n);         //write column address
                    GLCD_Write_Cmd(0xb8+(m>>3));    //write row address
                    GLCD_Write_Data(0x00);
                    }

                }
    }
    But it is not yet available
     
  12. jorg1n

    jorg1n New Member

    Joined:
    Feb 11, 2009
    Messages:
    29
    Likes:
    0
    It's good ... I succeeded, I created a "unplot" identical to "plot" and I replaced:
    Code (text):
         d=d|(1<<(y&7));
    by:
    Code (text):
    d=d&(0xff-(1<<(y&7))); 
    Thanks a lot...
     
  13. superbrew

    superbrew Member

    Joined:
    Oct 1, 2007
    Messages:
    117
    Likes:
    2
    Location:
    Nashua, NH
    Sorry, I forget that my plot function has a color argument added. Well, all my functions that draw something have a color argument added. That is why my plot function is different than yours.
     
  14. jorg1n

    jorg1n New Member

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

    can you send me your file glcd.c because I too would like the opportunity to choose the color.
    And i have another question, how do you display a variable of type float or int, for do a voltmeter, for example.
    Thank you in advance
     
    Last edited: Feb 26, 2009
  15. jorg1n

    jorg1n New Member

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


    I have a problem when I want to write a message, I have a string of characters that is nothing ... and that since I added my functions "unplot", "circle" and "fillzone" ...
    I post therefore my glcd.c file, could you help me ..

    PS: "superbrew", can you send me your your glcd.c which also functions as setting the color of writing?

    Thanks in advance
     

    Attached Files:

    • GLCD.c
      File size:
      9.4 KB
      Views:
      311
  16. superbrew

    superbrew Member

    Joined:
    Oct 1, 2007
    Messages:
    117
    Likes:
    2
    Location:
    Nashua, NH
    Sorry this took so long. It is a work in progress, so it may be a little messy.
     

    Attached Files:

    • GLCD.c
      File size:
      12.3 KB
      Views:
      277
  17. juanog

    juanog New Member

    Joined:
    Feb 16, 2009
    Messages:
    6
    Likes:
    0
    clear all screen

    Hi, I tried the function ClearScreenZone with the function unplot(), but only erase the middle of the screen and I need erase all the screen. Can you help me please...thanks
     
  18. jorg1n

    jorg1n New Member

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

    I have a display problem but not always present.At the launch of my program, the display is correct, and from a time, the display starts to be weird, cutting off the display ( see picture), point cloud ..

    Have you any idea?

    Thank you in advance
     

    Attached Files:

    Last edited: Mar 5, 2009
  19. superbrew

    superbrew Member

    Joined:
    Oct 1, 2007
    Messages:
    117
    Likes:
    2
    Location:
    Nashua, NH
    I don't know the technical explanation for that, but it can happen if you try to write a pixel at a location greater than y = 64 or x = 128. Hope that helps.
     
  20. jorg1n

    jorg1n New Member

    Joined:
    Feb 11, 2009
    Messages:
    29
    Likes:
    0
    You're right, it then yest sometimes greater than 64 and x greater than 128.
    But how can I solve my problem? Is there a solution?
    Thank you in advance
     
  21. superbrew

    superbrew Member

    Joined:
    Oct 1, 2007
    Messages:
    117
    Likes:
    2
    Location:
    Nashua, NH
    You will have fix whatever code writes to those locations and prevent it from doing so.
     

Share This Page