Saturday, July 9, 2016

Graphical LCD 128x64 (Part-2)

Hope you guys liked my last post on Graphical Lcd 128x64.
In that post i explained what is graphical Lcd, it's internal block diagram and commands, then a program is there to demonstrate the working of Graphical Lcd. We used mikroC compiler for writing our program, but now in post i will share my Graphical Lcd libraries with you which are written for xc8 compiler in MPLAB-X development environment.
The libraries functions are inspired from mikroC functions and i tried to keep most of the functions similar to the one available in mikroC compiler.
In this version most of the basic functions are written, which are as follow:
 // Basic Function  
 void Glcd_Init( void );  
 void Glcd_Set_Side( u8_t x_pos);  
 void Glcd_Set_X( u8_t x_pos );  
 void Glcd_Set_Page( u8_t page );  
 void Glcd_Write_Data( u8_t data );  
 u8_t Glcd_Read_Data( void );  
 // Advanced Function Prototypes  
 void Glcd_Fill( u8_t pattern );  
 void Glcd_Dot( u8_t x_pos, u8_t y_pos, u8_t color );  
 void Glcd_V_Line ( u8_t y_start, u8_t y_end, u8_t x_pos, u8_t color);  
 void Glcd_H_Line( u8_t x_start, u8_t x_end, u8_t y_pos, u8_t color);  
 void Glcd_Image( const u8_t *image);  
 void Glcd_Circle( s8_t x_center, s8_t y_center, u8_t radius, u8_t color);  
 void Glcd_Line( s16_t x_start, s16_t y_start,  
         s16_t x_end, s16_t y_end, u8_t color);  
 void Glcd_Rectangle( u8_t x_upper_left, u8_t y_upper_left,   
     u8_t x_bottom_right, u8_t y_bottom_right,   
     u8_t color);  
 void Glcd_Write_Char(u8_t chr, u8_t x_pos, u8_t page_num, u8_t color);  
 void Glcd_Write_Text(char *text, u8_t x_pos, u8_t page_num, u8_t color);  

Schematic Diagram
Schematic Diagram
In this tutorial i will also show how to generate fonts using GLCD Font Creator and how to generate codes for Bitmap Images using Glcd Bitmap Editor. These both things are shown in video embed below.

Note:
Glcd Bitmap Editor comes with mikroE compilers, so you have to download any mikroE compiler to use this software for free.
Demo Images
Welcome Screen

Bitmap Image Display

Rectangle Display

Horizontal Lines Display

Vertical Lines Display

Line Display

Circle Display

Concentric Circles Display

Fonts Display

Watch the following video, to get a proper understanding of the libraries, font generation, and generating codes for images.



Get the Project from GitHub.

13 comments:

  1. I'm trying to run the code on a PIC4520 installed in an EasyPIC4 board. I've replaced the configuration, reset the control pins to RB0-5, and even tried disabling interrupts but still get a blank screen.

    ReplyDelete
    Replies
    1. I received a notification from youtube, regarding some delay issue.
      But when i tried to reply you there, i didn't see any comment.
      My question:
      Are these problems( this one and in YouTube comments) are solved now??

      if not.. then please mail me your code at matlab.academy@gmail.com
      I will check it.

      Regarding the delay issue, i tested the library on real hardware also and it was working properly.

      Delete
    2. Hi, I only just found out you replied. I thought I had commented on the youtube video but I can't see it either. It is possible I deleted the comment once I determined that the problems I was writing about were caused by my alterations not your library.

      Anyway: It turns out that the display variant I'm using has mutually exclusive chip selects, e.g. it won't allow for enabling both sides at once to allow for extra fast clearing. The part is MIDAS MC128064B6W-BNMLW, also marked 12864ED1621Y

      I believe the one Mikroe use has that same property too as their driver works fine with my display.

      Where I altered things I wanted to find out how fast I could write, and whether or not I should poll the display's BUSY flag as described in the datasheet. What I found was that timed write (non polled) appeared to be supported but it isn't stated as clearly as with a character LCD datasheet. With a PIC clocked at 8MHz it was very hard to "outrun" the display when writing data to it as the code between writes takes longer than the display. There were only a few places in the read byte code and at initialization where timing was important.

      I single stepped into the Mikroe driver and as far as I can tell it is timed, I couldn't find a busy poll.

      Delete
  2. how can i open this code?? i cant open this with codevision or notepad++

    ReplyDelete
    Replies
    1. Extract zip folder and then go inside directory you will be able to see the files.
      It's very simple task.

      Delete
  3. how could i open this code ?? i cant open code with codevision or notepad :(

    ReplyDelete
  4. it was a wonderful chance to visit this kind of site and I am happy to know. thank you so much for giving us a chance to have this opportunity.. best-19-inch-tvs

    ReplyDelete
  5. What license is this released under. Sourceforge actually requires one.

    You might consider CC0 if anyone is allowed to do what they like with it.

    ReplyDelete
    Replies
    1. Thanks for your valuable suggestion, I will try to use these licenses in my upcoming projects.

      Delete
  6. Can I get the link of the code for the same??

    ReplyDelete
    Replies
    1. Please check the post again, Download Link is already available at the bottom of the page.
      Thanks

      Delete
  7. Can we convert this code for PIC16F877A. Since in this uC there is no LAT register. Please help....

    ReplyDelete
  8. Can we convert this code for PIC16F877A. Since in this uC there is no LAT register. Please help....

    ReplyDelete