Microcontroller › AVR › Connections of LM16202 LCD display with Atmega32 microcontroller
- This topic has 4 replies, 3 voices, and was last updated 12 years, 3 months ago by AJISH ALFRED.
-
AuthorPosts
-
May 23, 2012 at 11:03 am #3868Sumanta Kumar ShowParticipant
Hi, I am trying to interface LAMPEX LM16202 16×2 LCD display with ATmega32. But I have doubt about few pin connections which are as follows –
1) pin3 – Vo – Contrast Adjustment
2) pin4 – RS – H/L Register Select Signal
3) pin5 – R/W – H/L Read/Write Signal
4) pin6 – E – H ? L Enable Signal
5) pin15 – A/Vee – + 4.2V for LED/Negative Voltage Output (Can we apply 5 volt supply here?)
6) pin16 – K – Power Supply for B/L (OV)
Can anyone please give me some informations regarding the above connections.
SumantaMay 23, 2012 at 5:31 pm #7882AJISH ALFREDParticipantHi Sumanta,
1) pin3, contrast control
You can connect the variable of a preset not less than 10K to pin3. Other two pins of preset should be connected to VCC and GND.
5) pin15, anode (A) of backlight led.
You can give GND here
6) pin16, cathode (K) of backlight led.
You can give VCC directly to this pin (because in the datasheet an internal resistance is shown), but better through a resistor not less than 1K.
Answers for 2), 3), 4)
I’ve searched a few minutes, but couldn’t find a good datasheet of your lcd. Do one thing, try to find out which is the controller used in the lcd, and search for the datasheet of the controller. You will get a lot of informations.
If your lcd have commonly found KS0070B, then all the answers to the questions 2, 3, and 4 are in the following timing diagram. Try to understand it properly
May 23, 2012 at 5:44 pm #7883AJISH ALFREDParticipantNormally for the lcds we use,
RS—->0
>instruction R/W1
>data R/WR/W—>0
>data/instruction Write1
>data ReadHow to Enable:
Set enable pin low
|
Set the 8 or 4 bit data/instruction on D0 to D7
|
Set the enable pin high
|
Keep the enable pin high for a time delay
|
Set the enable pin low
May 28, 2012 at 11:26 am #7921AnonymousGuestHi to all,
I am trying to do programming for display in LCD display. The program is as below –
// Program to display a single alphabet ‘A’ on LCD/*LCD data transfer through 8 bit modeWriting a single letter A on LCDLCD DATA port—-PORT Actrl port
PORT Brs
PB0rw
PB1en
PB2*/#include<avr/io.h>#include<util/delay.h>#ifndef F_CPU#define F_CPU 16000000UL#endif#define LCD_DATA PORTA // LCD data port#define ctrl PORTB#define en PB2 // enable signal#define rw PB1 // read/write signal#define rs PB0 // register select signalvoid LCD_cmd(unsigned char cmd);void init_LCD(void);void LCD_write(unsigned char data);int main(){DDRA=0xff; // making LCD_DATA port as output portDDRB=0x07; // making signal as out putinit_LCD(); // initialization of LCD_delay_ms(50); // delay of 50 milli seconds//LCD_write(‘B’); // call a function to write A on LCDLCD_string();return 0;}void init_LCD(void){LCD_cmd(0x38); // initialization of 16X2 LCD in 8bit mode_delay_ms(1);LCD_cmd(0x01); // clear LCD_delay_ms(1);LCD_cmd(0x0E); // cursor ON_delay_ms(1);LCD_cmd(0x80); // —8 go to first line and –0 is for 0th position_delay_ms(1);return;}void LCD_cmd(unsigned char cmd){LCD_DATA=cmd;ctrl =(0<<rs)|(0<<rw)|(1<<en); // RS and RW as LOW and EN as HIGH_delay_ms(1);ctrl =(0<<rs)|(0<<rw)|(0<<en); // RS, RW , LOW and EN as LOW_delay_ms(50);return;}void LCD_write(unsigned char data){LCD_DATA= data;ctrl = (1<<rs)|(0<<rw)|(1<<en); // RW as LOW and RS, EN as HIGH_delay_ms(1);ctrl = (1<<rs)|(0<<rw)|(0<<en); // EN and RW as LOW and RS HIGH_delay_ms(50); // delay to get things executedreturn ;}void LCD_string(void){unsigned char str[] = “Hi This is Biswajit Manna”;int i;for(i=0;i<16; i++){LCD_DATA = str;ctrl = (1<<rs)|(0<<rw)|(1<<en); // RW as LOW and RS, EN as HIGH_delay_ms(1);ctrl = (1<<rs)|(0<<rw)|(0<<en); // EN and RW as LOW and RS HIGH_delay_ms(50); // delay to get things executed}if (i==16){LCD_cmd(0xC0); // —C go to 2nd line and –0 is for 0th position_delay_ms(1);for (i=16;i<sizeof str;i++){LCD_DATA = str;ctrl = (1<<rs)|(0<<rw)|(1<<en); // RW as LOW and RS, EN as HIGH_delay_ms(1);ctrl = (1<<rs)|(0<<rw)|(0<<en); // EN and RW as LOW and RS HIGH_delay_ms(50); // delay to get things executed}}return;}Tell me if there is anything wrong in the program. Some display is coming in the LCD but not in accordance with the string specified in the program. Yours help will be highly appreciated.
May 28, 2012 at 6:15 pm #7924AJISH ALFREDParticipantHi Sumanta,
I haven’t gone deeply through your code, but I found these,
Increase the delay for enable, try some 5ms.
Globally declare LCD_string(void); It dosen’t matter, but a standard.
You can hardwire the R/W pin to ground. Since you are writing only, no need to drive it through your code.
Its not clear what kind of problem you are facing. Are you getting junk values only?
-
AuthorPosts
- You must be logged in to reply to this topic.