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

    bryan Member

    Joined:
    Jun 21, 2003
    Messages:
    416
    Likes:
    3
    Location:
    Vancouver, Canada
    Hi Pommie:

    Pretty much played with everything, changing oscillators, using internal vs external. Attached is a pic of your project running on Proteus with the defines changed to make it compatible with the EP4 development board. As you can see it works fine on Proteus but just won't work on a breadboard or the EP4.

    Second pic is what is displayed when the pic is first programmed, as you can see there is problems in the display. Turning off/on the board's power and then nothing will display.

    I know the display is fine because I can get it to work on a breadboard or EP4 with Richard.C assembler code for the KS0108

    Have tried debugging with my PK2 and still can not get anything to display, or see where the problem is. Perhaps I am missing a config setting by using the 18f4520 instead of 18f4550.

    My define's

    #include <p18f4520.h>

    #define GLCD_Data PORTD
    #define b_GLCD_GCS1 LATBbits.LATB1
    #define b_GLCD_GCS2 LATBbits.LATB0
    #define b_GLCD_RS LATBbits.LATB2
    #define b_GLCD_RW LATBbits.LATB3
    #define b_GLCD_E LATBbits.LATB4
    #define b_GLCD_ON LATBbits.LATB5
    #define b_GLCD_BL LATBbits.LATB6

    #define TRIS_Data TRISD
    #define b_TRIS_GCS1 TRISBbits.TRISB1 //GCS1
    #define b_TRIS_GCS2 TRISBbits.TRISB0 //GCS2
    #define b_TRIS_RS TRISBbits.TRISB2 //RS
    #define b_TRIS_RW TRISBbits.TRISB3 //RW
    #define b_TRIS_E TRISBbits.TRISB4 //E
    #define b_TRIS_ON TRISBbits.TRISB5 //RST
    #define b_TRIS_BL TRISBbits.TRISB6 //backlight
     

    Attached Files:

  2. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,015
    Likes:
    317
    Location:
    Brisbane Australia
    That picture looks like it is a timing problem. My guess is that you are running at a much higher clock rate than I was. Try repeating the asm line in delay.

    I.E.
    Code (text):

    void Delay(void){
        _asm    NOP _endasm
        _asm    NOP _endasm
        _asm    NOP _endasm
        _asm    NOP _endasm
    }
     
    Mike.
     
  3. pwssr

    pwssr New Member

    Joined:
    Sep 5, 2006
    Messages:
    24
    Likes:
    0
    Location:
    MA
    Bill,

    I would like to try the Scope software, but can't seem to find the post. Could you please point me to it?

    Thanks,
    Paul
     
  4. dave

    Dave New Member

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


     
  5. notjohndavid

    notjohndavid New Member

    Joined:
    Dec 29, 2008
    Messages:
    3
    Likes:
    0

    am I just a retard or is the glcd.zip attachment no longer available for download?
     
  6. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    168
    Location:
    Toronto, Canada
    I'll see if I can locate it on my site.
     
  7. notjohndavid

    notjohndavid New Member

    Joined:
    Dec 29, 2008
    Messages:
    3
    Likes:
    0
    greatly appreciated!
     
  8. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    168
    Location:
    Toronto, Canada
    I've found this pair in my archives. Not sure if they're the latest though.
     

    Attached Files:

  9. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,015
    Likes:
    317
    Location:
    Brisbane Australia
    Here you go.

    Mike.
     

    Attached Files:

    • GLCD.zip
      File size:
      31.6 KB
      Views:
      952
  10. notjohndavid

    notjohndavid New Member

    Joined:
    Dec 29, 2008
    Messages:
    3
    Likes:
    0
    ahh.. thanks guys :) This gives me something to waste time^H^H^H^H^H^H^H^H^H^Hplay with tonight
     
  11. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
    Hey i know this thread is kinda old just wanted to say thanks for the code and i modded it slighty to fit a PIC18F448 @ 20 Mhz and here is the code if anyone needs it. (doesnt show that logo and stuff tho.)

    I aslo found it does say you need to read the data twice ...
    Im not sure if it was meant for that but i would have assumed it was.

    Here is my code(your code) , my image and my finding in the datasheet.
     

    Attached Files:

  12. Electronic2050

    Electronic2050 New Member

    Joined:
    Apr 28, 2007
    Messages:
    37
    Likes:
    0
    Location:
    Iran
    I can not download files(GLCD.zip , unicorn.jpg ) in the first thread:confused: can you upload this file again.
    thanks.
     
  13. AtomSoft

    AtomSoft Well-Known Member

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

    AtomSoft Well-Known Member

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

    Here is a picture of it in action:
     

    Attached Files:

  15. Electronic2050

    Electronic2050 New Member

    Joined:
    Apr 28, 2007
    Messages:
    37
    Likes:
    0
    Location:
    Iran
    thanks (AtomSoft)
    i using of GLCD.zip file for interfacing with GLCD and when i send a data or pic and other
    to GLCD that appear white and null pixel are black how i inverse the state of all pixel on GLCD
    i try to change the "ClearScreen" function on GLCD.c too:

    i change the line "GLCD_Write_Data(0xff);" to "GLCD_Write_Data(0x00);"
    for clear lcd with zero but it was same with 0xff.
     
  16. bryan

    bryan Member

    Joined:
    Jun 21, 2003
    Messages:
    416
    Likes:
    3
    Location:
    Vancouver, Canada
    In the function, add change the following

    -=Bryan=-



    Code (text):
    void PutChar(unsigned char data){
    unsigned char i,d;
        if(data<32){
            switch(data){
                case 13:
                    XPos=0;
                case 10:
                    XPos=0;
                    YPos+=8;
                    YPos=YPos&63;
            }
            WritePosition();
        }
        else{
            for(i=0;i<7;i++){
                d=Font[data-32][i];
                if(d!=0x55){
                    d=~d;                             //ADD
                    GLCD_Write_Data(d);
                    MoveRight();
                }
            }
            //GLCD_Write_Data(0xff);
           GLCD_Write_Data(0x00);             //CHANGE
            MoveRight();
        }
    }
     
  17. Electronic2050

    Electronic2050 New Member

    Joined:
    Apr 28, 2007
    Messages:
    37
    Likes:
    0
    Location:
    Iran
    thanks bryan i test your change and it work nice:eek:.
    i need problem with logo:(, how i change my favorite picture to code that compatible with GLCD.c (putlogo function):confused:
    and how work the "putlogo" function?
    anyone have software or converter to convert this codes.
     
  18. Electronic2050

    Electronic2050 New Member

    Joined:
    Apr 28, 2007
    Messages:
    37
    Likes:
    0
    Location:
    Iran
    anybody can help me?
     
  19. bryan

    bryan Member

    Joined:
    Jun 21, 2003
    Messages:
    416
    Likes:
    3
    Location:
    Vancouver, Canada
    Not sure what you want to do. Do you want to create your own logo?
     
  20. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,015
    Likes:
    317
    Location:
    Brisbane Australia
    I have a VB program that I wrote to convert the original logo. It's really badly written and not suitable for general use but I am happy to use it to convert your logo. If you want it converting then just attach it to a post.

    Mike.
     
  21. Electronic2050

    Electronic2050 New Member

    Joined:
    Apr 28, 2007
    Messages:
    37
    Likes:
    0
    Location:
    Iran
    thanks of bryan and Pommie for reply
    thanks Pommie, but i don't need to convert one or two logo.
    i need urgent a software for convert logo.
    can you give me your software.
     

Share This Page