[51] LED not blinking using 8051

Status
Not open for further replies.

aashishedaboard

Newbie level 3
Joined
Aug 25, 2010
Messages
4
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Location
India
Visit site
Activity points
1,312
Hi I am aashish, I am a pure beginner to 8051 microcontrollers and want to Blink a LED connected to port 1 with it (as my first test).

It is my habit to start any thing from groundup.......

I performed the following steps,
1. Generate Hex file from keil uVision
2. Flash the AT89S52 with this hex file using a 8051 programmer.
3. Connect a LED to AT89S52 on breadboard to test my work.

But at the end the LED did not blink.:--( The LED connected to P1.0 glows appears continuous but dimmer, but don't blink.

Please have a look at the word document : https://drive.google.com/file/d/0B5NYQC3oiHcHcjh2a3RBOW5famc/edit?usp=sharing [i saved it in my google drive, public viewing] to see the detailed steps that I have followed along with the connection of LED to AT89S52 on breadboard to test my work

So where I was wrong? my program is incorrect/incomplete?? Or Does the AT89S52 not have an on chip clock? Whether I have to connect an external crystal?? Or anything I am missing….??


Please help me I am in a great need of it. Please help.


Thanks in advance.
 

Hello aashishedaboard,welcome to the world of microcontrollers. Firstly,let me tell you that,your documentation about the project is really good.
In you program
Code:
#include <REGX51.H>

void delay( unsigned int );

void main()

{

while(1)

{

P1 = 0x01;

delay(1000);

P1 = ~P1;

delay(1000);

}

}

//DELAY FUNCTION ( mS )

void delay( unsigned int time )

{
unsigned int i;

 unsigned int j;

for( i=0; i<time; i++ )

for( j=0; j<1275; j++ );

}

The program is working fine. but its taking appx 8 sec to blink on and off.

- - - Updated - - -

Try out this code,with simple delay & check if its blinking.this is working just fine.
Code:
int main()
{
	 int i;
	while(1)
	{
		P1=0x01;
		for(i=0;i<30000;i++);
		P1=~P1;
		for(i=0;i<30000;i++);
		
	}
}
 

You have to connect the EA pin (pin 31) to vcc ,unless the uC does not execute the program inside the chip. Also you have to care about the reset pin. Try to use a power on reset circuit using RC network . Here is one std circuit
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…