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

GLCD (Wayton MG1206E) CS1 CS2 polarity ...

Discussion in 'Microcontrollers' started by granddad, May 17, 2017.

  1. granddad

    granddad Active Member

    Joined:
    Jan 18, 2015
    Messages:
    711
    Likes:
    65
    Location:
    Worcestershire UK
    I had this 2.5” 128x64 GLCD (WAYTON MIT MG1206E SGL) in my parts box , and in a crazy moment I thought I would see if it worked ( It was from a Maplin grab bag of led / lcd junk) , found some data on the www and lashed up a test bed, having realised graphics LCD require big-ish data squirted at them I used a dsPIC33EV256GM104 it is has 16k ram available. ( no details of the 20 pins on the pcb ) several days later ….. success. Well some lines on the screen, seems NT7108 / KS0108 controllers are not all the same, this one has a high level CS1 and CS2 ,( Left and right side controllers) not seen any mention of this on the files / posts found on the web. So though I would share. My intention is to write fonts / graphics into an array in PIC memory and just display that….
    ( colours are just my BB wire reference ).

    wayton1206e2.jpg
    GLCD_lashup.jpg
     
    Last edited: May 17, 2017
  2. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    9,821
    Likes:
    303
    Location:
    Brisbane Australia
    ONLINE
    Not sure if it's useful or not but attached is some code I wrote about 10 years ago for one of these displays.

    Mike.
     

    Attached Files:

    • Like Like x 1
    • Thanks Thanks x 1
  3. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    8,877
    Likes:
    863
    Location:
    Rochdale UK
    ONLINE
    Wow Mike... That's what I call a concise library.. Mine is half that size.. I do, however, use a double buffer, so alot of my code write's are to the spare canvas...

    Well done though!!
     
  4. dave

    Dave New Member

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


     
  5. granddad

    granddad Active Member

    Joined:
    Jan 18, 2015
    Messages:
    711
    Likes:
    65
    Location:
    Worcestershire UK

    Thank you Mike, I'm getting to understand the GLCD controller ( possibly ! )
    lcd01.jpg .
     
  6. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    9,821
    Likes:
    303
    Location:
    Brisbane Australia
    ONLINE
    I particularly like the circle routine because it completely baffles people how it works.
    Code (text):

    void Circle(unsigned char cx,unsigned char cy,unsigned char r){
        unsigned char x,y,p;
        x=0;
        y=r;
        p=-r/2;
        while(x<=y){
            Plot8(cx,cy,x,y);
            x=x+1;
            if(p>128){
                p+=2*x+1;
            }else{
                y--;
                p+=2*(x-y)+1;
            }
        }
    }
    Mike.
     
  7. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    8,877
    Likes:
    863
    Location:
    Rochdale UK
    ONLINE
    If you come across a simple arc routine, let me know..
     
  8. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    9,821
    Likes:
    303
    Location:
    Brisbane Australia
    ONLINE
    The way the circle routine works is the same as those nail and string curved paterns. The axes are at right angles in the circle case and a quarter circle is generated by working along "the nails". Using lines at different angles and lengths should give various arcs.

    Mike
     
  9. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    8,877
    Likes:
    863
    Location:
    Rochdale UK
    ONLINE
    I know.... But a arc could cross the 90 degree, that means the 8 point routine won't do the job.. So if you come across one!! I have written one, but it's a little slow, too many iterations... if this and if that!! Ill convert it to asm to see if I can boost the speed..
     
  10. atferrari

    atferrari Well-Known Member

    Joined:
    Oct 8, 2003
    Messages:
    2,751
    Likes:
    118
    Location:
    Buenos Aires - Argentina
    Long time I do not use one of these. From what I recall, not all manufacturer use CS1 ans CS2 in the same way. Besides the allocation of pins, that is what distinguish GLCDs from each other.
     
    Last edited: May 19, 2017
    • Thanks Thanks x 1
  11. atferrari

    atferrari Well-Known Member

    Joined:
    Oct 8, 2003
    Messages:
    2,751
    Likes:
    118
    Location:
    Buenos Aires - Argentina
    Hola granddad,

    I inherited from a failed replacement (difference in pins allocation) a brand new one. :)

    After searching for the datasheet of a quickly vanished manufacturer in Brazil, I realized that there were kind of discernible patterns among the variation for different brands. :happy:

    I finally compiled the data from several tens of datasheets and based on the pins allocated to power I could use mine successfully. The data is shown in the attached pdf. With my "electronic" PC down, it is good I got a proper back up handy. Hope you can wade through it.

    One day I should post my implementation of the John Conway's game "Life". A piece of judicious programming I enjoyed much. Really.

    ¡Buena suerte!
     

    Attached Files:

  12. granddad

    granddad Active Member

    Joined:
    Jan 18, 2015
    Messages:
    711
    Likes:
    65
    Location:
    Worcestershire UK
    Thank you at , let wading commence...
     
  13. granddad

    granddad Active Member

    Joined:
    Jan 18, 2015
    Messages:
    711
    Likes:
    65
    Location:
    Worcestershire UK
    ThanksM.jpg

    Mike, Not copy and paste of your code , but got lots of help etc, understand the true type working , just have to reinvent it for my project... Cheers.
     
  14. granddad

    granddad Active Member

    Joined:
    Jan 18, 2015
    Messages:
    711
    Likes:
    65
    Location:
    Worcestershire UK
    I now have 2 more 128x64 GLCD modules to play with , a Winstar , ( blue white) , 15GBP from Rapid and an 'unknown' from China ( cheap) , this last one looks interesting, seems to be similar to the character (HD44780) LCDs , the single controller (ST7920) can do 8 bit or 4 bit parallel , or serial ... (SPB pin) and has build in character font .

    GLCD_2.jpg
     
  15. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    9,821
    Likes:
    303
    Location:
    Brisbane Australia
    ONLINE
    Looks like good progress. I notice the odd spacing on the font above. I used a 5 byte wide proportional font and used 0x55 for bytes that should be ignored. If you modify your code it should look a lot better.

    Mike.
     
    • Thanks Thanks x 1
  16. granddad

    granddad Active Member

    Joined:
    Jan 18, 2015
    Messages:
    711
    Likes:
    65
    Location:
    Worcestershire UK
    0x55 = Got you Mike .. Lashup has condensed to 28pin dsPIC33EV , but could do with some spare I/O pins , I was planning to take GLCD RST to Vdd and W/R to Gnd. as I don't think I need to read the display ram or busy status.. ? appreciate your ( anybody's) input .... GLCD_33.jpg
     
  17. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    8,877
    Likes:
    863
    Location:
    Rochdale UK
    ONLINE
    I normally preset both CE and RST.... I do use the w/r....
     
    • Thanks Thanks x 1
  18. atferrari

    atferrari Well-Known Member

    Joined:
    Oct 8, 2003
    Messages:
    2,751
    Likes:
    118
    Location:
    Buenos Aires - Argentina
    For 2x16 and 2x20 LCDs I use a fixed delay, so no check of busy condition. Pin is, IIRC, grounded.
     
    • Thanks Thanks x 1
  19. granddad

    granddad Active Member

    Joined:
    Jan 18, 2015
    Messages:
    711
    Likes:
    65
    Location:
    Worcestershire UK
    Moved up to the larger Winstar 128x64 blue display, and thanks to Pommie Mike's file , have the basics working , with RST at Vdd and R/W to gnd . Invert options and font spacing sorted, the dsPIC33 , works well only used 2% of program space ... also have a few pins to play with .
    GLCDtesting.jpg
     
  20. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    9,821
    Likes:
    303
    Location:
    Brisbane Australia
    ONLINE
    Looking good. The main drawback with those displays is there speed. If you update a value every 0.5 second it becomes unreadable. Shame really as they are otherwise very useful.

    Mike.
     
    • Thanks Thanks x 1

Share This Page