热度 34
2013-8-23 10:14
2873 次阅读|
4 个评论
First of all, happy new year and happy Valentine's day! Life has been very busy over the past few months... My first post is now released! Acknowledgement: http://www.powermcu.com - for STM32 RTC Library Some time ago, I bought two 1.5" CSTN Color LCD panels from Taobao. To my surprise, the price for each of them was only RMB$7.5! Fig.1 The 1.5" CSTN Color LCD The resolution of the LCD is 128x128. The controller used in it belongs to Samsung's S6B33B6 family. Each pixel supports displaying in 16-bit color (R5G6B5) or in 12-bit (R4G4B4) color. The nominal voltage for the LED backlight is 6.4V. The panel supports 8-bit or 16-bit parallel bus, 3-Pin or 4-Pin SPI. It is suitable for any microcontrollers. I got the datasheet from the vendor. I have printed it out to assist the writing of the LCD driver. Fig.2 Datasheet of the controller Using a in-house made STM32 evaluation board and also a in-house made DC-DC converter to generate 6.4V for LED backlight from 5V, the hardware parts and connections are done. Fig.3 An in-house made STM32 eval. board with RTC backup battery Fig. 45 In-house made DC-DC supply (using LM2577) The LCD panel is fixed on a PCB and some soldering works are done. Fig. 6 The LCD panel fixed on a PCB to form a LCD module (LCM) Fig. 7 Back view of the LCM Fig. 8 The hardware part is done The LCD driver program has been written, it mainly consists of: 1. LCDS_Init(void) - init the LCD panel 2. LCDS_DrawPixel(x,y,color) - set the pixel (x,y) to color 3. LCDS_DrawLine(x0,y0,x1,y1,color) - draw a line (x0,y0) to (x1,y1) to color 4. LCDS_DrawRect(x0,y0,x1,y1,color,style) - draw a rectangle in color with style (solid border/filled) 5. LCDS_DrawChar(x,y,ch,color) - draw a character with fonts.h (written by ST) at position (x,y) 6. LCDS_DispChar(line,char_pos,ch,color) - display a character at line (0-7), char_pos(0-15) 7. LCDS_DispString(line,start_pos,string,foreColor,backColor) - display a series of string Fig. 9 Using Keil uVision 4 as the IDE Fig. 10 Developing the LCD driver library Fig. 11 Debug information is displayed though Hyper Terminal with UART With the RTC library, the time is display on the LCM at an interval of 1s (by RTC interrupt). Fig. 12 RTC Date and Time shown on LCM Fig. 13 Overall view Attached are the full project source code and the datasheet of the LCD controller S6B33B6. Special notes: Libraries not written by MarioTech belong to their original owners. Libraries written by MarioTech is released under GPL license.