Continue to Site

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.

  • 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.

AT89C2051

Status
Not open for further replies.

gatzrulz

New Member
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..
 
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.
 

Attachments

  • led.JPG
    led.JPG
    15 KB · Views: 419
  • 89c2051.JPG
    89c2051.JPG
    62.6 KB · Views: 457
Ya i have selected it right. im using keil 4 without license. demo version
 

Attachments

  • device.JPG
    device.JPG
    62.9 KB · Views: 469
  • device1.JPG
    device1.JPG
    56 KB · Views: 441
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..
 
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
 

Attachments

  • LED=0.jpg
    LED=0.jpg
    134.2 KB · Views: 363
  • LED=1.jpg
    LED=1.jpg
    126.5 KB · Views: 363
  • led=1_1.jpg
    led=1_1.jpg
    136.5 KB · Views: 372
  • listing1.jpg
    listing1.jpg
    115.4 KB · Views: 351
  • listing2.jpg
    listing2.jpg
    102.1 KB · Views: 371
  • P1_start_debug.jpg
    P1_start_debug.jpg
    131.8 KB · Views: 354
  • P1=0.jpg
    P1=0.jpg
    131.7 KB · Views: 355
  • target option.jpg
    target option.jpg
    94.3 KB · Views: 369
  • traget option tab.jpg
    traget option tab.jpg
    97.9 KB · Views: 357
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top