Tag Archives: library

Time Input Dialog for Graphic LCD

GUI Frameworks of all modern OS like Windows, Linux (Qt & GTK+), MAC etc have a concept of standard dialogs. For example all applications running under Windows shows the same file open dialog for selecting a file. Similarly their are standard dialogs for folder selection, colour selection, font selection etc. This concept has several advantages, and the most important is a easy user interface. Since the user is already familiar with file selection in one application, he/she can use file open dialog of any application. Building on the same concept our GUI framework for ProGFX (avr glcd driver) will too have many standard dialogs for common user interface. In this tutorial we will build the "Time Input Dialog" that helps programmer ask the user to input time. The time could be anything like :- "On" or "Off" time for a relay in a timer application. Alarm time in an alarm clock application. Period start time in a school bell application. And many others. The programmer just need to call the function. void ShowGetTimeDlg(uint8_t *h,uint8_t *m,uint8_t *s,uint8_t *am_pm) It takes four parameters hour, minutes, second and am_pm. All parameters are passed by reference(pointer actually), this is because the function modifies the value of those variables. It shows a dialog as shown below :- Time Input Dialog The user can use the […]

Software I2C Library for AVR MCUs

Inter IC Communication or I2C is a two wire serial communication bus used to connect a variety of external peripheral with a microcontroller. Most common are EEPROMs, RTC, Port Expanders etc. Most leading MCUs comes with at least one dedicated I2C host adaptor built in. But some times we need more than one I2C interface or we need I2C lines on some other i/o pins than those allotted to the hardware I2C, in that case we need to go with a solution called SoftI2C. In SoftI2C the I2C signals are handled in software, the advantage is that any two i/o line of the MCU can be used for communication. The drawback is that it need more CPU cycles are wasted in generating the signal thus less time slice is available to the application. In this article we will present our open source, flexible and easy to use SoftI2C library. This library can be used to connect any I2C slave device with an AVR (and latter PIC MCU) MCU. Some limitations of the library are :- No Multimaster support. No clock stretching support. But you can connect multiple number of I2C Slaves on the same bus. I2C Master/Slave Connection The Soft I2C Library for AVR The soft I2C library for AVR comes in two files. i2csoft.c i2csoft.h The configuration section lets […]

Handling Text and Fonts in Graphic LCD

ProGFX supports advance function to draw text on graphical LCD screen. ProGFX support multiple fonts, fonts with variable width characters, absolute pixel based positioning, and utility function to get the dimension of text in any specified font. The last feature is used to cleanly position text relative to other graphic and text objects on screen. So lets get started. First you will need a tool that will help convert any Windows Font to ProGFX compatible format. Thanks to Mr. F. Maximilian Thiele we have a great tool called Font Creator. You can download it from here. Download GLCD Font Creator It is a Java application so you need the Java Runtime to use it. Launch the app using start.bat file. You will get a screen similar to this. Font Creator Main Screen From file menu select "New Font" , and configure the New Font Dialog as follows. New Font Dialog Name = Arial12 Import Font = Arial Size =12 And click ok. From Export Menu Select "Export Font", Give it the name "Arial12.h" while saving. Create a Atmel Studio Project with GFX Support. The steps are given in the following tutorials. Hello World Project with Atmel Studio 6. Setting up ProGFX Project using AVR Studio. Name the AVR Studio Project as "FontDemo". Open the project folder in Windows Explorer (or […]

Interfacing Graphical LCD with AVR MCU – Part II

This tutorial deals with downloading and installing ProGFX graphic engine. ProGFX is a free and easy to use embedded graphic library that can control several display modules and can run on AVR, PIC and ARM MCUs. In this tutorial we will make a ProGFX graphical application with Atmel AVR ATmega32 MCU using AVR Studio and WinAVR (C Compiler). So lets begin. Downloading ProGFX engine. Please download the ProGFX engine from the following link. Download ProGFX v1.0 Installing ProGFX Engine. You need WinZIP to extract the files to your hard disk. Please extract it to root of any drive like "C:". Following Folders will be created. C:\progfx\include C:\progfx\lib Folders Created after extracting the ProGFX package Note that core of the engine is contained in two folders named "include" and "lib" but there may be some others folders too, like "Help" depending on your version of ProGFX engine. Creating a Graphical Project using AVR Studio. The basic tools required for developing with AVRs are Atmel Studio (Integrated development environment with integrated C compiler) eXtreme Burner AVR (to transfer program files to chip) These tools must be installed and set up correctly as described in the following tutorial. Creating "Hello World" project with Atmel AVR. Start AVR Studio and you will be presented with the following screen. Atmel Studio 6 Startup Screen The […]

Interfacing KS0108 based 128×64 Graphical LCD with AVR MCU.

Those how are building microcontroller based project for little long must have got bored with the good old character LCDs. Whether you are bored or your application require to present more data to the user in a better way, you need Graphic LCD. Character LCD Interfacing is quite easy so every one uses it, but when I comes to Graphic LCD you need a well written and powerful graphic library. Its not enough that you read the LCD datasheet and connect it your MCU and start sending data. Because the LCD just appears to be block of memory whose contents are directly visible on screen. The datasheet can only guide you how to access this memory. You just can’t do much by writing to the memory. The graphic library is a piece of software that has complex algorithms to render graphic primitives like line, rectangles, circles, images and more. It also helps load fonts and render text and numbers on screen. So it provide high level access to the LCD screen and applications can be written much more easily. While I was researching for graphic library for the GLCDs, I found some but I was not fully satisfied by any of them. So I began to write a clean, powerful, portable and easy to use library that can handle sever […]

Using IR remote with AVR MCUs

Hi Friends, Welcome to my AVR tutorial Series. In this article I will describe my Infrared Remote Control Library. Hope you will enjoy it. I was very much amazed my remote controls since long. The simple circuits described in magazine were just operated like a switch and can only switch on and off an application. That means only single channel. That was of not much use. What I wanted was access to each key on remote control. I wished I could decode the signals generated by common remotes controls found in our homes. This way I could make multi channel remote controls for any project. So I went on and after some web research, coding and debugging I finally succeeded ! Actually I completed that more than one and half year ago (in may 2007). And now I thought I should also make it available to others who are in need of it so that they can use it in their projects. So I went on to make it more "clean" and also to make it more "easily portable" so that it can be used with different devices operating at different frequency. And now the result is here, a very easy to use library that can add remote control feature in any of your AVR project ! Using a IR […]