# [51]AT89C2051 Works in Proteus But it not works in Hardware.

Status
Not open for further replies.

#### yuvarajbe

##### Newbie level 5
hello ,

i am working on AT89C2051, i am trying to make a simple code as a start up for my full project .
i wrote i code just to switch the led on at P3^1 , it works in proteus but it is not working in real hardware .
also i tried to wrote a simple code in c language using Keil platform, and it burner by Willar Programmer. Here with I attached my code

anyone can give a help to solve the problem .

code:

Code C - [expand]1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <at892051.h>

/*function for delay of 1 sec*/
sbit p3=P3^1;
void delay()
{
unsigned int x;
for(x=0;x<33000;x++);
}

main()
{
int cnt = 0;
for (;;)
{
p3=1;
delay();
p3=0;
delay();
}
}

#### Attachments

• Programmer_screenshot.png
72.8 KB · Views: 66
Last edited by a moderator:

#### KlausST

##### Super Moderator
Staff member
Hi,

it works in proteus
.. this tells me the code does work.

Klaus

#### yuvarajbe

##### Newbie level 5
Hi,
In Hardware nothing happened.its idle mode.I have one more doubt.

I am using IDE Keil uvision 2 its Evaluation version.For this any problem occur???

#### saswat

##### Junior Member level 2
Hi,
In Hardware nothing happened.its idle mode.I have one more doubt.

I am using IDE Keil uvision 2 its Evaluation version.For this any problem occur???
No problem in using IDE Keil uvision 2 Evaluation version. The Evaluation version is capable to handle the code size up to 2 kb and your code is less than this. Have you made your own hardware or you are using EVK board (or development board) ??.

#### yuvarajbe

##### Newbie level 5
Hi
Its my Own hardware. Connection shown below image.I connect port 3.1 instead of led pin in image

#### saswat

##### Junior Member level 2
What is the resistance value of the resistor which is connected with led?

yuvarajbe

### yuvarajbe

Points: 2

#### yuvarajbe

##### Newbie level 5
Resistance Value is 330ohm. But i directly measured the pin3.1 through multimeter. there is no response While i give high or low by coding.

##### Banned
Maybe you have compiled for Debug mode instead of release mode.

yuvarajbe

### yuvarajbe

Points: 2

#### yuvarajbe

##### Newbie level 5
In the debug mode, debugger use .obj files, and generate hex file in the state of release mode.
I cant get what u said?

#### saswat

##### Junior Member level 2
But i directly measured the pin3.1 through multimeter. there is no response While i give high or low by coding.

Just add one pull up resistor of 10K fromVcc to P3.1 and check by giving logic high and low!!

Last edited:

Status
Not open for further replies.