Simple signal drawing on graphical LCD routines using Atmega8 microcontroller

During spare time I have been playing with graphical LCD. This time I decided to display simple signals that are stored in microcontroller memory. The idea was to read signal values from look-up table and display waveform on Graphical LCD. To make things more interesting I divided LCD screen in to smaller four screens so I could activate them separately and draw signals in them.

Graphical LCD is the same old HQM1286404 with KS0108 controller. I have used Proteus simulator 128×64 graphical LCD(LGM12641BS1R) which is based on KS0108. How to implement and connect LCD there was a blog post (Simulate KS0108 graphical LCD with Proteus simulator

signal frames

)about it. I am just going to show main program routine.

As I mentioned I have split 128×64 in to four smaller screens like this:

so I get four smaller 32×63 screens where I can put different information. To do this you can think of many ways of implementation. I have chosen simple solution. I have created a simple structure which holds current active window position and size:

//structure of window coordinates

struct window{

uint8_t xmin;

uint8_t ymin;

uint8_t xmax;

uint8_t ymax;

} win;

And I wrote a function which changes the active window.

void setWindow(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1)

{

//clear previous window frame

ks0108DrawRect(win.xmin, win.ymin, win.xmax-win.xmin, win.ymax-win.ymin, WHITE);

//set new window position and size

win.xmin=x0;

win.ymin=y0;

win.xmax=x1;

win.ymax=y1;

//draw frame on active window

ks0108DrawRect(win.xmin, win.ymin, win.xmax-win.xmin, win.ymax-win.ymin, BLACK);

}

It just assigns new coordinates of new window. Also it draws a rectangle around active window. When changing window position to new, old rectangle is deleted. So this makes pretty cool effect.

For more detail: Simple signal drawing on graphical LCD routines using Atmega8 microcontroller


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top