MCU 8051


How to interface 16x2 LCD with 8051 microcontroller (AT89C51)

How to interface 16x2 LCD with 8051 microcontroller (AT89C51)

It is very important to keep a track of the working of almost all the automated and semi-automated devices, be it a washing machine, an autonomous robot or anything else. This is achieved by displaying their status on a small display module. LCD (Liquid Crystal Display) screen is such a display module and a 16x2 LCD module is very commonly used. These modules are replacing seven segments and other multi segment LEDs for these purposes. The reasons being: LCDs are economical, easily programmable, have no limitation of displaying special & even custom characters (unlike in seven segments), animation and so on. LCD can be easily interfaced with a microcontroller to display a message or status of a device. This topic explains the basics of a 16x2 LCD and how it can be interfaced with AT89C51 to display a character.

Circuit diagram
Circuit for interface 16x2 LCD with 8051 microcontroller (AT89C51)     

Code  
//Program to test LCD. Display single character "A"

#include<reg51.h>
#define cmdport P3
#define dataport P2
#define q 100
sbit rs = cmdport^0;  //register select pin
sbit rw = cmdport^1;  // read write pin
sbit e = cmdport^6;  //enable pin

void delay(unsigned int msec)  // Function to provide time delay in msec.
{
int i,j ;
for(i=0;i<msec;i++)
for(j=0;j<1275;j++);
}

void lcdcmd(unsigned char item)  //Function to send command to LCD
{
dataport = item;
rs= 0;
rw=0;
e=1;
delay(1);
e=0;
}

void lcddata(unsigned char item)  //Function to send data to LCD
{
dataport = item;
rs= 1;
rw=0;
e=1;
delay(1);
e=0;
}

void main()
{
lcdcmd(0x38);  // for using 8-bit 2 row mode of LCD
delay(100);
lcdcmd(0x0E);  // turn display ON for cursor blinking
delay(100);
lcdcmd(0x01);  //clear screen
delay(100);
lcdcmd(0x06);  //display ON
delay(100);
lcdcmd(0x86);  // bring cursor to position 6 of line 1
delay(100);
lcddata('A');
}

How to interface RFID with 8051 microcontroller (AT89C51)

An RFID (Radio-frequency identification and detection) reader is a device which is used to communicate with RFID tags by receiving and transmitting signals. These signals use radio waves for wireless communication.RFID tag is applied to products, individuals or animals to identify and track them. The identification is done through a unique serial number. This topic covers the interfacing of a passive RFID system with AT89C51. The code of RFID tag is also displayed on an LCD interface. The free source code for the program is avaiable in C.
How to interface RFID with 8051 microcontroller (AT89C51)

Circuit Diagram
Circuit for interfacing RFID with 8051 microcontroller (AT89C51)



How to interface Stepper Motor with 8051 Microcontroller (AT89C51)


Stepper motor is one of the commonly used motors for precise angular movement. The advantage of using a stepper motor is that the angular position of the motor shaft can be controlled without any feedback mechanism. Stepper motors are widely used in industrial and commercial applications. They are also commonly used as in drive systems of autonomous robots.
This article explains the unipolar stepper motor interfacing with AT89C51 microcontroller. The microcontroller is programmed to rotate the stepper in wave drive and half drive stepping modes. For basic concepts and working of a stepper motor, refer the article on Stepper Motors.
Interfacing Stepper Motor with 8051 Microcontroller : Project

Circuit Diagram
Interfacing Stepper Motor with 8051 Microcontroller : Project - circuit

How to interface seven segment display with 8051 microcontroller (AT89C51)

Seven Segment displays are used in a number of systems to display the numeric information. The seven segment can display one digit at a time. Thus the no. of segments used depends on the no. of digits in the number to be displayed. Interfacing seven segment with a controller or MCU is tricky. This article explains the interfacing of seven segment with MCU AT89C51. It displays the digits 0 to 9 continuously at a predefined time delay.
How to interface seven segment display with 8051 microcontroller (AT89C51)

Circuit diagram
Circuit to interface seven segment display with 8051 microcontroller (AT89C5

For code post comment here..below