You are on page 1of 9

Graphics LCD System and PIC24 Interface

2007 Microchip Technology Incorporated. All Rights Reserved. Graphics LCD system and PIC24 Interface Slide 1

-Hello, my name is Gaurang Kavaiya and I am the PIC24F Applications Group Manager at Microchip. -Please refer to How does graphics LCD works? webinar for details on various glass technologies and its operation. This session explains graphics LCD system and how to use it with PIC24 devices. -It consists of 9 pages and it is estimated that it will take about 20 minutes.

Resolution and Image Buffer Size


Monochrome X resolution Y resolutionPixels Bits Bytes 1/16 VGA 160 120 19,200 19,200 2,400 1/8 VGA 240 160 38,400 38,400 4,800 QVGA 320 240 76,800 76,800 9,600 Color STN 1/16 VGA 1/8 VGA QVGA Color TFT 1/16 VGA 1/8 VGA QVGA 1/16 VGA 1/8 VGA QVGA X resolution Y resolutionPixels Colors Bits Bytes 160 120 19,200 4,096 230,400 28,800 240 160 38,400 4,096 460,800 57,600 320 240 76,800 4,096 921,600 115,200 160 120 19,200 262,144 345,600 43,200 240 160 38,400 262,144 691,200 86,400 320 240 76,800 262,144 1,382,400 172,800
Graphics LCD system and PIC24 Interface

Interface 4 Data 4 Data 4 Data

X resolution Y resolutionPixels Colors Bits Bytes 160 120 19,200 8 57,600 7,200 240 160 38,400 8 115,200 14,400 320 240 76,800 8 230,400 28,800

Interface 8 Data 8 Data 8 Data

Interface 12 Data 12 Data 12 Data 18 Data 18 Data 18 Data

2007 Microchip Technology Incorporated. All Rights Reserved.

Slide 2

The LCD color depth and resolution defines the requirement for image buffer to store data being displayed. This slide shows some typical configurations and memory requirement. The formula to calculate image RAM requirement is x resolution in pixels * y resolution in pixels * bytes per pixel. In case of monochrome, pixel has only two settings. On and off. This requires only 1 bit per pixel. If we look at the 1/16th VGA resolution monochrome display, then well need 160 x 120 x 1/8 bytes of image RAM. This translates into 2400 bytes of data RAM for one page of image buffer. In case of QVGA 18-bit color, each pixel needs 18-bit data. We need 320 x 240 x 18 /8 bytes of RAM. Which assumes digital logic can handle 18-bit. If one uses standard peripherals then they either have 16-bit interface or you use 8-bit interface to get 24-bit data. The 24-bit data storage will waste some RAM. It is quite common to use 16-bit data and do not use 2 LSBs in color depth. This doesnt have any significant impact on picture quality. In case of 16-bit data common trend is to use 5 bits to represent Red, 5 for Blue and 6 for green. You can see that the color QVGA resolution display requires use of significant amount of data RAM and lots of data movement. Because of this traditionally color graphics is considered to be high end 32-bit MCU domain application. However, Microchip library makes it possible to do high quality graphics on low end 16-bit microcontroller.

Graphic LCD System


Application Control (MCU) 1 Image Buffer (RAM) Continuous data stream 1 2 3 Raw Image Digital Waveforms (RGB) Displays Image Frame

Graphical Accelerator (2D Engine) Optional

Analog Voltage (Gate Driver)

2 Digital Voltage Generator

LCD Glass Monochrome STN, TFT

2007 Microchip Technology Incorporated. All Rights Reserved.

Graphics LCD system and PIC24 Interface

Slide 3

I think this is the most important slide in presentation and well spend good amount of time on this slide so please pay attention to this. We need image buffer to store raw image that is being displayed. As explained in previous slide, the size of the image RAM will depend on resolution and color depth. The LCD display needs to be refreshed continuously. The graphics LCD system works similar to picture tube in CRT. The display is updated horizontally line by line. The digital voltage generator in this block is digital equivalent of picture tube. It reads image buffer pixel by pixel and generates scan waveforms. This scan waveform has individual line for each data bit. For 16-bit it will have 5 R, 5 B and 6 G lines. In addition to that it will have some additional control signals like clock , horizontal sync and vertical sync pulses. This digital waveform is fed into gate driver. The gate driver is highly glass technology specific and many times it is a high voltage technology. The blocks shown in red arrow is a continuous data stream. For 16-bit QVGA display the clock output frequency tends to be in the neighborhood of 4MHz to keep 60 fps update rate. Therefore, you need dedicated HW module to do this. It will require significant CPU power to do it as bit banged operation. All these blocks combined together just gives basic raster. Its like turning TV on without any TV signal. Ideally you want to display menus, buttons, icons on your screen. To do this you will need intelligent device like MCU. The MCU needs to run graphics library to do high quality graphics. This library will take simple input like size of the button, color and few other parameters and figure out which pixel should be displayed in which color to create required image. This process is called software rendering. The graphics solution can be CPU resource intensive system. Lets consider worse case example of 16-bit color QVGA display and application is trying to fill whole screen with one color. This requires that each and every byte in 156KBytes of image RAM gets updated with that color data. It may take CPU 10s of milliseconds to finish it. In this kind of system HW support can help. One can instruct HW to fill locations in certain block with fixed color. The HW can be instructed in micro seconds. After that HW may take 10s of milli-seconds to update all data. However, CPU is free to do other tasks while HW is updating all locations. This kind of HW support is called graphical accelerator. Usually for embedded requirement it provides acceleration to 2D drawing functions like line, rectangle, block fill etc. On a PC designed for video games may have HW accelerators for 3D drawing. The graphics accelerator is an optional block and its not available on many LCD controllers.

2D Engine Functions Possible 2D Acceleration functions:

Pixel draw Line draw, box draw, circle draw, etc. Text draw using font tables Cursor support (i.e., blinking) Block data operations:
Replace rectangle of data Moves with transparency for animation Picture-in-picture Image decompression
Graphics LCD system and PIC24 Interface Slide 4

2007 Microchip Technology Incorporated. All Rights Reserved.

This is a list of possible 2D acceleration functions. The items in blue are the most common features on LCD controllers that offers graphics acceleration. Ill say less than 50% of LCD controllers offer some kind of graphics acceleration features. And very few offer all of them.

Graphics LCD with Built-in Controller

Block Diagram
PIC24F
Digital Control Logic Gate Driver
CS RD/ WR EN A0

LCD Glass (Monochrome, STN, TFT)

PMP

DB0 DB7

RST

Libraries: Line, Circle, Rectangle, 3D Objects etc

Image Buffer (RAM)

Graphic Accelerator (Optional)

LCD Module

LCD Controller
Back light

2007 Microchip Technology Incorporated. All Rights Reserved.

Graphics LCD system and PIC24 Interface

Slide 5

So far we covered various aspects of graphics LCD operation. Now lets analyze few ways of connecting it to PIC24 devices. The first variant is display with built-in LCD controller. These type of LCD modules have some kind of parallel interface for host MCU connection. They may have Intel 80 or Motorola 68K in 8 or 16-bit flavor. Majority of the 3 and smaller size displays are of this type. This type of displays tends to provide most compact form factor and are widely used in handheld applications. These displays use a single chip solution as LCD controller to interface with glass. The LCD controller has high voltage gate driver, remaining digital logic and usually 1 page of image buffer built into it. Many LCD module manufacturer use bump die package to get low cost and smaller size. If you are planning to use any particular LCD module with this kind of interface then please look into LCD module datasheet for LCD controller part number. Lots of vendors like Samsung, Solomon Systech, HiMax, Renesas, Ilitek, LG etc; manufacture LCD controller chip. The graphics library is tied with this LCD controller. If you find LCD module from two different vendor using same LCD controller chip then you should able to use both displays without any change in firmware. While migrating from one LCD module to another, if LCD controller changes then you need to change the LCD driver in graphics library to use it. All color displays require some kind of back light for operation. Smaller displays use LED backlight which simplifies the back light power supply. Most of the time they use more than one LED. If they use multiple LED in series then you may need higher voltage for back light. If multiple LEDs are connected in parallel then you will need lower voltage for back light. Almost all LCD controller operates at 3 or 3.3V. If you have only one supply available then parallel LED configuration is preferred as backlight may able to run on same 3V supply. For series LED configuration, youll need higher voltage. The bigger displays may use different kind of backlight like CCFL. This may require inverter to generate high voltage. The PIC24 devices have Parallel Master Port (acronym PMP) module which is a highly configurable parallel interface module. It can be configured for Intel 80 or Motorola 68K interface in 8 or 16-bit flavor. Microchip also provides free graphics library with all Microsoft Windows kind objects to simplify design. If you are planning to use touch screen then it is very easy to interface resistive touch screen with PIC.

CPU Interface LCD Digital Waveform

Motorola 68K Interface

Intel 80 Interface

2007 Microchip Technology Incorporated. All Rights Reserved.

Graphics LCD system and PIC24 Interface

Slide 6

This slide shows timing diagram for Motorola 68K interface and Intel 80 interface. The Intel 80 interface has separate read and write signals while Motorola 68K has one pin for read and write function and another control signal called enable. They both have support for 8 or 16-bit data bus and chip select signal.

RGB Display Interface with Graphics Controller Block Diagram


CS RD/ WR EN A0

PMP

PIC24F

Gate Driver

Digital Control Logic

LCD Glass (Monochrome, STN, TFT)

DB0 DB7

RST

LCD Module
Image Buffer (RAM)
Graphic Accelerator (Optional) Back light

Libraries: Line, Circle, Rectangle, 3D Objects etc

Graphics Controller
Graphics LCD system and PIC24 Interface

RGB Interface

2007 Microchip Technology Incorporated. All Rights Reserved.

Slide 7

If you are planning to use LCD display which has RGB interface then they cant be interfaced with PIC directly. Usually many displays of 3.5 and bigger has this kind of interface. In this case the high voltage gate driver is built into the display and display has data bus for R, G and B signals. The 16bit color display may have 5 lines for R, 5 lines for B and 6 data lines for G. They also have few additional signals like clock, horizontal sync and vertical sync. This interface is fully digital interface and usually accepts TTL level. In this situation well need graphics controller chip between PIC24 and LCD module. The Graphics controller chip has digital voltage creation logic, image buffer and some times graphic accelerator. It will have CPU interface for host connection and RGB output to drive LCD module. Usually graphics controller chip is highly configurable. It can drive variety of LCD displays like STN, TFT, monochrome. They have configurable interface to support variety of timing needs. The SSD1906 from Solomon Systech is example of one such implementation. You can find graphics controller chip from few other vendors like Epson. It is also possible to create graphics controller using FPGA or CPLD. If FPGA or CPLD is used then most likely it will use dedicated RAM chip for image buffer. Some FPGA vendors provides IP of graphics controller to their customers free or at very low cost.

RGB LCD Digital Waveforms

Monochrome 4-bit interface

Color 8-bit interface

12-bit TFT interface

All data streams are continuous Clock rate is: X x Y x Refresh x Pixels per clock For 320 x 240 TFT at 60 Hz: 4.61 MHz clock

2007 Microchip Technology Incorporated. All Rights Reserved.

Graphics LCD system and PIC24 Interface

Slide 8

Ill not try to explain RGB waveforms in detail here. The only reason to have this slide is to help you identify RGB interface. If you see above type timing diagram in your LCD datasheet then it is RGB interface. In this case youll need external graphics controller explained in previous slide for interface. In most cases youll find equivalent pin name on graphics controller; making it easy to make connections.

Summary We learnt
Components of graphics LCD system and its operation Graphics LCD interface to PIC24 Timing signals

Visit www.microchip.com/graphics for latest information


2007 Microchip Technology Incorporated. All Rights Reserved. Graphics LCD system and PIC24 Interface Slide 9

This ends our webinar. Lets summarize this presentation, We spent good amount of time to understand all blocks of graphics LCD system and its operation. In the end we looked at two options of interfacing graphics LCD with PIC24 devices. In one case graphics display has LCD controller built-into the module and has CPU interface. In another case, we looked into graphics display with RGB interface and use of graphics controller. We also looked at the example timing diagram. Hopefully that will help you in identifying required interface. Please visit www.microchip.com/graphics or Graphics Design Center on Microchip website to get free Microchip graphics library, webinars, Frequently Asked Questions, video of the demo and more. Ill like to thank you for viewing this webinar.

You might also like