grlcd_p2_102507-1

9

Click here to load reader

Upload: bharatvishnu

Post on 10-Apr-2015

45 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: GrLCD_p2_102507-1

1

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

Graphics LCD System and PIC24 Interface

-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.

Page 2: GrLCD_p2_102507-1

2

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

Resolution and Image Buffer Size

MonochromeX resolution Y resolutionPixels Bits Bytes Interface

1/16 VGA 160 120 19,200 19,200 2,400 4 Data1/8 VGA 240 160 38,400 38,400 4,800 4 DataQVGA 320 240 76,800 76,800 9,600 4 Data

Color STNX resolution Y resolutionPixels Colors Bits Bytes Interface

1/16 VGA 160 120 19,200 8 57,600 7,200 8 Data1/8 VGA 240 160 38,400 8 115,200 14,400 8 DataQVGA 320 240 76,800 8 230,400 28,800 8 Data

Color TFTX resolution Y resolutionPixels Colors Bits Bytes Interface

1/16 VGA 160 120 19,200 4,096 230,400 28,800 12 Data1/8 VGA 240 160 38,400 4,096 460,800 57,600 12 DataQVGA 320 240 76,800 4,096 921,600 115,200 12 Data1/16 VGA 160 120 19,200 262,144 345,600 43,200 18 Data1/8 VGA 240 160 38,400 262,144 691,200 86,400 18 DataQVGA 320 240 76,800 262,144 1,382,400 172,800 18 Data

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 we’ll 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 doesn’t 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.

Page 3: GrLCD_p2_102507-1

3

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

Graphic LCD System

Image Buffer(RAM)

ApplicationControl(MCU)

Continuous data stream

Anal

og V

olta

ge(G

ate

Driv

er)

Digital VoltageGenerator

LCD GlassMonochrome

STN, TFT

GraphicalAccelerator(2D Engine)

Optional

1 Raw Image 1

2 Digital Waveforms (RGB)

3

3 Displays Image Frame

2

I think this is the most important slide in presentation and we’ll 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. It’s 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. Let’s 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 milli-seconds 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 it’s not available on many LCD controllers.

Page 4: GrLCD_p2_102507-1

4

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

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

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. I’ll say less than 50% of LCD controllers offer some kind of graphics acceleration features. And very few offer all of them.

Page 5: GrLCD_p2_102507-1

5

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

Graphics LCD with Built-in ControllerBlock Diagram

DigitalControlLogic

Gat

e D

river

ImageBuffer(RAM)

LCD Glass(Monochrome,

STN, TFT)

GraphicAccelerator(Optional)

LCD Controller

LCD Module

RD/ WRCS

RST

PIC24F

Back light

Libraries:Line, Circle,

Rectangle, 3D Objects etc

ENA0

DB0 – DB7

PMP

So far we covered various aspects of graphics LCD operation. Now let’s 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 LED’s 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, you’ll 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.

Page 6: GrLCD_p2_102507-1

6

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

CPU Interface LCD Digital Waveform

Motorola 68K Interface Intel 80 Interface

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.

Page 7: GrLCD_p2_102507-1

7

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

LCD Glass(Monochrome,

STN, TFT)

RGB Display Interface with Graphics Controller Block Diagram

Gat

e D

river

LCD Module

RD/ WRCS

RST

PIC24F

Back lightLibraries:Line, Circle,

Rectangle, 3D Objects etc

ENA0

DB0 – DB7

PMP

DigitalControlLogic

ImageBuffer(RAM)

GraphicAccelerator(Optional)

Graphics Controller

RGB Interface

If you are planning to use LCD display which has RGB interface then they can’t 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 16-bit 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 we’ll 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.

Page 8: GrLCD_p2_102507-1

8

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

RGB LCD Digital Waveforms

Monochrome 4-bit interface Color 8-bit interface

12-bit TFT interfaceAll data streams are continuousClock rate is:

X x Y x Refresh x Pixels per clock

For 320 x 240 TFT at 60 Hz:4.61 MHz clock

I’ll 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 you’ll need external graphics controller explained in previous slide for interface. In most cases you’ll find equivalent pin name on graphics controller; making it easy to make connections.

Page 9: GrLCD_p2_102507-1

9

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

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

•This ends our webinar. Let’s 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.

•I’ll like to thank you for viewing this webinar.