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 / Replies / i will tell u , this code for

i will tell u , this code for

|

Microcontroller › AVR › help me convert 8 bit LCD to 4 LCD › i will tell u , this code for

May 22, 2013 at 10:00 pm #9813
alagbari88
Participant

i will tell u , this code for lcd 8 bit , i need to convert 8 bit lcd to 4 bit lcd this 

this code function for lcd 8 bit i need to 4 bit for 328p 

 

void lcd_init() // fuction for LCD initialization
{
lcdcmd(0x38);
lcdcmd(0x0C);
lcdcmd(0x01);
lcdcmd(0x06);
lcdcmd(0x80);
}
 
void lcdcmd(unsigned char cmd)
{
lcd=cmd;
PORTD=(0<<rs)|(0<<rw)|(1<<en);
_delay_ms(50);
PORTD=(0<<rs)|(0<<rw)|(0<<en);
 
}
 
 
void lcddata(unsigned char data)
{
lcd=data;
PORTD=(1<<rs)|(0<<rw)|(1<<en);
_delay_ms(50);
PORTD=(1<<rs)|(0<<rw)|(0<<en);
}
 
void lcdcmd1(unsigned char cmd)
{
lcd=cmd;
PORTD=(0<<rs)|(0<<rw)|(1<<en);
_delay_ms(5);
PORTD=(0<<rs)|(0<<rw)|(0<<en);
 
}
 
 
void lcddata1(unsigned char data)
{
lcd=data;
PORTD=(1<<rs)|(0<<rw)|(1<<en);
_delay_ms(5);
PORTD=(1<<rs)|(0<<rw)|(0<<en);
}
void lcdstring (char *string)
{
lcdcmd(0x0C);
while (*string)
lcddata(*string++);
}
 

 

RSS Recent Posts

  • Understanding reversing polarity at astable multivibrator April 19, 2026
  • Integrating 0–5V ECU Signals into a Double-DIN Setup – Module vs Custom Head Unit? April 19, 2026
  • Selection Criteria and Safe Usage of Cable Ties in Electronics Applications April 19, 2026
  • Mystery amp noise - ?? April 19, 2026
  • timing delay code statements using Swordfish April 19, 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