8051 Trainer Kit-User Manual - V1.0-22
8051 Trainer Kit-User Manual - V1.0-22
8051 Trainer Kit-User Manual - V1.0-22
Features:
Technical Specification:
Specifications
MCU 89V51RD2,AT89S52,AT89SXX
and AT89CXX
Crystal Frequency 11.0592 MHz
Application:
Package Includes:
CONTENTS
Step2: Browse to your project folder and provide the project name(Ex: LED) and save it.
Step3: Once the project is saved a new pop up “Select Device for Target” opens, Select the
required 8051 series controller and click on OK.
Step5: Type the code or Copy paste the code and save the file (Ex: Led.c).
Step6: In order to build your recently created C program go to Project tab and click on Build
Target on the menu bar. An alternate way to do this is by Clicking on Build icon or by pressing
the F7 key. If the code that you have written is correct, the code will successfully compile
without any errors.
Step7: Right click on Target 1 and select Options for Target „Target 1‟
Step9: Click on Output tab, Make sure Create Hex File option is selected and the HEX format
should be HEX-80 Click Ok.
Step10: Add the file to the project, right click on Source Group 1 Add Existing files to‟
Source Group 1‟.
Step12: Now the Led.c file should appear in Project Source Group.
For installing drivers and Nuvoton ISP-ICP Utility Software, CLICK HERE.
Step1: Using a USB cable, connect the 8051 Trainer Kit to your computer.
NOTE: Before Uploading any hex file to the Trainer Kit, make the
below settings
1. Make FTRX and FTTX pins of DIP2 HIGH
2. Make all pins of DIP1 HIGH
Step3: Click the radio button ISP by Com Port, Select the Com Port
NOTE: Ensure that you have the FTDI Com port driver loaded. Please
download and install from the link provided below if it is not installed.
Link: https://ftdichip.com/drivers/d2xx-drivers/
For Installation Guide , CLICK HERE
Step6: Click on Upload Chip, and press the reset switch of the 8051 Microcontroller.
Reset Switch
EXPERIMENT NO 1
Blinking an LED
Aim:
Interfacing LED‟s with 8051-Microcontroller.
Description:
Turning ON and OFF an LED‟s after Particular delay.
Hardware Requirement:
8051 Trainer Kit ,FRC cable and USB A to B cable.
Procedure:
1. Connect P2 port and SV2 (LED) port using FRC cable as shown above.
2. Connect the USB cable to the board.
3. Open Keil uVision,write the program to blink LED.Then click on Build to verify the code.
4. Open Nuvoton Software to upload the hex File.
6. Click the radio button ISP by Com Port, Select the Com Port.
7. Select the IC (W78E052D).
8. Click on Load file, select the Hex file created and click on Open.
9. Click on Upload Chip, and press the reset switch of the 8051 Microcontroller.
10. You will get a FAIL dialog Box, Click on Ok.
11. You will get a PASS dialog Box, Click on Ok.
10. Press the reset switch of the 8051 Microcontroller and you can see the LED blink.
Program:
/*
* Project name:
8051 Development Board
* Copyright
(c) Researchdesignlab.com
* Description:
* Test configuration:
MCU: AT89S52
Dev.Board: 8051
Oscillator: 11.0592 MHz
Software: Keil uVision3
*/
#include<reg52.h> //special function register declarations
//for the intended 8051 derivative
void delay(); // Function prototype declaration
}
}
EXPERIMENT NO 2
Liquid Crystal Display
Aim:
Description:
Hardware required:
Procedure:
1. Connect P2 port and SV1(LCD 16*2 Display) port using FRC cable as shown above.
3. Open Keil uVision,write the program to display the message in the LCD.Then click on
Build to verify the code.
4. Open Nuvoton Software to upload the hex File
6. Click the radio button ISP by Com Port, Select the Com Port
7. Select the IC (W78E052D)
8. Click on Load file, select the Hex file created and click on Open
9. Click on Upload Chip, and press the reset switch of the 8051 development board.
10. You will get a FAIL dialog Box ,Click on Ok.
11. You will get a PASS dialog Box, Click on Ok.
10. Press the reset switch of the 8051 Microcontroller and you can see the message displayed
on the LCD.
Program:
#include<reg51.h>
sbit D7=P2^7;
sbit D6=P2^6;
sbit D5=P2^5;
sbit D4=P2^4;
//#define LCD_Port P2
int LCD_Port ;
void LCD_String_xy (char row, char pos, char *str) /* Send string to LCD
function */
{
if (row == 0)
LCD_Command((pos & 0x0F)|0x80);
else if (row == 1)
LCD_Command((pos & 0x0F)|0xC0);
LCD_String(str); /* Call LCD string function */
}
void main()
{
LCD_Init(); /* Initialization of LCD*/
LCD_String("RDL TECHOLOGIES"); /* write string on 1st line of LCD*/
LCD_Command(0xC0); /* Go to 2nd line*/
LCD_String_xy(1,0,"lcd display"); /*write string on 2nd line*/
while(1); /* Infinite loop. */
}
EXPERIMENT NO 3
Seven Segment Display
Aim:
Interfacing Seven Segment Display with 8051-Microcontroller.
Description:
To display numbers in the seven segment.
Hardware Required:
8051 Trainer Kit,FRC cables and USB A to B cable.
Procedure:
1. Connect P2 port and SV4(Data) port and connect P1 port and SV3(Select) port using FRC
cable as shown above
2. Connect the USB cable to the board.
3. Open Keil uVision,write the program to display numbers in the seven segment.Then click
Build to verify the code.
4. Open Nuvoton Software to upload the hex File
6. Click the radio button ISP by Com Port, Select the Com Port
7. Select the IC (W78E052D)
8. Click on Load file, select the Hex file created and click on Open
9. Click on Upload Chip, and press the reset switch of the 8051 development board.
10. You will get a FAIL dialog Box ,Click on Ok.
11. You will get a PASS dialog Box, Click on Ok.
10. Press the reset switch of the 8051 Microcontroller and you can see the displayed numbers
in the seven segment.
Program:
/*
* Project name:
8051 Development Board
* Copyright
(c) Researchdesignlab.com
* Description:
* Test configuration:
MCU: AT89S52
Dev.Board: 8051
Oscillator: 11.0592 MHz
Software: Keil uVision3
*/
#include<reg51.h>
unsigned int portb_index,portb_array[4],digit, COUNT=0;
}
void timer0(void) interrupt 1 {
IE=0;
P1 = 0XFF; // Turn off all 7seg displays
P2= portb_array[portb_index]; // bring appropriate value to PORTB
if(portb_index==0)
P1 = 0XF7;
else if(portb_index==1) // turn on appropriate 7seg. display
P1 = 0XFB;
else if(portb_index==2) // turn on appropriate 7seg. display
P1 = 0XFD;
else if(portb_index==3) // turn on appropriate 7seg. display
P1 = 0XFE;
portb_index++ ;
if (portb_index > 4)
portb_index = 0; // turn on 1st, turn off 2nd 7seg.
TH0=0xA4; //TH0=-92
IE=0x82;
// Clear T0IF
}
}
void DELAY()
{
unsigned int X=60000;
while(X--);
}
void main() {
display(1111);
DELAY();
display(2222);
DELAY();
display(3333);
DELAY();
display(4444);
DELAY();
display(5555);
DELAY();
display(6666);
DELAY();
display(7777);
DELAY();
display(8888);
DELAY();
display(9999);
DELAY();
display(0000);
//COUNT=COUNT+15;
//if(COUNT>2000)
//COUNT=0;
}
}
EXPERIMENT NO 4
Hex Keypad
Aim:
Description:
To display the pressed key on the LCD Display.
Hardware Required:
8051 Trainer Kit,FRC Cables and USB A to B Cable .
Procedure:
1. Connect P0 port and SV5(4*4 Key Matrix) port and Connect P2 port and SV1 port
using FRC cable as shown above.
2. Connect the USB cable to the board.
3. Open Keil uVision,write the program to display the pressed key on the LCD
Display.Then click Build to verify the code.
Program:
#include<reg51.h>
sbit D7=P2^7;
sbit D6=P2^6;
sbit D5=P2^5;
sbit D4=P2^4;
sbit rs=P2^0; /* Register select pin */
sbit en=P2^1; /* Enable pin */
#define KeyPort P0
unsigned char check();
unsigned int LCD_Port;
void delay12(unsigned int time);
/* Function to provide delay Approx 1ms with 11.0592 Mhz crystal*/
void delay(unsigned int count)
{
int i,j;
for(i=0;i<count;i++)
for(j=0;j<112;j++);
}
void LCD_String_xy (char row, char pos, char *str) /* Send string to LCD
function */
{
if (row == 0)
LCD_Command((pos & 0x0F)|0x80);
else if (row == 1)
LCD_Command((pos & 0x0F)|0xC0);
LCD_String(str); /* Call LCD string function */
}
void main()
{
unsigned char VALUE=0;
LCD_Init(); /* Initialization of LCD*/
LCD_String("RDL TECHOLOGIES"); /* write string on 1st line of LCD*/
LCD_Command(0xC0); /* Go to 2nd line*/
do
{
KeyPort = 0X0f;
do
{
colloc1 = KeyPort;
colloc1 &= 0x0F;
}while(colloc1 != 0x0F);
delay12(20);
do
{
colloc1=KeyPort;
colloc1 &= 0x0F;
}while(colloc1==0x0F);
delay12(20);
KeyPort = 0x0f;
colloc1=KeyPort;
colloc1 &= 0x0F;
if(colloc1==0x0E)
{
colloc=0;
}
else if(colloc1==0x0D)
{
colloc=1;
}
else if(rowloc1==0xD0)
{
rowloc=1;
}
else if(rowloc1==0xB0)
{
rowloc=2;
}
else if(rowloc1==0x70)
{
rowloc=3;
}
// CMD_WRT(0XC0);
// DATA_WRT(keypad[rowloc][colloc]);
return(keypad[rowloc][colloc]);
}while(1);
}
}
EXPERIMENT NO 6
RTC (Real Time Clock)
Aim:
Interfacing Real Time Clock with 8051-Microcontroller.
Description:
To display Date and Time on the LCD Display using 8051 Trainer Kit.
Hardware required:
8051 Trainer Kit ,FRC Cable and USB A to B Cable.
Procedure:
1. Connect P2 port and SV1(LCD 16*2 Display) port using FRC cable as shown above.
2. Make the I2C pins ON as shown.
3. Connect the USB cable to the board.
4. Open Keil uVision,write the program to display Date and Time on the LCD Display.Then
click on Build to verify the code.
5. Open Nuvoton Software to upload the hex File
6. Click the radio button ISP by Com Port, Select the Com Port
7. Select the IC (W78E052D)
8. Click on Load file, select the Hex file created and click on Open
9. Click on Upload Chip, and press the reset switch of the 8051 development board.
10. You will get a FAIL dialog Box ,Click on Ok.
11. You will get a PASS dialog Box, Click on Ok.
12. Press the Reset Button of the 8051 Microcontroller, the Date and Time will be displayed on
the LCD Display.
Program:
#include "reg51.h"
#include <intrins.h>
#include <stdio.h>
#define LCD_Port P2
//*****************************************
//*****************************************
void slave_add(unsigned char); //To send bit by bit data to the slave
void rtc_init();
LCD_Port = (LCD_Port & 0x0F) | (cmnd << 4);/* Send lower nibble */
en=1; /* Enable pulse */
delay(1);
en=0;
delay(5);
}
LCD_Port = (LCD_Port & 0x0F) | (char_data << 4);/* Send lower nibble
*/
en=1; /* Enable pulse */
delay(1);
en=0;
delay(5);
void LCD_String_xy (char row, char pos, char *str) /* Send string to LCD
function */
{
if (row == 0)
LCD_Command((pos & 0x0F)|0x80);
else if (row == 1)
LCD_Command((pos & 0x0F)|0xC0);
LCD_String(str); /* Call LCD string function */
}
void main()
{
unsigned char lcd_cmd[]={0x38,0x0f,0x01,0x06,0X80}; //Commands for
the LCD
unsigned char i,ch;
unsigned char mes_1[]="TIME ";
unsigned char mes_2[]="DATE ";
//*****************************************************
LCD_Init();
//*****************************************************
rtc_init();
//*****************************************************
delay12();
while(1)
{
LCD_Command(0x80);
i=0;
while(mes_1[i])
{
LCD_Char(mes_1[i]);
i++;
}
start_bit();
delay12();
slave_add(0xd0);
delay12();
LCD_Char(':');
start_bit();
delay12();
slave_add(0xd0);
delay12();
slave_add(0x01);
delay12();
start_bit();
delay12();
slave_add(0xd1);
delay12();
ch=data_rd_display();
delay12();
stop_bit();
delay12();
display(ch);
delay12();
delay12();
delay12();
LCD_Char(':');
start_bit();
slave_add(0xd0);
slave_add(0x00);
start_bit();
slave_add(0xd1);
ch=data_rd_display();
stop_bit();
display(ch);
delay12();
delay12();
//***********************************
LCD_Command(0xc0);
i=0;
while(mes_2[i])
{
LCD_Char(mes_2[i]);
i++;
}
LCD_Char('-');
start_bit();
slave_add(0xd0);
slave_add(0x05);
start_bit();
slave_add(0xd1);
ch=data_rd_display();
stop_bit();
display(ch);
delay12();
delay12();
LCD_Char('-');
start_bit();
slave_add(0xd0);
slave_add(0x06);
start_bit();
slave_add(0xd1);
ch=data_rd_display();
stop_bit();
display(ch);
delay12();
delay12();
}
}
//***********************************************
void start_bit()
{
sda=1;
scl=1; //Start bit condition
_nop_();
_nop_();
sda=0;
_nop_();
_nop_();
_nop_();
_nop_();
scl=0;
_nop_();
_nop_();
}
//*****************************************************
void stop_bit()
{
sda=0;
scl=1;
_nop_();
_nop_();
sda=1;
_nop_();
_nop_();
_nop_();
_nop_();
scl=0;
_nop_();
_nop_();
_nop_();
_nop_();
scl=1;
}
//******************************************************
for(i=0;i<8;i++)
{
t=(t&0x80);
if(t!=0)
sda=1;
else
sda=0;
scl=1;
_nop_();
_nop_();
_nop_();
scl=0;
t=add<<1;
add=t;
}
sda=1;
scl=1;
_nop_();
_nop_();
_nop_();
scl=0;
}
//*******************************************************
sda=1;
scl=1;
_nop_();
_nop_();
_nop_();
scl=0;
return(y);
}
//*******************************************************
void rtc_init()
{
unsigned char
a[]={0x00,0x00,0x01,0x50,0x02,0x06,0x03,0x02,0x04,0x11,0x05,0x12,0x06,0x12};
unsigned char x=0;
start_bit();
slave_add(0xd0);
slave_add(a[0]);
slave_add(a[1]);
stop_bit();
start_bit();
slave_add(0xd0);
slave_add(a[2]);
slave_add(a[3]);
stop_bit();
start_bit();
slave_add(0xd0);
slave_add(a[4]);
slave_add(a[5]);
stop_bit();
start_bit();
slave_add(0xd0);
slave_add(a[8]);
slave_add(a[9]);
stop_bit();
start_bit();
slave_add(0xd0);
slave_add(a[10]);
start_bit();
slave_add(0xd0);
slave_add(a[12]);
slave_add(a[13]);
stop_bit();
EXPERIMENT NO 7
UART
Aim:
Interfacing UART with 8051-Microcontroller.
Description:
Transmit/Receive Data using UART and display the data‟s on the terminal Software.
Hardware required:
8051 Trainer Kit ,USB to RS232 Converter,USB A to B Cable,Power Adapter 12V 2A.
Procedure:
15. Press the Reset Button of the 8051 Microcontroller, You can see the data on the terminal
software
16. Send the data from your keyboard, everything you type should be displayed in the
terminal window.
Program:
/*
* Project name:
8051 Development Board
* Copyright
(c) Researchdesignlab.com
* Description:
* Test configuration:
MCU: AT89S52
Dev.Board: 8051
Oscillator: 11.0592 MHz
Software: Keil uVision3
*/
#include<reg51.h>
void main()
{
unsigned char byte;
TMOD=0X20;
TH1=0XFD;
SCON=0X50;
TR1=1;
TRANSMIT("RESEARCH DESIGN LAB");
DELAY();
while(1)
{
byte=SCI_ReceiveByte();
transmit_byte(byte);
}
}
void DELAY()
{
unsigned int X=6000000;
while(X--);
EXPERIMENT NO 7
EEPROM
Aim:
Interfacing the EEPROM IC with 8051-Microcontroller.
Description:
To display the erased and stored data.
Hardware required:
8051 Trainer Kit and USB A to B Cable.
12. Press the Reset Button of the 8051 Microcontroller, You can see the data on the terminal
window.
Program:
#include"reg52.h"
#include "intrins.h"
#include"stdio.h"
char data_write[]="123456";
void delay();
void startbit();
unsigned char data_read();
void slaveaddr(unsigned char m) ;
void stopbit();
void INIT_SERIAL();
int i=0;
//**********************************************
//*********************************************
void main()
{
unsigned char cmp=0,k;
INIT_SERIAL();
for(i=0;i<6;i++)
{
startbit();
slaveaddr(DEV_WR);
slaveaddr(0x10+i);
slaveaddr(data_write[i]);
stopbit();
delay();
delay();
}
for( i=0;i<6;i++)
{
startbit();
slaveaddr(DEV_WR);
slaveaddr(0x10+i);
void delay()
{
{
long int x=300;
while(x--);
}
}
void INIT_SERIAL()
{
TMOD=0X20;
TH1=0XFD;
SCON=0X50;
TR1=1;
}
//***********************************************************//
void startbit()
{
sda=1;
scl=1;
//delay();
_nop_();
_nop_();
sda=0;
//delay();
//delay();
_nop_();
_nop_();
_nop_();
_nop_();
scl=0;
//**********************************************************
void stopbit()
{
sda=0;
scl=1;
//delay();
_nop_();
_nop_();
sda=1;
//delay();
//delay();
_nop_();
_nop_();
_nop_();
_nop_();
scl=0;
//delay();
_nop_();
_nop_();
_nop_();
_nop_();
scl=1;
//*********************************************************
scl=1;
//delay();
_nop_();
_nop_();
_nop_();
scl=0;
b=m<<1;
m=b;
}
sda=1;
//************************************************************
if(sda==1)
b1=(b1 | 0x01);
a1=b1;
b1=b1<<1;
scl=0;
}
sda=1;
scl=1;
//delay();
_nop_();
_nop_();
_nop_();
scl=0;
return(a1)
}