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 / error in program

error in program

|

Microcontroller › 8051 › error in program

  • This topic has 1 reply, 2 voices, and was last updated 14 years, 1 month ago by Syed Aameer.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • January 17, 2012 at 9:37 pm #1734
    alok
    Participant

    hii engineersgarage,thanks to u 4 a wonderful site

    i hav a problem regarding a 89s52 program 

     #include<reg52.h>

    void delay(int);
    unsigned char commands[]={0x38,0x0E,0x01,0x06,’’};
    unsigned char name[]={0x02,0x04,0x05,0x07,0x0c,’’};
     unsigned char star[]={0x03,0x08,0x09,0x0a,0x0b,’’};
     void lcd(value)
    {P1=value;}
    void display(label)
    {P2=label;}
    void show(zync)
    {P3=zync;}
      void main(void)
      { 
      int i,j,k;
      for(i=0;commands!=’’;i++)  //Sending string to LCD
    {
      lcd(commands);
      delay(250);
      delay(250);
    }
    if(i>=3)
    {   
       for(j=0;name[j]!=’’;j++) 
     
        {
      display(name[j]);
      delay(250);
      delay(250);
     
      
       }
     
     
       
     
    }
     
    if(j>=5)
    {
    {show(star[k]);
      k++;
      }
     
    delay(250);
    delay(250);}
     
     
    main();
     
    }
     
    void delay(unsigned int itime)
    {
    unsigned int p,q;
    for (p=0;p<itime;p++)
    for (q=0;q<1275;q++);
    }
     
     
     
    the output of this program shud be
    increment p1 upto 06 then p2 to 0c then p3 t0 0b and so on
    but in one cycle the program works well but in snother next cycle  p3 starts taking values from p1 and some other garbage values…
    please tell m whats wrong in my program
    thank u
    February 10, 2012 at 1:38 pm #7142
    Syed Aameer
    Participant

    Hello  Alok,

                I am confused what you have written..i think you are a begineer…

     

    But if you want to repeat the Program then just used While(1){       } or you can use   for(;;)

     

     

    dont call main function

     

    After

     

     

    void main(void)

    { 
             int i,j,k;
             While(1)
             {
                      for(i=0;commands!=”;i++)  //Sending string to LCD

              }

     

    }

     

  • 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

  • Happy Pi day. March 15, 2026
  • Please could you advise me on this circuit for car OBD2 March 15, 2026
  • Noise problem March 14, 2026
  • Cubloc modbus settings with rs485 March 14, 2026
  • Measuring microphone output March 14, 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