1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

AT89C2051

Discussion in '8051/8951' started by gatzrulz, Dec 22, 2015.

  1. gatzrulz

    gatzrulz New Member

    Joined:
    Mar 16, 2008
    Messages:
    7
    Likes:
    0
    Location:
    India
    im doing a small project. Im a newbie. Ive done a program to toggle a bit with time delay. When i select 89S52 controller it works fine. But when i select 89C2051 it is only working in debugging mode and not with the hardware. In debugging mode when i look at the pheripherals only the port bits are getting enabled and disabled with the time delay and not the pin bits...

    Pls Help..
     
  2. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,305
    Likes:
    914
    Location:
    Rochdale UK
    We need schematic and code!!! The only differences are ports... The 2051 doesn't have port 2 or port 0, so if you are toggling one of these bit it won't work!!
     
  3. gatzrulz

    gatzrulz New Member

    Joined:
    Mar 16, 2008
    Messages:
    7
    Likes:
    0
    Location:
    India
    Hi,
    Here is a code,

    #include<reg51.h>
    //#include<reg2051.h>

    sbit LED = P1^0;

    void delay(ms);

    void main(void)
    {
    P1 = 0x00;
    while(1)
    {
    LED = 1;
    delay(20);
    LED = 0;
    delay(20);

    }
    }

    void delay(time)
    {
    int a,b;
    for(a=0;a<time;a++)
    for(b=0;b<200;b++);
    }

    I have attached the circuit.

    The problem comes only when i choose controller AT89C2051. But when i select AT89s52 i dont have any issues while debugging as well as in hardware.
     

    Attached Files:

  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,305
    Likes:
    914
    Location:
    Rochdale UK

    What IDE are you using.... Are you selecting the correct device in the device properties?
     
  6. gatzrulz

    gatzrulz New Member

    Joined:
    Mar 16, 2008
    Messages:
    7
    Likes:
    0
    Location:
    India
    Ya i have selected it right. im using keil 4 without license. demo version
     

    Attached Files:

  7. gatzrulz

    gatzrulz New Member

    Joined:
    Mar 16, 2008
    Messages:
    7
    Likes:
    0
    Location:
    India
    is there any other ide i can use for atmel controllers.. with free license.
     
  8. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,305
    Likes:
    914
    Location:
    Rochdale UK
    I use ISIS but it is mega expensive.... MCU 8051 IDE is free but you need to compile it??? Or you can pay a small charge for the compiled version on windows.. Freewap is free so compilation shouldn't be too hard.

    There is also gSim51 but I have never tried it..
     
  9. vanan

    vanan New Member

    Joined:
    Jun 14, 2016
    Messages:
    8
    Likes:
    0
    Location:
    Chennai
    Hi
    The 89c2051 device has only 2048 bytes of code memory and it has compiler limitation. The LJMP & LCALL will not possible here because the call functions are 16bits addressable call or jump ahy where in the 64K block.
    for 2051 device you must use AJMP ACALL function they are 13 bits addressable i.e., jump 0r call with in the 2K block so you have to do

    in Keil compiler open new project and select 89c2051 as target device, right click 'Taget1 foleder' option for target in the 'device target tab' popup 'code ROM size' to 'small programme 2K or less' and select oK button then compile it will be OK see the attachments its works fine

    Regards
     

    Attached Files:

Share This Page