Wednesday, June 30, 2010

Control 2x16 LCD display

2x16 LCD control is very easy. you just make your circuit easily by Proteus program. 2x16 LCD has 16 pins. 8 pins are for data, RS is for command and data selection, RW is for read or write to LCD, E is for enable. and 2 are for background led, VDD is power, VSS and VEE are for ground.

i wrote simple program for this circuit. my program will show "Enter password"string. using internal oscillator by 8Mhz
source code link below
http://www.sendspace.com/file/hawmuo

Tuesday, June 29, 2010

Controlling Siemens S65’s display by Atmega32 Microcontroller


Today I am goning to teach you how to control Siemens s65 LCD color display by Atmega32 microcontroller. All the time, electronic equipment developers needed indicators that show information from Microcontroller and we needed display which can show us a lot of information. But most LCD color displays don’t have datasheets for theme. Therefore we can’t control some color LCD. Spatially, we cant control cell phones color LCD display. But one or more phones display can be controlled, such displays are Siemens s65,CX65,M65 and SK65, as for Nokia 6100. I have chosen Siemens s65.

Features of Siemens S65 display

132x176 pixel

16 bit color mode

TFT technology

Operation voltage 3.3V

Background LED voltage 12V

Siemens 65 phones have three types of display

LS020xxx - by Sharp

LPH88xxxx –by Hitachi

L2F5xxx - by Epson

In this lesson I will teach monochrome mode of S65 and how to display strings on display . Monochrome mode has just two colors such as black and white. First of all, I will explain my circuit below. I have used Atmega32, S65 LCD, 7805, LM 117. Of course my circuit is powered by +12V, because S65 LCD’s backlight needs +12V. input +12V is downgraded as +5V through 7805. This +5V is used in Atmega32 and then +5V is downgraded as 3.3V through LM117DTX. LM117DTX has adjustable pin, we can control its output voltage by voltage on adjustable pin. To control LCD we need to use SPI protocol Atmega32 has four pins for SPI such pins are PB7(SCK), PB5(MOSI), PB6(MISO), PB4(SS). I am just using two pins MOSI and SCK. SCK pin is for clock and MOSI pin for DATA transfer to S65. Atmega32 oscillator has been chosen by 8Mhz

above picture you can see there are five strings. Each strings are colored by different colors. to show string on display, you can use following function.

put_string8(0,110,text0,0xFF,0x00);

the first argument is x dimension. the second is y dimension the third is text that you want to show. text must be wrote follow.

char text0[]= " Hello Mongolian guys ";

the fourth is text's color. i have chosen 8 bit color mode. this mode can only provide 256 colors. such as

0x00 is black

0xFF is white

0x0F is blue

0x1C is green

0xE0 is red so on.

8 bit color mode as below

i will teach you later how to create 16 bit mode.

the last argument is background color. you can give background color as above color table.

to use put_string8(0,110,text0,0xFF,0x00); function, we need to initiate LCD. i used init_glcd() function. after that you must use L8bit_mode(0); function to enable 8 bit color mode.

void L8bit_mode(char BGR)// BGR=0 - disabled, BGR=1 - enabled.

{

wrcmd16(0xE800+(BGR&0x01)*0x40);

}


"(BGR&0x01)*0x40" it is mode definer . if definer is 0x40, mode will be 0x40: BBGGGRRR

i have chosen 0x40. if definer is 0x70. mode will be 0x70: B5B4B3B2-B1B0xx, G5G4G3G2-G1G0xx, R5R4R3R2-R1R0xx. this 24 bit mode is more comfortable to bitmap image (bmp image).


24-bit formats:
0x10: xxB5B4-B3B2B1B0, R3R2R1R0-G5G4G3G2, xxxx-xxR5R4.
0x50: xxR5R4-R3R2R1R0, B3B2B1B0-G5G4G3G2, xxxx-xxB5B4.
0x20: xxB5B4-B3B2B1B0, xxG5G4-G3G2G1G0, xxR5R4-R3R2R1R0.
0x60: xxR5R4-R3R2R1R0, xxG5G4-G3G2G1G0, xxB5B4-B3B2B1B0.
0x30: R5R4R3R2-R1R0xx, G5G4G3G2-G1G0xx, B5B4B3B2-B1B0xx.
0x70: B5B4B3B2-B1B0xx, G5G4G3G2-G1G0xx, R5R4R3R2-R1R0xx.

16-bit formats:
0x08: G2G1G0B5-B4B3B2B1, R5R4R3R2-R1G5G4G3
0x48: G2G1G0R5-R4R3R2R1, B5B4B3B2-B1G5G4G3
0x0C: R5R4R3R2-R1G5G4G3, G2G1G0B5-B4B3B2B1

8-bit formats:
0x00: RRRGGGBB
0x40: BBGGGRRR



Program for S65 can be downloaded from below link

http://www.sendspace.com/file/f30m6v


If you have question, comment below