EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / Connections of LM16202 LCD display with Atmega32 microcontroller

Connections of LM16202 LCD display with Atmega32 microcontroller

|

Microcontroller › AVR › Connections of LM16202 LCD display with Atmega32 microcontroller

  • This topic has 4 replies, 3 voices, and was last updated 13 years ago by AJISH ALFRED.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • May 23, 2012 at 11:03 am #3868
    Sumanta Kumar Show
    Participant

    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.


    Sumanta

    May 23, 2012 at 5:31 pm #7882
    AJISH ALFRED
    Participant

    Hi 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

     

    wysiwyg_imageupload:4758:

    May 23, 2012 at 5:44 pm #7883
    AJISH ALFRED
    Participant

     

    Normally for the lcds we use,

     

    RS—->0


    >instruction R/W

                1


    >data R/W

     

    R/W—>0


    >data/instruction Write

                1


    >data Read

     

    How 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 #7921
    Anonymous
    Guest

    Hi 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 mode
    Writing a single letter A on LCD
     
    LCD DATA port—-PORT A
    ctrl port


    PORT B
    rs


    PB0
    rw


    PB1
    en


    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 signal
     
    void 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 port
    DDRB=0x07; // making signal as out put
    init_LCD(); // initialization of LCD
    _delay_ms(50); // delay of 50 milli seconds
    //LCD_write(‘B’); // call a function to write A on LCD
    LCD_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 executed
    return ;
    }
     
    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 #7924
    AJISH ALFRED
    Participant

     

    Hi 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?

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • Failure of polypropylene motor-run capacitors June 16, 2025
  • Siemens large industrial PLC parts June 16, 2025
  • Wideband matching an electrically short bowtie antenna; 50 ohm, 434 MHz June 16, 2025
  • Curved lines in PCB design June 16, 2025
  • using a RTC in SF basic June 15, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise