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

    crocu Member

    Joined:
    Feb 20, 2009
    Messages:
    118
    Likes:
    1
    Location:
    France
    I tried to replace W by another name of variable but problem is the same . :(
     
  2. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
    Dude for some reason i had to add
    Code (text):

        GLCD_Write_Cmd(0x3f);    //display on
     
    To the end of my PLOT code and it works now heh
     
  3. crocu

    crocu Member

    Joined:
    Feb 20, 2009
    Messages:
    118
    Likes:
    1
    Location:
    France
    I added the line as you suggest without success ... Lines are 8 pixels high . :(

    Code (text):

        GLCD_Write_Cmd(0x3f);    //display on
     
    Atomsoft, would you please post your GLCD.c and GLCD.h files, because i really don't know how to fix this problem .

    Many thanks,
     
  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

    im on ARM my whole code is different now.
    I fixed mines with a BUFFER of 1024 bytes and i edit the bytes then draw entire screen. Works nice now
     
  6. crocu

    crocu Member

    Joined:
    Feb 20, 2009
    Messages:
    118
    Likes:
    1
    Location:
    France
    I need to declare W as a unsigned ROM char

    Code (text):
    unsigned rom char W;
    Code (text):
    unsigned char GLCD_Read(void){
        b_GLCD_E=1;
        Delay();
        ww=GLCD_Data;
        b_GLCD_E=0;
        Delay();
        return W;
    }
    Now, lines are 1 pixel high.

    But displaying a picture is not working properly ...
    The pixels are sliding and moving ... i don't know why .
     
    Last edited: Nov 21, 2010
    • Like Like x 1
  7. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,008
    Likes:
    316
    Location:
    Brisbane Australia
    Try changing it to,
    Code (text):

    unsigned char GLCD_Read(void){
    unsigned char dat;
        b_GLCD_E=1;
        Delay();
        dat=GLCD_Data;
        b_GLCD_E=0;
        Delay();
        return dat;
    }
    Mike.
     
  8. crocu

    crocu Member

    Joined:
    Feb 20, 2009
    Messages:
    118
    Likes:
    1
    Location:
    France
    well, it does not change anything ...

    I'm still getting many plots everywhere on my GLCD screen when i call line, box, circle functions. :eek:

    Only text messages from the font placed in ROM gets correct result.

    I bought my GLCD on Ebay ( from China ) , maybe it is bad quality ?
    Text is correctly displayed so i should normally get geometrical functions working as well ...
     
  9. crocu

    crocu Member

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

    Can someone b kind to try my test code attached below,
    i'm getting crazy to get geometrical and picture displaying functions working well...

    The code compile without any error but when i run it, i only get text displayed properly.

    Hlines, Vlines, logo, plot , rectangles get bad results. ( missing and moving pixels )

    My code is set for 18F2620 ( 10 Mhz crystal ).
    My GLCD CS pins are complemented.

    Proteus simulator gives me exactly same results as hardware does.
    See the capture result attached below.

    Many thanks for your help, i'm stuck !:eek:
     

    Attached Files:

    Last edited: Nov 25, 2010
  10. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
    the error seems to be happening when drawing vertical lines
     
  11. crocu

    crocu Member

    Joined:
    Feb 20, 2009
    Messages:
    118
    Likes:
    1
    Location:
    France
    yes, i agree with you.

    But vline function looks to be properly written ... i don't know what is wrong.

    Can someone post a fully tested code for me please ?
    Then, i will try it on my design.

    Many thanks,
     
  12. crocu

    crocu Member

    Joined:
    Feb 20, 2009
    Messages:
    118
    Likes:
    1
    Location:
    France
    Did someone try the code i posted ?

    I really need your help : I'm suspecting my hardware working not correctly.
    If my code works with other GLCD displays it means mine is faulty .

    Many thanks for your help,
     
  13. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
    I cracked my GLCD supposed to get a nice new one by today in mail. I got to goto postal office. Ill take pictures after but i cant help until then
     
  14. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,008
    Likes:
    316
    Location:
    Brisbane Australia
    I don't have any hardware setup at the moment but I had a quick look at the code. Why have you removed the code to wait until the display is ready to accept new commands?

    Code (text):

    unsigned char GLCD_Read_Data(void){
        [COLOR="red"]//Wait_Not_Busy();[/COLOR]
        TRIS_Data=0xff;
        Delay();

        b_GLCD_RS=1;
        b_GLCD_RW=1;
        b_GLCD_E=1;
        Delay();

        b_GLCD_E=0;
        Delay();
        b_GLCD_E=1;
        Delay();
        dat=GLCD_Data;   [COLOR="red"] //move this line up before b_GLCD_E=1;[/COLOR]
        b_GLCD_RW=0;
        TRIS_Data=0x00;
        return dat;
    }
     
    Doing the above would explain the problem.

    I see you have tried adding delays but why not do it the right way anyway?

    Edit, and you've changed the order it does things. You read the data after the display is disabled!!!! Just switch back to my original code and it should work fine.

    Mike.
     
    Last edited: Nov 27, 2010
  15. crocu

    crocu Member

    Joined:
    Feb 20, 2009
    Messages:
    118
    Likes:
    1
    Location:
    France
    I put it back has it should be ( here is attached the project with modifications )

    -->
    Code (text):
    unsigned char GLCD_Read_Data(void){
        Wait_Not_Busy();
        TRIS_Data=0xff;
        b_GLCD_RS=1;
        b_GLCD_RW=1;
        b_GLCD_E=1;
        Delay();
    //  dat=GLCD_Data^0xff;         // inverse display mode
        dat=GLCD_Data;              // regular display mode
        b_GLCD_E=0;
        TRIS_Data=0x00;
        return dat;
    }
    However, vertical lines problem remains ...


    By the way, i tried to port Pommie's original code in order to use it with my Pic 18F2620 : compilation completes without error but simulation and hardware test get a blank display ( nothing displayed ) when running the program...

    I also attach Pommie's code ported for 18F2620.zip


    Many thanks for your help,
     

    Attached Files:

  16. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,008
    Likes:
    316
    Location:
    Brisbane Australia
    Edit, I looked at the wrong code earlier. Don't have time now to look again. Will have a look later.

    Mike.
     
    Last edited: Nov 29, 2010
  17. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,008
    Likes:
    316
    Location:
    Brisbane Australia
    I've now looked through your code and can't see any reason that it doesn't work.

    What happens if you just plot one pixel in the middle of the screen?

    BTW, I can't try your code as I recently moved and the GLCD is still in a box somewhere. Should be unpacked by weekend.

    edit, just noticed,
    Code (text):

    // A/D PORT Configuration
        ADCON1 = 0x00;          // all digital
        INTCON2bits.RBPU = 1;  // Disable internal PORTB pull-ups
    This sets it to all analogue. ADCON1 should be 0x0f for all digital. Good news, this would explain your result.

    Mike.
     
    Last edited: Nov 29, 2010
  18. crocu

    crocu Member

    Joined:
    Feb 20, 2009
    Messages:
    118
    Likes:
    1
    Location:
    France
    If i use my partial working code ( my code for 18F2620.zip )and try to lit 1 or many pixel with plot function it works fine.

    hline is working well too.

    However, in any cases i found that Isis simulator gets Warnings while program runs :
    it reports logic contention for D0 to D7 pins. ( showing yellow flashes near pins names )

    Regarding vline : it looks it display every pixel very very slowly one by one.

    Maybe some more delays are required somewhere ?

    ---

    I tried the same test with your original code ported for 18F2620, but nothing is displayed at all.

    This is strange because your original code is working perfectly with 18F4550...


    May i suggest you when you will have time to try my code below and port it for your PIC ( 18F4550 ) ?

    Then, we will see if you get same issues.

    Many thanks,
     

    Attached Files:

    Last edited: Nov 29, 2010
  19. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,008
    Likes:
    316
    Location:
    Brisbane Australia
    Did you try changing ADCON1 to 0x0f as I suggested?

    Mike.
     
  20. crocu

    crocu Member

    Joined:
    Feb 20, 2009
    Messages:
    118
    Likes:
    1
    Location:
    France
    Yes, i did change it.
    But without success, result is the same :(
     
  21. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,008
    Likes:
    316
    Location:
    Brisbane Australia
    Your latest code still shows it as zero!!

    Code (text):

    void main(void)
    {

    // A/D PORT Configuration
     [COLOR="red"]ADCON1 = 0x00[/COLOR];            // all digital
     INTCON2bits.RBPU = 1;  // Disable internal PORTB pull-ups

     
    If this is how your code is, then it will cause this problem as analogue pins always read back as zero.

    From my original code,
    Code (text):

    void main (void){
    unsigned char i;
        OSCCON=0x70;
        [COLOR="red"]ADCON1=0x0f;[/COLOR]   // all digital
     
    Mike.
     
    Last edited: Nov 30, 2010

Share This Page