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

    haxan New Member

    Joined:
    Nov 17, 2009
    Messages:
    387
    Likes:
    0
    ok finally the GLCD is working but i still get some glitches init. It seems that when ever i plug out power, then plug it back again after like 20 sec, the GLCD doesn't show anything, however, continuously pressing and releasing the reset button sometimes shows the display. Can this be a timing issue? I am using 4MHz external crystal
     
  2. haxan

    haxan New Member

    Joined:
    Nov 17, 2009
    Messages:
    387
    Likes:
    0
    Fixed :) turns out my Reset Pin of GLCD was not properly connected with 5v :D
     
  3. Electro_Mad09

    Electro_Mad09 New Member

    Joined:
    Apr 8, 2010
    Messages:
    3
    Likes:
    0
    Dear hkBattousai: for some reasons, I am not able to download your zip file. Do you mind sending me a copy. Thanks!
     
    Last edited: Apr 8, 2010
  4. dave

    Dave New Member

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


     
  5. edeca

    edeca Active Member

    Joined:
    Apr 8, 2008
    Messages:
    589
    Likes:
    38
    Location:
    England

    The picture says it all:

    [​IMG]

    Code ported to HI-TECH C with no issues whatsoever. Will post it once it is tidied up, but really it is mostly identical. Also works with hardware absolutely fine.

    Could shave a fair chunk off the font by making the format:

    Code (text):
    WIDTH,byte1,byte2,byte3...
    But that would require extra code to scan the array from the start each time, therefore would be slower. Will have to try it and see how well it works.

    Next step, images! Then perhaps some simple "GUI" components, such as a progress bar using the vline/hline routines.
     
  6. Electro_Mad09

    Electro_Mad09 New Member

    Joined:
    Apr 8, 2010
    Messages:
    3
    Likes:
    0
    Finally, I make it working now. Thanks all the posts in this threat.
    [​IMG]
     
  7. Electro_Mad09

    Electro_Mad09 New Member

    Joined:
    Apr 8, 2010
    Messages:
    3
    Likes:
    0
    All right, I finally make it working. Thanks guys, for all of your posts, which guide me through this.
     

    Attached Files:

  8. FET_Destroyer

    FET_Destroyer New Member

    Joined:
    Jul 18, 2010
    Messages:
    5
    Likes:
    0
    Location:
    Portugal
    Hi to all
    I'm new in this forum.
    I'm now using the pommie library wich is very good. I want to know if anyone has make a big font function?
    I try to make a big font function like PutBIGChar but with no sucess. The caracter apears to be all crazy. Can anyone help?
    If we do some brainstroming here maybe we can find a function to do that, and then the library of pommie will be much more complete.
    I think this function will be helpful to everybody.
     
  9. hkBattousai

    hkBattousai Member

    Joined:
    Oct 30, 2009
    Messages:
    196
    Likes:
    0
    Hmm, I will think about this. It would be easy multiplying font size by integer coefficients (x2, x3 or x4), is that OK with you? You don't mean increasing font size by 20%, do you?
     
  10. FET_Destroyer

    FET_Destroyer New Member

    Joined:
    Jul 18, 2010
    Messages:
    5
    Likes:
    0
    Location:
    Portugal
    Hi hkBattousai
    I don't realy mather the size of it, I just want a bigger font LOL.
    I was thinking in a font about 13x18, It's a very big font. I creat it but I cannot use the font.
    I try to change de putchar function with no success at all.
     
  11. edeca

    edeca Active Member

    Joined:
    Apr 8, 2008
    Messages:
    589
    Likes:
    38
    Location:
    England
    Post the code you have tried to modify. That way we can help you see where it might be wrong.

    Changing the function to accomodate a bigger font should not be hard. If you want to adapt the existing function then you will notice it always uses a height of 8, this is due to the way the column write works on the GLCD controller. You could modify it to have any height you liked, but unless it is a multiple of 8 (or you don't care about overwriting pixels) a read-modify-write would be required.
     
  12. FET_Destroyer

    FET_Destroyer New Member

    Joined:
    Jul 18, 2010
    Messages:
    5
    Likes:
    0
    Location:
    Portugal
    Hi edeca
    I don't have a version of the putBIGchar. I change ony the values.
    For testing purposes I was trying to make a 16x16 font wich is multiple of 8, i try many times to chage the putchar function so I don't have the codee cause I will erase it because anything works. LOL
    Now I was looking again to the putchar function but no success.
     
  13. FET_Destroyer

    FET_Destroyer New Member

    Joined:
    Jul 18, 2010
    Messages:
    5
    Likes:
    0
    Location:
    Portugal
    Hi.
    I make my own bold fonts. It looks OK, but when I arrange some chars I will post the const table and the PutBOLDchar function, basicaly is the pommie function but I only change the name of the font for the bold font.

    [​IMG]
     
  14. FET_Destroyer

    FET_Destroyer New Member

    Joined:
    Jul 18, 2010
    Messages:
    5
    Likes:
    0
    Location:
    Portugal
    Hi
    Has anyone make this functions work on a PIC with a crystal greather than 10Mhz?? I using 10mhz, and it wokrs fine, but when I use 4xPLL, or 40Mhz I only see crazy stuff on the LCD, it seems to me like a timming problem so I try to make longer de delay() but no sucess. I put 20 NOP in the delay function and do not work.
    Can anyone help me?
    EDIT: Solved
     
    Last edited: Jul 28, 2010
  15. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,162
    Likes:
    340
    Location:
    Brisbane Australia
    I just tried it and had to set the config to,
    Code (text):

    #pragma config WDT = OFF, FOSC = HSPLL_HS, LVP = OFF , DEBUG = ON, CPUDIV = OSC1_PLL2, PLLDIV = 5
     
    This clocks the CPU at 48MHz (with a 20MHz crystal) and so I had to put a delay after each write to b_GLCD_E=1 . I.E.
    Code (text):

    void delay(){
        _asm nop _endasm
        _asm nop _endasm
        _asm nop _endasm
        _asm nop _endasm
    }

    unsigned char GLCD_Read(void){
    unsigned char W;
        b_GLCD_E=1;
        delay();
        W=GLCD_Data;
        b_GLCD_E=0;
        return W;
    }
    Have fun.

    Edit, missed your edit.

    Mike.
     
    Last edited: Jul 29, 2010
  16. crocu

    crocu Member

    Joined:
    Feb 20, 2009
    Messages:
    118
    Likes:
    1
    Location:
    France
    Hello,

    I experiencing problem with the GLCD library when i try to display any geometrical drawing :

    I'm able to properly display any text with Putmessage but any other function that uses plot are getting outstanding results.

    In fact, i found that a simple line is always 8 pixels high instead of 1 pixel high.

    Please see below the screen capture showing the result i get.


    This is my plot function : ( i also attach my GLDC.c file )

    Code (text):

    // CS_pins_active_low ( complemented pins )
    #define ENABLED 0
    #define DISABLED 1


    void plot(unsigned char x,unsigned char y){
    unsigned char d;

        if(x>63){
            b_GLCD_GCS1= DISABLED;
            b_GLCD_GCS2= ENABLED;
            x-=64;
        }
        else
        {
            b_GLCD_GCS1= ENABLED;
            b_GLCD_GCS2= DISABLED;
        }
        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();
        GLCD_Write_Cmd(0x40+x);                 // write column address again
        d=d|(1<<(y&7));                        
        GLCD_Write_Data(d);
    }
    Can someone help me to solve that problem please ?
    I can't find the solution .
     

    Attached Files:

    Last edited: Nov 20, 2010
  17. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,162
    Likes:
    340
    Location:
    Brisbane Australia
    The reason it is messing up is because it is always reading zero from the display. Check that the R/W line is connected properly and define correctly.

    Mike.
     
  18. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
    hey make sure you set i as a char like

    Code (text):

    void hline(unsigned char x1,unsigned char x2,unsigned char y){
    [B]unsigned char i = 0;[/B]
        for(i=x1;i<x2;i++)
            plot(i,y);
    }

    void vline(unsigned char x,unsigned char y1,unsigned char y2){
    [B]unsigned char i = 0;[/B]
        for(i=y1;i<y2;i++)
            plot(x,i);
    }

     
     
  19. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
    Hey Pommie my PLOT is acting funny heh. I can write text and stuff and i know the plot works because i see it after i reprogram the device.

    Like i press play then it runs through code but i cant see it on GLCD. Then i press stop and play again and it shows it ? Weird right?
     
  20. crocu

    crocu Member

    Joined:
    Feb 20, 2009
    Messages:
    118
    Likes:
    1
    Location:
    France
    I checked all the pins defined and they are all ok.


    But i forgot to say that i had to comment out return W line in GLCD_Read function because this line freezes the program and it gets stuck.

    Code (text):
    unsigned char GLCD_Read(void){
        b_GLCD_E=1;
        Delay();
        W=GLCD_Data;
        b_GLCD_E=0;
        Delay();
        //[COLOR="Red"]return W[/COLOR];
    }

    When i comment out return W, then i'm getting the results i described in my last post.

    Maybe removing return W from the function should explain why i get hlines with 8 pixels high .

    But I really do not understand why returning W from GLCD_Read freezes the program. :confused:
    ( i'm not using W variable anywhere else in my program )

    W is also returned from GLCD_Read_Data function but there it does not get any bad impact ...



    I tried to initialize "i" as suggested by AtomSoft in hline and Vlinewith unsigned char i = 0; but i do not get any changes.

    Many thanks for your help,
     
    Last edited: Nov 21, 2010
  21. bryan

    bryan Member

    Joined:
    Jun 21, 2003
    Messages:
    416
    Likes:
    3
    Location:
    Vancouver, Canada
    Change the W to a w, lower case and it will work. I believe it is a reserved word when in the Upper Case
     

Share This Page