Most of us are familiar with the graphical LDCs used in our cell phones. Many years ago, the first cell phones used very small 2x16 character LCDs, but quickly cell phone manufacturers started to use graphical LCDs. In the 2000, we obtained a graphical LCD (128x 64 pixels) and Mr. Mitrović published a series of articles in which an AT89C2051 was used to drive the graphical LCD. For that time it was an astonishing project, since the programmer had to calculate the co-ordinates of each pixel on the graphical LCD.
The situation is very different today. Graphical LCDs (128x 64 pixels) are available for less than 10 Euro. You can add a touch-sensitive screen to it, and can easily use it with the help of Bascom-AVR. We’ll use an ATmega16 microcontroller to drive the GLCD. This graphical LCD has 8 Data pins, a few control pins and 4 pins to access the touch screen. The schematic diagram for GLCD adapter can be seen in Figure 1.
Touch-sensitive screens work on the principle of a changing resistance when pressing at a certain point on it. You can visualize the screen as 4 resistors connected as shown in Figure 1. With the microcontroller, we transform the X and Y analogue voltages to digital and with that information we know precisely where on the screen we pressed.
Touch-sensitive screens can be bought separately and can be mounted to a GLCD with the help of double-sided tape. Some screens come with this tape already on them. If you have to do this on your own, you should clean the GLCD screen thoroughly before gluing the touch-screen to it.
GLCD program
If you do not use the GLCD adapter for the MiniPin II or MegaPin development boards, then check the schematics shown in Figure 1. There are a lot of similar schematics on the web, but a lot of them are incorrect. This was established after few hours of testing. When the contrast pot was connected as shown in Figure 1, the GLCD finally started to show the correct data. In series with the resistive touch-sensitive screen there are resistors added to protect the screen from shorts. The resistive touch-screen is connected to the A/D inputs of our microcontroller (PortA), the data and control pins of the GLCD are connected to PortB and PortC respectively.
The syntax of the configuration statement for the GLCD is very simple:
Config Graphlcd = 128 * 64sed , Dataport = Portb , Controlport = Portc , _
Ce = 0 , Ce2 = 1 , Cd = 2 , Rd = 3 , Reset = 5 , Enable = 4 , Mode = 8
Graphical LCD with a touch screen
2012_AVR_UK_67
Continue reading
Shop area
|