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 / 8 bit lcd interfacing

8 bit lcd interfacing

|

Microcontroller › AVR › 8 bit lcd interfacing

  • This topic has 1 reply, 2 voices, and was last updated 13 years, 6 months ago by AJISH ALFRED.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • August 3, 2012 at 7:03 am #3864
    anjum
    Participant

     

    trying for 8 bit interface. using this program but its not worling kindly help.
     
    #define F_CPU 1600000UL
    #include<avr/io.h>
    #include<util/delay.h>
     
    #define LCD_DATA PORTA // LCD data port
    #define ctrl PORTB
    #define en 0 // enable signal
    //#define rw PB1 // read/write signal
    #define rs 1 // 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
    PORTA=0xff;
    DDRB=0x07; // making signal as out put
    PORTB=0xff;
    init_LCD(); // initialization of LCD
    _delay_ms(50); // delay of 50 milli seconds
    LCD_write('A'); // call a function to write A on LCD
    while(1);
    return 0;
    }
     
    void init_LCD(void)
    {
    _delay_ms(20);
    LCD_cmd(0b00110000); // initialization of 16X2 LCD in 8bit mode
    _delay_ms(5);
     
    LCD_cmd(0b00110000); // clear LCD
    _delay_ms(1);
     
    LCD_cmd(0b00110000); // cursor ON
    _delay_ms(1);
     
    LCD_cmd(0b00111000); // —8 go to first line and –0 is for 0th position
    _delay_ms(1);
    LCD_cmd(0b00001000);
    _delay_ms(1);
    LCD_cmd(0b00000110);
    _delay_ms(1);
    LCD_cmd(0b0001100);
     
    }
     
    void LCD_cmd(unsigned char cmd)
    {
    LCD_DATA=cmd;
    ctrl =(0<<rs)|(1<<en); // RS and RW as LOW and EN as HIGH
    _delay_ms(1);
    ctrl =(0<<rs)|(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)|(1<<en); // RW as LOW and RS, EN as HIGH
    _delay_ms(1);
    ctrl = (1<<rs)|(0<<en); // EN and RW as LOW and RS HIGH
    _delay_ms(50); // delay to get things executed
    return ;
    }
     
     
    August 3, 2012 at 5:23 pm #8393
    AJISH ALFRED
    Participant

    Hi,

    Please share your expected output and the details of output that you are getting right now.

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

RSS Recent Posts

  • CR2/CR123A Batteries In Projects February 14, 2026
  • Integrating 0–5V ECU Signals into a Double-DIN Setup – Module vs Custom Head Unit? February 14, 2026
  • Puzzled about a relay February 13, 2026
  • Switch Circut February 13, 2026
  • RC Electronic Speed Control Capacitors February 13, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 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