PC Serial RS232 Port interface To 8051

Description

It’s an example of PC Serial RS232 Port interface To 8051 microcontroller.

Circuit Diagram

Detail

It is an example of interfacing Serial RS232 port to 8051 microcontroller. This example show that how can we configure and use serial channel of 8051 microcontroller for sending and receiving data to other device like PC. In so many projects we need to share data or information to other devices. We can provide control between PC and other devices. After acquiring data from embedded device PC software can perform so many other processes to make this data useful information. For example we can read status of sensors using microcontroller and can control other part of our machinery. It is also possible to provide remote data acquisition and control in this way. Data can be read and be reported to a remote location using web & network. There may be several other possibilities.

This is a simple RS232 port interfacing example in which we are controlling 8 LEDs through PC serial port. A software like hyper-terminal can be used to send data to microcontroller. 8 LEDs can be replaced by transistors & relay switches to control and operate high volt devices.

For basic operation & components used in an 8051 based microcontroller based systems see
8051 Basic LED Flasher.

Downloads

PC-Serial-RS232-Port-interface-To-8051.zip

Related Projects

8051 Basic LED Flasher

8051 Calculator using PC Serial Port

PC Serial RS232 Port Interface To 7 Segment

PC Serial RS232 Port Interface To 16×2 LCD

More Projects

8051 I/O Ports Interfacing

Description

It’s an example of 8051 I/O Ports Interfacing.

Circuit Diagram

Detail

This example illustrates how can we use I/O ports of an 8051 based microcontroller. In this project I have used one port P1 for input and other port P2 for output. Each of these ports consists of 8 pins that can be accessed and used individually. There are 8 buttons connected to port P1 and 8 LEDs are connected on port P2. When user will press button B0 then LED D3 will toggle (on to off or off to on state). Similarly B1 controls LED D4, B2 controls LED D5 and so on.

For basic operation & components used in an 8051 based microcontroller based systems see
8051 Basic LED Flasher.

Free Downloads

8051-I-O-Ports-Interfacing.zip

Related Projects

8051 Basic LED Flasher

Electronic Dice using 8051

8051 To Seven Segment Display Interfacing

Cricket Score Board using 8051 and 7 Segment Display

2-Way Traffic Signal Controller

More Projects

8051 To 16×2 LCD Interfacing

Introduction

It’s an example of 8051 To 16×2 LCD Interfacing.

Circuit Diagram

Description

It is 16×2 LCD interfacing example with 8051 in 4 bit mode. In this project we can display results or outcomes of our system for users.

LCD

In embedded systems it is difficult to find status and errors generated by system software running inside of microcontroller. It is also necessary in so many other applications where we have to show results to users so that they can use system effectively. So there is a need of a display unit. There are more than one ways of displaying status or results of the system and LCD is one of these ways.

In this project we have used 16×2 means 16 columns and 2 rows LCD. This is based on HD44780 LCD controller. HD44780 is a generic dot matrix LCD controller made by Hitachi. This controller is installed on other sizes of LCDs like 16×1, 16×4, 20×2, 20×4 etc.

LCD.jpg
Click to Enlarge

Pin-Out

Pin Symbol Function
1 Vss ground (0 V)
2 Vdd power (4.5 – 5.5 V)
3 Vo contrast adjustment
4 RS H/L register select signal
5 R/W H/L read/write signal
6 E H/L enable signal
7-14 DB0 – DB7 H/L data bus for 4- or 8-bit mode
15 A (LED+) backlight anode
16 K (LED-) backlight cathode

This LCD can be operated in 4 or 8 bit data mode. In 4 bit mode 4 most significant data bits are used while in 8 bit mode all 8 data pins are connected to microcontroller. In this project we have used 4 bit mode of operation. In 4 bit mode each data or command byte is loaded in 2 iterations of 4 bit each. We can read & write data to LCD but to keep things simple we have hardwired R/W line to ground for only writing. It means we can only print on LCD but cannot read back content written in LCD RAM.

LCD commands used in this project are

  1. Function Set
  2. Entry Mode Set
  3. Display On/Off
  4. Clear Display
  5. Move Cursor/RAM Address Pointer

For basic operation & components used in an 8051 based microcontroller based systems see
8051 Basic LED Flasher.

Code

There is one header and two source/c files.

  1. main.c
  2. lcd4bit.h
  3. lcd4bit.c

Functional description of LCD functions is below

void init_lcd(void);

This function initializes LCD in 4 bit mode. First it confirms 4 bit interface of LCD then sets entry mode, switches on display and clears it.

void gotoxy_lcd(unsigned char col,unsigned char line);

Changes position of cursor on specified column and line by using cursor move command.

void putc_lcd(unsigned char byte);

This function prints single character on current position of cursor on LCD screen.

void print_lcd(char String[]);

This function prints a string on current position of LCD.

void delay_lcd (void);

This function is used to introduce delays needed before sending next command or to wait until previous command is executed.

void write_lcd(unsigned char Val);

This function writes/sends a byte (8 bits) by calling “write_nibble_lcd” function 2 times. It means 4 bits are transferred at one time. After this a delay is introduced to wait until for action is being performed by LCD according data/command sent.

void write_nibble_lcd(unsigned char Val)

This function writes/sends a nibble (4 bits) at one time.

Below is the main file code.

// Start of code.


///////////////////////////////////////////////////////////
// Company         : Micro Digital                       //
// Address         : Office # C7 Raza Plaza              //
//                   DAV College Road                    //
//                   Rawalpindi,                         //
//                   Pakistan.                           //
// Programmed By   : Rashid Mehmood                      //
// Project Name    : 8051 To 16x2 LCD Interfacing        //
// Crystal         : 24.000000 MHz                       //
// Microcontroller : AT89C51-C52-C55-S51-S52             //
///////////////////////////////////////////////////////////

#include <AT89X51.H>
#include "lcd4bit.h"

void main()
{
	unsigned char i = 0;
	init_lcd();
	print_lcd("  Micro Digital  \0");
	gotoxy_lcd(1, 2);
	print_lcd("micro-digital.net\0");
	while(1)
	{
	}
}

// End of code.

Free Downloads

8051-To-16×2-LCD-Interfacing.zip
HD44780 Datasheet

Related Projects

8051 Basic LED Flasher

Electronic Dice using 8051

8051 To Seven Segment Display Interfacing

Cricket Score Board using 8051 and 7 Segment Display

PC Serial RS232 Port Interface To 16×2 LCD

8051 Calculator with 16×2 LCD and Telephone Keypad

8051 4 Digit Electronic Code Lock with LCD and Keypad

More Projects

Downloads

OOPs! no download available.

Categories Uncategorized

Unipolar Stepper Motor Interfacing To 8051

Description

It’s an example of Unipolar Stepper Motor Interfacing To 8051 microcontroller.

Circuit Diagram

Detail

It is simplest stepper motor interfacing example with 8051. In this project 8051 microcontroller controls unipolar stepper motor.

Stepper Motor

Stepper or stepping motors rotate through a fixed (pre-determined) angular step in response to input command provided by controller. On every next command motor advances one angular step. It means motor rotates in a series of angular intervals/steps with each step of same distance. If we reverse the order of input commands the direction of stepper motor also reverses.

Stepper.jpg
Click to Enlarge
Stepper Internal Circuit Diagram
Stepper-Internal-Circuit.jpg
Click to Enlarge

Above is the circuit diagram of 5 or 6 pin unipolar stepper motor. There are 2 main coils A and B. Each is further sub divided into 2 more coils resulting A0, A1, B0 and B1. Center tapped are usually connected to common supply source and command or command pattern is provided by its controller on inputs A0, A1, B0 and B1. For full step command sequence is given by

b1 b0 a1 a0 Hex Decimal
0 0 0 1 0x01 1
0 1 0 0 0x04 4
0 0 1 0 0x02 2
1 0 0 0 0x08 8

We can make software interface simple by interchanging pin a1 with b0. Now commands sequence will become

b1 a1 b0 a0 Hex Dec
0 0 0 1 0x01 1
0 0 1 0 0x02 2
0 1 0 0 0x04 4
1 0 0 0 0x08 8

We can use this unipolar stepper motor as bipolar stepper motor by ignoring center tapped input.

In the controller circuit diagram Port0 4 LSBs are connected to the inputs of 2 ULN2003A coil driver IC. Each ULN2003A contains 7 darling-ton pairs to provide interface between 8051 microcontroller and stepper motor. As microcontroller cannot drive stepper motors or coils directly. We know that coils produce back emf when these are switched from “on” to “off” or “off” to “on” state. ULN2003A also provides back emf protection diodes to remove back emf produce by coils. Each driver of ULN2003A can sink 500mA current maximum. We can parallel these drivers to handle more current according to stepper motor needs. In the above controller circuit diagram we have paralleled 3 drivers. We have connected 3 inputs together. Similarly 3 outputs of driver together. Each pair of 3 drivers is driving a single coils of stepper motor. We have used separate power supplies for controller and stepper motor.

For basic operation & components used in an 8051 based microcontroller based systems see
8051 Basic LED Flasher.

Code

Below is the simplest code of stepper motor demonstration.

// Start of code.


///////////////////////////////////////////////////////////
// Company         : Micro Digital                       //
// Address         : Office # C7 Raza Plaza              //
//                   DAV College Road                    //
//                   Rawalpindi,                         //
//                   Pakistan.                           //
// Programmed By   : Rashid Mehmood                      //
// Project Name    : Unipolar Stepper Motor Interfacing  //
//                   To 8051                             //
// Crystal         : 24.000000 MHz                       //
// Microcontroller : AT89C2051-C51-C52-C55-S2051-S51-S52 //
///////////////////////////////////////////////////////////

#include <AT89x051.h>

void delay(unsigned int del)
{
	while(del --);
}

void main()
{
	char i;
	while(1)
	{
		for(i = 0; i < 4; i ++)
		{
			// Output pattern for next step.
			P0 = 0x01 << i;
			// Give some suitable delay.
			// You can change this delay
			// depending on your motor 
			// maximum speed.
			delay(10000);
		}	
	}
}

// End of code.

This code can also be executed with little or no change on AT89C2051 microcontroller a small brother of AT89C51.

Related Projects

8051 Basic LED Flasher

More Projects

2-Way Traffic Signal Controller

Description

It’s a 2-Way Traffic Signal Controller using 8051 microcontroller. It controls 6 lights (2 red, 2 yellow and 2 green) for 2-Way Traffic. It is an interesting and another basic learning project for student and hobbies.

Diagram

Detail

In this project 8051 microcontroller controls 6 traffic lights of 2-Way traffic. A fixed time is assigned to each green signal of each way. This is also simple project that uses 6 LEDs of 3 colors, 8051 microcontroller and an optional 5V power supply regulator part. It’s algorithm is as follows

1- Initially microcontroller will switche on both red LED lights of both ways and switches off all other LED lights of both ways.

2- Then wait for time defined by RESET_DELAY.

3- Now start servicing way 0 by switching yellow LED light of that way. Give delay of defined by YELLOW_DELAY.

4- Now switch off red and yellow LED lights of way 0 and switch on green of that way. Wait for green way 0 as defined by GREEN0_DELAY.

5- Switch off green and switch on yellow LED light for way 0. Give delay of defined by YELLOW_DELAY.

6- Switch off yellow and switch on red LED lights for way 0. Give delay of defined by RED_DELAY.

7- Now servicing of way 0 is complete and it is the time to service 2nd way that is way 1. Similarly we repeat steps from 2 to 6 for way 1 also.

8- After servicing of way 1 we once again start from way 0 as discussed earlier.

For basic operation & components used in an 8051 based microcontroller based systems see
8051 Basic LED Flasher.

Code

// Start of code.

///////////////////////////////////////////////////////////
// Company         : Micro Digital                       //
// Address         : Office # C7 Raza Plaza              //
//                   DAV College Road                    //
//                   Rawalpindi,                         //
//                   Pakistan.                           //
// Programmed By   : Rashid Mehmood                      //
// Project Name    : 2-Way Traffic Light Controller      //
// Crystal         : 24.000000 MHz                       //
// Microcontroller : AT89C2051-C51-C52-C55-S2051-S51-S52 //
///////////////////////////////////////////////////////////

// Header file for AT89x051 microcontrollers regiter definitions.
#include <AT89x051.h>

sbit R0 = P1^0;
sbit Y0 = P1^1;
sbit G0 = P1^2;
sbit R1 = P1^3;
sbit Y1 = P1^4;
sbit G1 = P1^5;

void delay_ms(unsigned int del)
{
	unsigned int i,j;
	for(i = 0; i < del; i ++)
		for(j = 0; j < 1275; j ++);
}

#define RESET_DELAY 	1000	// (aprox 1 second)
#define RED_DELAY 	1000	// (aprox 1 second)
#define YELLOW_DELAY	1000	// (aprox 1 second)
#define GREEN0_DELAY	2000	// (aprox 2 second)
#define GREEN1_DELAY	3000	// (aprox 3 second)

void main()
{
	// Initialize all lights////////
	// Switch on all red signals.
	R0 = R1 = 0;
	// Switch off all other signals.
	Y0 = Y1 = G0 = G1 = 1;
	delay_ms(RESET_DELAY);
	////////////////////////////////

	while(1)
	{

		// First service way 0.////////////////////

		// Switch on yellow of way 0.
		Y0 = 0;
		delay_ms(YELLOW_DELAY);


		// Switch off red and yellow of way 0 and 
		// switch on green of way 0.
		R0 = 1;
		Y0 = 1;
		G0 = 0;
		delay_ms(GREEN0_DELAY);
			
		// Switch off green of way 0 and 
		// switch on yellow of way 0;
		G0 = 1;
		Y0 = 0;
		delay_ms(YELLOW_DELAY);

		// Switch off yellow of way 0 and 
		// switch on red of way 0;
		Y0 = 1;
		R0 = 0;
		delay_ms(RED_DELAY);
		/////////////////////////////////////////

		
		// Now service way 1.////////////////////

		// Switch on yellow of way 1.
		Y1 = 0;
		delay_ms(YELLOW_DELAY);


		// Switch off red and yellow of way 1 and 
		// switch on green of way 1.
		R1 = 1;
		Y1 = 1;
		G1 = 0;
		delay_ms(GREEN0_DELAY);
			
		// Switch off green of way 1 and 
		// switch on yellow of way 1;
		G1 = 1;
		Y1 = 0;
		delay_ms(YELLOW_DELAY);

		// Switch off yellow of way 1 and 
		// switch on red of way 1;
		Y1 = 1;
		R1 = 0;
		delay_ms(RED_DELAY);
		/////////////////////////////////////////
	}
}

// End of code.

This code can also be executed on AT89C2051 microcontroller a small brother of AT89C51.

Related Projects

8051 Basic LED Flasher

Electronic Dice using 8051

8051 To Seven Segment Display Interfacing

More Projects

Electronic Dice using 8051

 

Description

It’s an Electronic Dice Game using 8051 microcontroller (Have a Peek Here). It is an interesting and basic learning project for student and hobbies. It describes how can we interface 8051 port pins for input and output.

Diagram

Detail

It is a project that builds microcontroller programming interest in new student and hobbies. This project is a very simple one that can easily be built by new students. It uses 7 LEDs, 8051 microcontroller and an optional 5V power supply regulator part. It’s algorithm is also very simple.

1) Initially microcontroller displays 1 on LEDs display just like in real dice.

2) Then in main while loop it waits for switch attached to pin 0 of port 1 to be pressed.

3) Until switch remains pressed it generates random number from 1 to 6 and displays it on LEDs.

4) When button is released it generates and display a new random number on LEDs.

5) It repeats from step 2 to step 5 until power is applied to the system.

For further information of components and basic 8051 microcontroller circuit please visit
8051 Basic LED Flasher.

Code

// Start of code.

///////////////////////////////////////////////////////////
// Company         : Micro Digital                       //
// Address         : Office # C7 Raza Plaza              //
//                   DAV College Road                    //
//                   Rawalpindi,                         //
//                   Pakistan.                           //
// Programmed By   : Rashid Mehmood                      //
// Project Name    : Electronic Dice using 8051          //
// Crystal         : 24.000000 MHz                       //
// Microcontroller : AT89C2051-C51-C52-C55-S2051-S51-S52 //
///////////////////////////////////////////////////////////

// Header file for AT89x051 microcontrollers regiter definitions.
#include <AT89x051.h>
// Header file for random number generation functions.
#include <stdlib.h>

sbit Led1 = P1^1;
sbit Led2 = P1^2;
sbit Led3 = P1^3;
sbit Led4 = P1^4;
sbit Led5 = P1^5;
sbit Led6 = P1^6;
sbit Led7 = P1^7;

// This function halts execution for
// specified milliseconds.
void delay_ms(unsigned int del)
{
	unsigned int i,j;
	for(i = 0; i < del; i ++)
		for(j = 0; j < 1275; j ++);
}

// Rename or define P1.0 as Switch.
sbit Switch = P1^0;

// This function displays an integer value from
// 0 to 6 on LEDs.
void Display(char Value)
{
	// Switch off all LEDs.
	Led1 = Led2 = Led3 = Led4 = Led5 = Led6 = Led7 = 1;
	switch(Value)
	{
	case 1:
		Led4 = 0;
		break;
	case 2:
		Led1 = Led7 = 0;
		break;
	case 3:
		Led1 = Led4 = Led7 = 0;
		break;
	case 4:
		Led1 = Led3 = Led5 = Led7 = 0;
		break;
	case 5:
		Led1 = Led3 = Led4 = Led5 = Led7 = 0;
		break;
	case 6:
		Led1 = Led2 = Led3 = Led5 = Led6 = Led7 = 0;
		break;
	}
}

// Define macro or formulae for random number
// generation from 1 to 6.
#define GetRandomNumber() ((rand() % 6) + 1)

void main()
{
	char RandomNumber;
	Switch = 1;
	Display(1);
	srand(50);
	while(1)
	{
		// Wait until switch is pressed.
		while(Switch);
		// Until switch is released.
		while(!Switch)
		{
			// Generate random number.
			RandomNumber = GetRandomNumber();
			// Display this number on LEDs.
			Display(RandomNumber);
			// Give some delay.
			delay_ms(10);
		}
		// Generate random number last time.
		RandomNumber = GetRandomNumber();
		// Finally display this number on LEDs.
		Display(RandomNumber);
	}
}

// End of code.

This code can also be executed on AT89C2051 microcontroller a small brother of AT89C51.

 

Related Projects

8051 Basic LED Flasher

2-Way Traffic Signal Controller

8051 To Seven Segment Display Interfacing

More Projects

8051 To 7 Segment Display Interfacing

Description

It’s an example project of 7 segment display interfacing to microcontroller 8051.

Diagram

Detail

This project describes how can we connect 7 segment display to 8051 microcontroller. Similarly it can be connected to any other microcontroller like PIC or AVR with modifications in code. Counting from 0 to 9 is displayed on it after some delay. This project also describes how to use 8051 port pins for output and LED drive.

How 7 Segment Works

7 segment display consists of 7 segments and a dot. Actually each segment and dot are LEDs (Light Emitting Diodes). Each segment including dot are total 8 LEDs.

7-Segment-88.gif
Click to Enlarge

Light Emitting Diode like an ordinary diode passes current in one direction (forward biased) and block in other (reverse biased) direction. Each LED has 2 pins one for anode and other for cathode. In common anode all anode terminals are connected together to form a common connection and remaining 8 cathodes are provided for negative side supply of individual LED. We connect common wire with positive supply and provide negative supply to appropriate LED segments to switch on and make a specific pattern on the whole display. In common cathode display all pins are opposite to common anode. All cathode terminals are connected to form a common connection and all other 8 pins are anodes. Pin diagram of commonly used seven segment display are given in above figure.

Code

///////////////////////////////////////////////////////////
// Company         : Micro Digital                       //
//                   DAV College Road                    //
//                   Rawalpindi,                         //
//                   Pakistan.                           //
// Programmed By   : Rashid Mehmood                      //
// Project Name    : 8051 To Seven Segment Display       //
// Crystal         : 24.000000 MHz                       //
// Microcontroller : AT89C2051-C51-C52-C55-S2051-S51-S52 //
///////////////////////////////////////////////////////////

// Start of code.

// Header file for AT89x051 microcontrollers.
#include <AT89x051.h>


#define SSeg P1

code const unsigned char RealDigit[10] = {
						0x40, 0x79, 0x24,
						0x30, 0x19, 0x12,
						0x02, 0x78, 0x00,
						0x10
					 };

void  delay(unsigned int del)
{
	// Wait until del is greater zero.
	while(del --);
}

// Displays value (0 to 9) on seven
// segment display.
void Display(unsigned char Value)
{
	if(Value < 10)
		SSeg = RealDigit[Value];
}

void main()
{
	unsigned char Value = 0;
	while(1)
	{
		for(Value = 0; Value < 10; Value ++)
		{
			Display(Value);
			delay(30000);	// Calibrated delay.
		}
	}
}
// End of code.

Related Projects

8051 Basic LED Flasher

Electronic Dice using 8051

2-Way Traffic Signal Controller

Cricket Score Board using 8051 and 7 Segment Display

8051 Timer0 As Second Counter On 7 Segment

8051 Digital Clock On 7 Segment (Non Multiplexed)

More Projects

555 Timer Oscillator/Led Flasher

Description

It’s a 555 IC based LED flasher that is very useful for beginners. It demonstrates basic operation of 555 timer IC as Astable Multivibrator.

Diagram

Detail

An oscillator is an important and essential part of many of the electronic circuits. It function in electronic circuit is as our heart function in our body. It pumps electronic parts pulses and makes them functional. So many electronic parts work on time basis. These perform different piece of work at different time such as timers shift registers and sequential logic ICs like CD4017. These all give different response or result on coming next pulse from oscillator. In other words oscillator instructs these ICs to perform their next function or operation. Counters increment on pulses and give different result on each pulse, shift registers shift internally loaded data on each pulse etc. So an oscillator or timer has very important role in our electronic circuits.
In above circuit diagram 555 IC with some additional parts work as an oscillator. It is also called an astable multivibrator. It outputs on/off(1 or 0 logic) on it’s pin 3. To describe it’s functionality first we see it’s internal diagram

555-Timer-Flasher-Osc-2.gif
Click to Enlarge

Internal circuit of 555 IC consists of 2 comparators, 3 resistors of same value, one transistor for discharging of capacitor C connected outside, 2 transistors for output stage and 1 flip flop. network of three resistors form a voltage divider and using this scheme 1/3 of the supply voltage are feed to 2nd op-amp at non-inverted (+ve) input for comparison reference voltage.




8051 Basic Led Flasher

Description

It’s an 8051 based basic LED flasher that is very useful for beginners. It describes parts, connections between them and programming environment for 8051 micro-controller.

Diagram

Detail

It provides foundation for microcontroller based application development for students, hobbies and beginners. It provides basics of 8051, minimum parts required, connection between them and programming environment for 8051 microcontroller.
Pin 20, 40 are power pins of microcontroller. Pin 40 is connected to 5V and pin 20 to ground. Pin EA (External Access) is connected to 5V. If we connect EA to 5V(logic 1) then it means code burnt inside microcontroller chip will be executed and if we connect it to ground(logic 0) then code inside an external RAM connected to microcontroller will be executed. Now we examine this circuit in parts.

1-Reset

8051-Basic-LED-Flasher-2.jpg
Click to Enlarge

When we power up our circuit then power and oscillator parts take some time to be stabilized. During this time we have to wait before starting program execution. If we does not wait and start program execution immediately then then there may be undesirable results. Suppose we have performed time calculation for some purposes then microcontroller may calculate wrong time value. Microcontroller manufacturers provide a reset pin that is used to accomplish this task with some extra components. To introduce delay we use circuit given in above figure. It is an RC oscillator that provides some delay according resistor-capacitor values used. In standard 8051 microcontroller pin 9 is used for reset. Capacitor C1 takes some time to charge up through R1 to a certain level. Before reaching this level pin 9 remains in reset state (logic 0) and program execution is not started. When this capacitor is charged to logic 1 level then program execution starts.

2-Oscillator

8051-Basic-LED-Flasher-3.jpg
Click to Enlarge

Usually microcontroller oscillator frequency selection option is given by the manufacturer to the circuit designer. Designer can select different frequencies. In ATmel’s 8051 microcontroller we can use this option as shown in above figure. This circuit uses crystal XT and 2 capacitors Cx1, Cx2 with internal oscillator of microcontroller to complete it. Different microcontrollers use different operating frequency range. Please consult datasheet of specific microcontroller for this purpose. ATmel’s AT89C51, AT89C52, AT89C2051 use maximum 24 Mhz, AT89S51, AT89S52, AT89C55 use maximum 33 MHz.

Code

// Start of code.

// Header file for AT89x051 microcontrollers.
#include <AT89x051.h>


// Delay routine.
void delay(unsigned int del)
{
	while(del --);
}

// Main routine.
void main()
{
	while(1)
	{
		P1_0 = 0;	// Turn off pin 0 of port 1.
		delay(30000);	// Give some delay.
		P1_0 = 1;	// Turn on pin 0 of port 1.
		delay(30000);	// Give some delay.
	}
}

// End of code.

This code can also be executed on AT89C2051 microcontroller a small brother of AT89C51.

Related Projects

Electronic Dice using 8051

2-Way Traffic Signal Controller

8051 To Seven Segment Display Interfacing

More Projects