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 / NEED HELP with Data Acquisition System With LCD 16*2

NEED HELP with Data Acquisition System With LCD 16*2

|

Microcontroller › 8051 › NEED HELP with Data Acquisition System With LCD 16*2

  • This topic has 2 replies, 2 voices, and was last updated 13 years, 3 months ago by Ahmed.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • April 6, 2012 at 9:27 pm #4768
    Ahmed
    Participant

    Hi every one

     

    I have a problem with DAQ system and LCD. The problem is i receved the data from ADC0808 and put it in array but can’t display it on LCD!!!

    I notes that port0 (P0) don’t get out the data so i used spisific data like string or number but the same problem accured???

    i think there is something wrong with the program!

     

    i used AT89C52 becuase of 8K EEPROM

    I upload both Software and simulation (Proteus  Version 7.6 SP0)

     

    Any Help Or Suggestion

    Thanks

     

    This is the Program and simulation

    http://www.4shared.com/rar/1g-IcdOC/ADCLCD.html

     
    And This is the program here:-
     
    #include <REGX52.H>
    sbit start=P3^3;
    sbit end=P3^4;
    sbit oe=P3^5;
    sbit ale=P3^6;
    sbit clock=P3^2;
     
    unsigned char sensor=0,reading[7];
    //


    LCD writing


    sfr lcd_data_pin=0x80;  // data port P0
    sbit rs=P1^3; // Register select pin
    sbit rw=P1^4; // Read write pin
    sbit en=P1^5; // Enable pin
     
    long int b=0; //for math operation
    int j,num[4];   //num to carry 5 digit
     
    void delay(unsigned int msec)
    {
    int k,l;
    for(k=0;k<msec;k++)
    for(l=0;l<1275;l++);
    } 
    void initSerial()
    {
    TMOD=0x22;
    TH1=0xFD;
    //SCON=0x50;
    TR1=1;
    EA=1;
    } 
    void usDelay(int a)
    {
    TH0=256-(a/1.085);
    TR0=1;
    ET0=1;
    }
    void timerRoutine() interrupt 1
    {
    clock=~clock;
    }
     
    void latch()
    {
    ale=0;
    delay(2);
    ale=1;
     
    }
    void startConv()
    {
    delay(2);
    start=0;
    delay(2);
    start=1;
    }
    void wait()
    {
    while(end==1);
    }
    void get()
    {
    delay(2);
    oe=0; 
    delay(2);
    oe=1;
    }
     
    //


    LCD Display Function


     
    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_ini()     //Function to inisialize the LCD
    {
    lcd_command(0x38);   
    delay(5);
    lcd_command(0x0F);       
    delay(5);
    lcd_command(0x80);
    delay(5);
    }
     
    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 *predisp)    // function to send string to LCD
    {
    int x;
    for(x=0;predisp[x]!=0;x++)
    {
    lcd_data(predisp[x]);
    }
    }
     
    void lcd_data_int(unsigned int vote)  //Function to send 0-9 character values (Divide number into 5 digits)
    { 
    char dig_ctrl_var;
    int p;
    for (j=4;j>=0;j–)
    {
      num[j]=vote%10;
      vote=vote/10;
    }
    j=1;  
    for (p=0;p<=4;p++)
    {
      dig_ctrl_var = num[p]+48;
      lcd_data_pin = dig_ctrl_var;
      rw = 0;
      rs = 1;
      en = 1;
      delay(1);
      en = 0;
      if(j==1)
      {
      lcd_data(0x2E);
      j=2;
      }
    }
    return;
    }
     
    void main()
    {
    int i;
    initSerial();
    usDelay(50);
    while(1)
     {
     
    P=0;
    for(i=0;i<8;i++)
    {
     
    if(sensor==8)
    {sensor=0;}
    P1=(P1&0xf8)+sensor;
    latch();
    startConv();
    wait();
    get();
    reading=P2;
    sensor++;
    }
     
    //


    LCD man Program


    lcd_ini();
    {
    lcd_dataa(“Eng Ahmed”);
    lcd_command(0xC5);
    b=(100)*196+(0x00);
    lcd_data_int(b);
     
    delay(200);
    b=0;
    lcd_command(0x01);
    }
     }
    }
     
     

     

    April 8, 2012 at 3:15 pm #7402
    Harsh Pandya
    Participant

    well , have you connected pull-up resistors on port 0 ? because port zero doesnot have an internal pull-up like other 3 ports

    April 9, 2012 at 4:43 pm #7405
    Ahmed
    Participant

    Hi Harsh Pandya

     

    Your answer so right i put 10K pull up resistance and it’s worked good… Thanks Pro.

     

    And another discussion in this link if any one need more information.

     

    http://www.engineersgarage.com/forums/8051/pull-resistor

     

     

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

RSS Recent Posts

  • Fun with AI and swordfish basic July 19, 2025
  • using a RTC in SF basic July 19, 2025
  • Does US electric code allow branching ? July 19, 2025
  • Faulty heat air gun (dc motor) - problem to locate fault due to Intermittent fault July 19, 2025
  • Sump pit water alarm - Kicad 9 July 19, 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