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 / problem in code ………of led interfacing

problem in code ………of led interfacing

|

Microcontroller › 8051 › problem in code ………of led interfacing

  • This topic has 1 reply, 2 voices, and was last updated 8 years, 3 months ago by Hari Prasaath K.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • March 19, 2012 at 10:35 pm #1562
    tarun
    Participant

     

    #include<reg51.h>
    void lcd_command(unsigned char comm);
    void lcd_data(unsigned char disp);
    lcd_dataa(unsigned char *disp);
    sbit sensor1=P1^0;
    sbit sensor2=P1^1;
    sbit sensor3=P1^2;
    sbit sensor4=P1^3;
    sbit sensor5=P1^4;
    sfr lcd_data_pin=0xA0;  // data port P2
    sbit rs=P3^0; // Register select pin
    sbit rw=P3^1; // Read write pin
    sbit en=P3^6; // Enable pin
    void delay(unsigned int msec)    //delay function
    {
    int i,j;
    for(i=0;i<msec;i++)
    for(j=0;j<1275;j++);
    }
    void lcd_command(unsigned char comm) // function to send command to LCD
    {
    lcd_data_pin=comm;
    en=1;
    rs=0;
    rw=0;
    delay(1);
    en=0;
    }
    void lcd_data(unsigned char disp)    // function to send data on LCD
    {
    lcd_data_pin=disp;
    en=1;
    rs=1;
    rw=0;
    delay(1);
    en=0;
    }
     
    lcd_dataa(unsigned char *disp)    // function to send string to LCD
    {
    int x;
    for(x=0;disp[x]!=0;x++)
    {
    lcd_data(disp[x]);
    }
    }
    void lcd_ini()     //Function to inisialize the LCD
    {
    lcd_command(0x38);   
    delay(5);
    lcd_command(0x0F);       
    delay(5);
    lcd_command(0x80);
    delay(5);
    }
    void main()
    {
    P3=0x00;
    while(1)
    {
    if(sensor5==0x01)
    {
    void lcd_command(unsigned char comm);
    void lcd_data(unsigned char disp);
    lcd_dataa(unsigned char *disp); 
    lcd_ini();
    lcd_dataa(“ECE Rocks”);
    }
    else if(sensor1==0x01)
    {
    void lcd_command(unsigned char comm);
    void lcd_data(unsigned char disp);
    lcd_dataa(unsigned char *disp); 
    lcd_ini();
    lcd_dataa(“move b”);
    }
    else if(sensor2==0x01)
    {
    void lcd_command(unsigned char comm);
    void lcd_data(unsigned char disp);
    lcd_dataa(unsigned char *disp); 
    lcd_ini();
     
    lcd_dataa(“move f”);
    }
    else if(sensor3==0x01)
    {
    void lcd_command(unsigned char comm);
    void lcd_data(unsigned char disp);
    lcd_dataa(unsigned char *disp); 
    lcd_ini();
     
    lcd_dataa(” move l”);
    }
    else if(sensor4==0x01)
    {
    void lcd_command(unsigned char comm);
    void lcd_data(unsigned char disp);
    lcd_dataa(unsigned char *disp);
    lcd_ini();
    lcd_dataa(“move r”);
    }
    }
    }
     
    February 21, 2017 at 4:48 pm #14474
    Hari Prasaath K
    Participant

    Explain the doubt in detail, where do exactly face the probelm..showing any error in code.? else try with the simulation if it works check with the LED connections.

  • 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

  • Parts required for a personal project June 15, 2025
  • Curved lines in PCB design June 15, 2025
  • Wideband matching an electrically short bowtie antenna; 50 ohm, 434 MHz June 15, 2025
  • using a RTC in SF basic June 15, 2025
  • PIC KIT 3 not able to program dsPIC 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