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 / Help with AT89C2051

Help with AT89C2051

|

Microcontroller › 8051 › Help with AT89C2051

  • This topic has 3 replies, 2 voices, and was last updated 15 years ago by Ahmed.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • April 16, 2011 at 1:42 pm #868
    Ahmed
    Participant

    Hi There

     

    I use AT89C2051 to contrall  traffic light with PC

     

    my problem is with port1 that P1^0,P1^1 always disabled whene i program the ATMEL but in the Proteus Works good????

     

    what is the reson ????

     

    this is the code

     

    http://www.4shared.com/file/MfKAR5vs/Traffic.html

    April 20, 2011 at 4:49 am #6006
    romel emperado
    Participant

    pls post your code here..

    April 21, 2011 at 5:45 pm #6014
    Ahmed
    Participant

    I Use ALL-11P3 Programmer you know

    April 21, 2011 at 5:55 pm #6013
    Ahmed
    Participant

    This is the Code Romel

    the delay function can i calculate the time delay by using ((1/11.0592*10^6)*80000)??

    or ther is another way to calculate???

     

     

    /* *********************************************************************************************
     
    Project: Traffic Project (COM1)
    File: Traffic.txt
    Data: 8/4/2011
    Processor: AT89C2051
     
    Program to Controll Traffic with PC with provment of LED
     
    ********************************************************************************************* */
     
     
    #include<reg51.h>
    unsigned char temp;
     
    sbit trR3=P3^2;
    sbit trY3=P3^3;
    sbit trG3=P3^4;
    sbit trR4=P3^5;
    sbit trG4=P3^7;
    sbit trY4=P1^7; // Port Of LED’s
     
    void ini()     // Initialize Timer 1 for serial communication
    {
    TMOD=0x20;  //Timer1, baud rate 9600 bps
    SCON=0x50; // 8-Bit
    TH1=0XFD; //Load the timer high with initial value for serial connection
    TR1=1; //Start Timer 1
    }
     
    void delay() //simple Delay
    {
    int k,l;
    for(k=0;k<1000;k++)
    for(l=0;l<80;l++);
    }
     
    void recieve()  //Function to receive serial data for controlling
    {
    while(RI==0);
    temp=SBUF;
    switch(temp) // Sequence Of LED of traffic.
    {
    case(‘1’):
    P1=0x0c;
    trR3=1;
    trY3=0;
    trG3=0;
    trR4=1;
    trY4=0;
    trG4=0;
    break;
     
    case(‘2’):
    P1=0x12;
    trR3=1;
    trY3=0;
    trG3=0;
    trR4=1;
    trY4=0;
    trG4=0;
    break;
    case(‘3’):
    P1=0x21;
    trR3=1;
    trY3=0;
    trG3=0;
    trR4=1;
    trY4=0;
    trG4=0;
    break;
    case(‘4’):
    P1=0x11;
    trR3=0;
    trY3=1;
    trG3=0;
    trR4=1;
    trY4=0;
    trG4=0;
    break;
    case(‘5’):
    P1=0x09;
    trR3=0;
    trY3=0;
    trG3=1;
    trR4=1;
    trY4=0;
    trG4=0;
    break;
    case(‘6’):
    P1=0x09;
    trR3=0;
    trY3=1;
    trG3=0;
    trR4=0;
    trY4=1;
    trG4=0;
    break;
    case(‘7’):
    P1=0x09;
    trR3=1;
    trY3=0;
    trG3=0;
    trR4=0;
    trY4=0;
    trG4=1;
    break;
    case(‘8’):
    P1=0x0a;
    trR3=1;
    trY3=0;
    trG3=0;
    trR4=0;
    trY4=1;
    trG4=0;
    break;
    case(‘0’):
    P1=0;
    P1=0x12;
    trR3=0;
    trY3=1;
    trG3=0;
    trR4=0;
    trY4=1;
    trG4=0;
     
    delay();
    P1=0;
    trR3=0;
    trY3=0;
    trG3=0;
    trR4=0;
    trY4=0;
    trG4=0;
    }
     
    RI=0;
    }
     
    void main() //main Program.
    {
     
    ini(); //initialize the microcontroller
    while(1) // infinit loop
    {
    recieve();
    }
    } //End of Program
  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • Getting into an LED bulb April 21, 2026
  • understanding of resonance in time domain April 21, 2026
  • Beginner Questions About CNC Machines – G-code, Control Systems & Accuracy April 21, 2026
  • A Must-Watch Video Showing Dangerous Construction of Cheap Lithium-Ion Cells April 21, 2026
  • S1MJ ? April 20, 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