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

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,015
    Likes:
    317
    Location:
    Brisbane Australia
    Here is a simple demo using a graphic LCD on Bill's Unicorn.

    My C is a little rusty and the C18 compiler with the Harvard architecture makes it a little more challenging. I did however manage a few routines that should get people started.

    This is what it looks like when it's working,

    [​IMG]

    As you can see, I'm not an artist and my version of the Canadian Maple leaf leaves a lot to be desired.:eek:

    This should work with any pic18 and a GLCD with two KS0108 controllers. It is however a lot simpler with the Unicorn.

    The attached zip file contains the c files. Comments and constructive criticism welcome. Thinking about it, the lack of comments in the code will probably be most commented on.:rolleyes:

    Mike.
     
    Last edited: Jul 6, 2008
  2. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    168
    Location:
    Toronto, Canada
    It looks fantastic Mike. Well done and the leaf looks great.

    Did you try the scope software I attached to an earlier thread.
     
  3. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,015
    Likes:
    317
    Location:
    Brisbane Australia
    Yes, I tried the oscilloscope and it looks good.

    One thing I forgot to mention earlier which may cause people problems is that the data sheet you link to (topway) doesn't mention the fact that, when reading from the display data, you need to do a dummy read before you get valid data. If you look at the plot routine you'll see what I mean. Don't you just hate it when data sheets are wrong.:rolleyes:

    Mike.
     
  4. dave

    Dave New Member

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


     
  5. Souper man

    Souper man Guest

    ONLINE

    The leaf looks like it has devil horns :)
     
  6. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    168
    Location:
    Toronto, Canada
    Last edited: Jun 20, 2007
  7. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,015
    Likes:
    317
    Location:
    Brisbane Australia
    I thought about implementing "life" and the biggest problem is buffering the display. You have to buffer it or you get weird things happening. Just using half the display would mean you need 512 bytes for a buffer, not really feasible. You could just buffer 2 rows (8 pixels deep) at a time with 2 64 byte buffers and treat them as a cache.

    If I get time I may have a go at doing this at the weekend.

    Sure, use the photo. If you have a better bitmap that you want converting into a usable form (c string) just let me know. Have you had a play with the code yet? It's not been tested much and so has probably got a few bugetes in it.

    Mike.
     
  8. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,015
    Likes:
    317
    Location:
    Brisbane Australia
    It was a lot easier than I thought. Only took half an hour - I'm starting to like C18.

    Here is Life on the Unicorn. There is just a glider and a small exploder on there at the moment.

    Mike.
     
    Last edited: Jul 6, 2008
  9. Gayan Soyza

    Gayan Soyza Active Member

    Joined:
    Oct 23, 2006
    Messages:
    1,821
    Likes:
    19
    Location:
    Colombo
    Wow it looks very nice to me.Does it take much current/Voltage to the GLCD?
     
  10. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,015
    Likes:
    317
    Location:
    Brisbane Australia
    The max operating current is 15mA - typically 6mA. The backlight takes up to 120mA, in the photo above I have it at about 20mA.

    Data sheet here.

    Mike.
     
  11. mvs sarma

    mvs sarma Well-Known Member

    Joined:
    Oct 29, 2006
    Messages:
    3,512
    Likes:
    76
    Location:
    Hyderabad, India.
    Your Demo is really nice sir and should encourage many other enthusiasts to start experimenting.Once Bill, being a canadian, has acknowledged the Maple leaf what more.
     
  12. Mike - K8LH

    Mike - K8LH Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    3,637
    Likes:
    109
    Location:
    Michigan, USA
    Mike (Pommie),

    I'm expecting a 128x64 Blue/White KS0108 GLCD from Warren's company to show up in the post any day now and I'm very excited to see your example.

    Thank you Sir.

    Happy Holidays. Mike
     
  13. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,015
    Likes:
    317
    Location:
    Brisbane Australia
    Mike,

    It was my first time using the C18 compiler and so the code is not very well written. I have since written a serial LCD driver that allows me to do things like this.
    [​IMG]

    I'm probably going to make the code and circuit available on the web when I get it finished.

    Mike.
     
  14. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,214
    Likes:
    640
    Location:
    Derbyshire, UK
    Same to you Pommie - nice graphics! :D
     
  15. Mike - K8LH

    Mike - K8LH Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    3,637
    Likes:
    109
    Location:
    Michigan, USA
    My display just came in the post. Can't believe I've been sitting here over an hour agonizing over wether to install a female or male connector on it.
     
  16. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,181
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    ONLINE
    hi Mike,
    As its 0.1inch pin pitch I would use a male/pin connector.
    This will match up with your project board and also give it the 'stand off' height above any pcb/project board socket... Have a relaxing xmas break...:)
     
  17. bryan

    bryan Member

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

    Any luck in the serial LCD Driver?


     
  18. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,015
    Likes:
    317
    Location:
    Brisbane Australia
    Yes, it's all done, I just haven't got around to debugging and documenting it. Maybe it's something I should try and get completed in the next couple of weeks.

    I've even done a PCB, two actually, one with ICD and 9 Pin D connector and a more compact one with an SMD EEPROM.

    These are the boards and I need to make a decision and get one of them made.

    [​IMG]

    Anyone have any pros/cons between the two boards?
    Some relevant info,
    The serial can be connected through the D connector or the 4 pin header.
    The serial auto switches polarity so it can connect to a PC or a Pic chip without a Max232 chip.
    The crystal, keyboard components and serial EEPROM are optional and can be omitted.
    Both boards fit comfortably behind the main GLCD display board.

    All comments welcome.

    Mike.
     
    Last edited: Jul 6, 2008
  19. Mike - K8LH

    Mike - K8LH Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    3,637
    Likes:
    109
    Location:
    Michigan, USA
    Both are extremely nice Mike. I don't think I would put that big DB-9 connector on the board but that's just a personal preference.

    Mike
     
    Last edited: Jun 24, 2008
  20. bryan

    bryan Member

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

    Experimenting with you KS0108 GLCD code with limited success. I can properly simulate you example on Proteus and works like a charm. But when hardwired it fails and I can not get anything to display. Using ICSP and programming the PIC I will get some semblence of the display to work, but when the project is powered off/on nothing is displayed. I suspect the KS0108 is not initializing properly. Have experimented with adding various delays etc, but still no luck. The GLCD is fine as I have experimented displaying using other project code with success, just can not get you example to work. Any suggestions??
     

    Attached Files:

    • GLCD.JPG
      GLCD.JPG
      File size:
      16.2 KB
      Views:
      735
  21. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,015
    Likes:
    317
    Location:
    Brisbane Australia
    Hi bryan,

    The only thing that would stop it working is if the defines in LCD.h were wrong or you don't have a crystal. I'm assuming you are using the code from this thread. If you have earlier code then you need to change Init_GLCD in GLCD.c. You should also try switching to the internal oscillator - see page two of above thread.

    Mike.
     

Share This Page