SlideShare a Scribd company logo
1 of 25
Download to read offline
User’s Manual
              for
8051 Development Kit
    8051SM-10x15

   Developed at S.R.K.N.E.C.

       M.Tech. VLSI Lab

       By: Anish Goel
 Assist. Prof. Electronics Dept.

     (M.S.E.E., NJIT, USA)
CONTENTS
   1.   Introduction
   2.   Details of the development kit and features.
   3.   Connecting and powering up the kit.
   4.   Tutorial on RIDE and Flash Magic
   5.   Sample codes




8051SM-10x15 Manual                                    Page 2
Chapter 1
Introduction
This development kit is a high end 8051microcontroller development kit intended
for advanced embedded applications. The kit is developed using surface mount
technology, double sided PCB and uses surface mounting components. The
development kit contains the following:

   1. A 10cm x 15cm 8051 Development kit PCB with following devices on it:
         a. P89V51RD2FBC microcontroller chip.
         b. MAX232 chip
         c. DS 1307 RTC chip
         d. AT24C16 EEPROM chip
         e. ULN2803 chip
         f. SMD LED’s – 8 Nos.
         g. Pushbutton Switches – 6 Nos.
         h. Serial DB-9 Connector.
         i. 32.768 Khz crystal and 3V battery for RTC
         j. LM7805 voltage regulator IC and filtering capacitors.
         k. 11.0592 MHz crystal and other discrete components.

   2. A serial Cable.

   3. A CD containing the required software’s and this instruction manual.

   4. 16x2 LCD module mounted on 16 pin FRC connector.

   5. 5x2 FRC/ribbon cables – 4 Nos.

   6. D.C. Adaptor




8051SM-10x15 Manual                                                          Page 3
Chapter 2
Details of the development kit and Features




    10                                        1

    11
                                              2
    12
                                              3
    13
                                              4
     14
    15                      2
                                2
                                    12        5


    16
                                              6
    17
                                              7

    18                                        8
    19                                        9



         20




8051SM-10x15 Manual                               Page 4
Identification
   1 ------------------------------------------------------ Outputs of ULN2803
   2 ------------------------------------------------------ LED’s
   3 ------------------------------------------------------ ULN 2803 IC
   4 ------------------------------------------------------ AT24C16 IC
   5 ------------------------------------------------------ FRC connectors *
   6 ------------------------------------------------------ DC Jack
   7 ------------------------------------------------------ Capacitor and filter
   8 ------------------------------------------------------Input Switches
   9 ------------------------------------------------------ON/OFF Switch
   10 ------------------------------------------------------LCD contrast control preset
   11 ------------------------------------------------------ LCD connector
   12 ------------------------------------------------------ Serial Port DB-9 Connector
   13 ------------------------------------------------------MAX232 IC
   14 ------------------------------------------------------DS1307 RTC IC
   15 ------------------------------------------------------Crystal for RTC
   16 ------------------------------------------------------Crystal for microcontroller
   17 ------------------------------------------------------P89V51RD2 MuC
   18 ------------------------------------------------------Expansion Slot
   19 ------------------------------------------------------Battery back-up for RTC
   20 ------------------------------------------------------Power ON LED



* Refer to following sections for detailed configuration.




8051SM-10x15 Manual                                                                  Page 5
Features:
   1. The size of the kit is very small, due to SMD’s and double sided PCB and it is
      extremely handy and can be easily used without proper lab setup with a
      laptop machine.
      Size in cm: 10 x 15
   2. CPU of the development kit P89V51RD2FBC which is a In-system
      programmable microcontroller with intel 8051 architecture.
   3. For basic input/output interface LED’s and switches are provided.
   4. The switches are provided as per configuration of a menu driven program.
   5. ULN2803 IC provides up to 8 Darlington pairs that may be used for driving
      motors or relays.
   6. A MAX-232 IC with capacitors is interfaced to the microcontroller at its SCI
      port to provide serial communication.
   7. Power-ON reset circuitry is provided on the board that resets the
      microcontroller when it is powered up. A reset switch is also present to
      reset the microcontroller at any instance.
   8. DC adaptor is provided to power up the kit. A ON/OFF switch is present to
      turn the kit ON/OFF. Power-ON indicator LED indicates if the kit is getting
      power.
   9. A 11.0592 MHz crystal is present on the board to provide clock to the chip.
   10.Male FRC connector pins are available on the kit as expansion slot to
      interface any other PCB or device to the microcontroller besides the ON-
      board interfaces.
   11.LCD is interfaced in 4 bit mode and backlight of the LCD can be turned
      ON/OFF by software. Contrast control is provided using preset.
   12. DS1307 Real time clock IC with crystal and battery back-up is available on-
      board to support real time applications.
   13. AT24C16 EEPROM chip (2KB) is present on board to learn I2C interface and
      provide memory to the kit.
   14. All ports of 8051 are available at the FRC male connectors of 5x2
      configurations to make the connections flexible. Any of the on-board


8051SM-10x15 Manual                                                           Page 6
interfaces and devices may be connected to any of these ports using the
      FRC ribbon cables.



Pin connections for MuC on the Kit.
Pin Number              Function            Connected to:      Comments
     1            Port 1 5th Bit (P1.5)    Port 1 Con. Pin 6      --
     2            Port 1 6st Bit (P1.6)    Port 1 Con. Pin 7      --
     3            Port 1 7th Bit (P1.7)    Port 1 Con. Pin 8      --
     4                     Reset             Reset Switch         --
                        th
     5          Port 3 0 Bit (P3.0)/RXD    Port 3 Con. Pin 1      --
     6                      NIC                   NC              --
                        st
     7          Port 3 1 Bit (P3.1)/TXD    Port 3 Con. Pin 2      --
     8            Port 3 2nd Bit (P3.2)    Port 3 Con. Pin 3      --
     9            Port 3 3rd Bit (P3.3)    Port 3 Con. Pin 4      --
     10           Port 3 4th Bit (P3.4)    Port 3 Con. Pin 5      --
     11           Port 3 5th Bit (P3.5)    Port 3 Con. Pin 6      --
     12           Port 3 6th Bit (P3.6)    Port 3 Con. Pin 7      --
     13           Port 3 7th Bit (P3.7)    Port 3 Con. Pin 8      --
     14                   XTAL1                 Crystal           --
     15                   XTAL2                 Crystal           --
     16                     VSS                  GND              --
     17                     NIC                   NC              --
                            th
     18           Port 2 0 Bit (P2.0 )     Port 2 Con. Pin 1      --
     19           Port 2 1st Bit (P2.1)    Port 2 Con. Pin 2      --
     20           Port 2 2nd Bit (P2.2)    Port 2 Con. Pin 3      --
     21           Port 2 3rd Bit (P2.3)    Port 2 Con. Pin 4      --
     22           Port 2 4th Bit (P2.4)    Port 2 Con. Pin 5      --
     23           Port 2 5th Bit (P2.5)    Port 2 Con. Pin 6      --
     24           Port 2 6th Bit (P2.6)    Port 2 Con. Pin 7      --
     25           Port 2 7th Bit (P2.7)    Port 2 Con. Pin 8      --
     26                    PSEN                  VCC              --
     27                     ALE                   NC              --
     28                     NIC                   NC              --
     29                  EA/Vpp                  VCC              --
     30           Port 0 7th Bit (P0.7 )   Port 0 Con. Pin 8      --
     31           Port 0 6th Bit (P0.6)    Port 0 Con. Pin 7      --
     32           Port 0 5th Bit (P0.5)    Port 0 Con. Pin 6      --
     33           Port 0 4th Bit (P0.4)    Port 0 Con. Pin 5      --
     34           Port 0 3rd Bit (P0.3)    Port 0 Con. Pin 4      --

8051SM-10x15 Manual                                                       Page 7
35               Port 0 2nd Bit (P0.2)       Port 0 Con. Pin 3               --
                               st
     36               Port 0 1 Bit (P0.1)         Port 0 Con. Pin 2               --
                              th
     37               Port 0 0 Bit (P0.0)         Port 0 Con. Pin 1               --
     38                       VCC                       VCC                       --
     39                       NIC                        NC                       --
     40               Port 1 0th Bit (P1.0)       Port 1 Con. Pin 1               --
     41               Port 1 1st Bit (P1.1)       Port 1 Con. Pin 2               --
                              nd
     42               Port 1 2 Bit (P1.2)         Port 1 Con. Pin 3               --
                              rd
     43               Port 1 3 Bit (P1.3)         Port 1 Con. Pin 4               --
                              th
     44               Port 1 4 Bit (P1.4)         Port 1 Con. Pin 5               --
* NIC: No internal Connection. ** NC: Not connected.

Connection details from FRC connectors and Devices point of view




             ULN2803                             PORT 0

                                                                      Pin Config. of all FRC’s




               LED’s                             PORT 1

                                                                                  1    2

                                                                                  3    4

                                                                                  5    6

                                                                                  7    8
               LCD                               PORT 3
                                                                                  9    10




        Switch and I2C                           PORT 2




8051SM-10x15 Manual                                                                         Page 8
Connection details:
Component FRC’s                            Microcontroller FRC’s

   FRC      Connector    Connected         FRC       Connector     Connected
Connector      Pin          to          Connector       Pin           to
  Name                                    Name
               1         ULN CH 8                        1           P0.0
               2         ULN CH 7                        2           P0.1
               3         ULN CH 6                        3           P0.2
               4         ULN CH 5                        4           P0.3
  ULN          5         ULN CH 4        Port 0          5           P0.4
  2803         6         ULN CH 3                        6           P0.5
               7         ULN CH 2                        7           P0.6
               8         ULN CH 1                        8           P0.7
               9           NC                            9           VCC
               10          NC                            10          GND
               1          LED 1                          1           P1.0
               2          LED 2                          2           P1.1
               3          LED 3                          3           P1.2
               4          LED 4                          4           P1.3
  LED’s        5          LED 5          Port 1          5           P1.4
               6          LED 6                          6           P1.5
               7          LED 7                          7           P1.6
               8          LED 8                          8           P1.7
               9        LED’s Cathode                    9           VCC
               10            NC                          10          GND
               1             RS                          1           P3.0
               2             RW                          2           P3.1
               3             EN                          3           P3.2
               4        LEC Backlight                    4           P3.3
  LCD          5            DB4          Port 3          5           P3.4
               6            DB5                          6           P3.5
               7            DB6                          7           P3.6
               8            DB7                          8           P3.7
               9            VCC                          9           VCC
               10           GND                          10          GND
               1           UP(0)                         1           P2.0
               2         CANCEL(1)                       2           P2.1
               3          ENTER(2)                       3           P2.2
               4          DOWN(3)                        4           P2.3
Switches       5            A(4)         Port 2          5           P2.4
  and          6            B(5)                         6           P2.5

8051SM-10x15 Manual                                                    Page 9
I2C        7       SCL   7    P2.6
              8       SDA   8    P2.7
              9       VCC   9    VCC
              10      GND   10   GND




8051SM-10x15 Manual              Page 10
Chapter 3
Connecting and powering up the kit
   1. Power is provided to the kit through DC adaptor provided with the kit.
   2. Do not connect A.C. adaptor or DC adaptor with opposite polarity
      configuration pin.
   3. Plug-in the adaptor in the A.C socket and insert the output pin of the adaptor
      into the D.C. jack present on the kit PCB.
   4. After connecting the adaptor, push the ON/OFF switch.
   5. The power LED on the kit turns ON to indicate that the kit is powered up
      properly.
   6. The serial cable provided with the kit is used to transfer the hex code from
      the PC to the kit and also as a serial link between the kit and any other
      device while performing serial communication.
   7. Connect one of the ends of the serial cable (Male connector) to the female
      serial DB-9 connector on the kit.
   8. Connect the other end of this cable to the serial port of the computer
      (Desktop).
   9. A USB to serial convertor may be used if the kit is to be connected to a
      Laptop.
   10.There is no indication whether the serial link between the kit and computer
      is has been established. It is automatically verified once a program is
      transferred from the computer to the microcontroller successfully.




8051SM-10x15 Manual                                                          Page 11
Chapter 4
Tutorial on RIDE and Flash Magic
Executing sample programs using RIDE.


   1. Open the RIDE software.




   2. To make a new project:
         • Project        New




         •   Specify a “Name”.
         •   Directory where the project is to be stored.
         •   Target family as 80C51.
         •   Click “Next”.
         •   Select the target device as: Atmel-AT89S52, or Philips-
             P89C/V51RD2xx.

8051SM-10x15 Manual                                                    Page 12
• Clock on “Finish”
   3. The place on the left hand side is the project window. It shows all the
      details about the project.




   4. To create new file: File    New C File.
   5. Write your code into the window on the right and save it.
   6. Right click on your project name in the project window and click on “Add
   node source/application”.
   7. Brows the saved C-File and click ok. This includes the C-File in the project.
   8. To generate .HEX file of the project press F9. The hex file is generated is
   there are no errors in the code.
   9. The location of the .HEX file is shown at the bottom of the RIDE window.




8051SM-10x15 Manual                                                             Page 13
10. This file can be directly transferred to the microcontroller using Flash
   magic.



Programming the microcontroller P89C/V51RD2BN using Philips Flash
Magic
   1. Open the Philips flash magic software.
   2. Make the following setting in the software:
         • Select the appropriate COM port where the kit is connected.
         • Select the Baud rate (Generally keep it at 9600)
         • Select the device (89C51RD2xx or 89V51RD2) according to the
           microcontroller place on board.
         • Place a tick on “Erase all flash”
   3. Brows your code’s .HEX File I the hex file space.




8051SM-10x15 Manual                                                           Page 14
4. Click on the “Start” button.
   5. The software gives a message “Reset the device in ISP mode now” (in case
      of 89V51RD2)




   6. Turn the kit off by pressing the pushbutton switch (ON/OFF) switch and
   then switch it on. The above box disappears and the hex file gets transferred.
   7. After the software shows “Finish” (bottom right of the window) Press
      “RESET” switch to execute your program.




8051SM-10x15 Manual                                                       Page 15
Chapter 5
Sample codes
Code 1
This code will blink LED’s alternatively.
Connect a FRC cable from the connector labeled “Port 1” to connector labeled “LED”
/*Change the numbers 0xaa and 0x55 to change the pattern of the LED’s.*/

# include<reg51rx.h>

main()

{
         int t;
         P1=0xaa;
         for(t=0;t<50000;t++);
         P1=0x55;
         for(t=0;t<50000;t++);
         main();
}


Code 2
This code checks if any of the switches at port 2 is pressed and then blinks the LED’s at port 1.
Connect a FRC cable from the connector labeled “Port 1” to connector labeled “LED”
Connect another FRC cable from connector labeled “Port 2” to connector labeled “I2C and
Switches”.

# include<reg51rx.h>

void prog1();
void delay();

main()

{
         int r;

8051SM-10x15 Manual                                                                        Page 16
P2=0xff;
       if (P2!=0xff)
       {
               prog1();
       }
}

void prog1(void)

{
       P1=0x00;
       delay();
       P1=0xff;
       delay();
       main();
}

void delay(void)

{
       int t;
       for(t=0;t<50000;t++);
}



Code 3
Set the baud rate on hyper-terminal at 9600 bps
/************************************************************/
/*      this displays how to serially communicate without printf */
/************************************************************/

/* Change the matter in the statement “Hello World” to change the message.

#include<reg51rx.h>

void comsend(char *);
void cominit();

void main()

8051SM-10x15 Manual                                                          Page 17
{
         cominit();//initialize UART for communication
         comsend("Hello World");//send the string
         while(1);//stop
}

void cominit()
{
       TH1=-3;//timer 1 used as baud rate generator, gives 9600 baud
       TMOD=0x20;//timer 1 in mode 1
       TR1=1;//start timer 1

         SCON=0x50;//intialize UART
}

void comsend(char *dat)//read data
{
       char data temp;//temporary
       for(temp=0;dat[temp];temp++)//count characters in the string
       {
              TI=0;
              SBUF=dat[temp];//transmit character
              while(!TI);//wait for transmission
       }
}



Code 4
This code will display a message on the LCD.
Connect a FRC cable from the connector labeled “Port 2” to connector labeled “LCD”



#include <reg51rx.h>

 //********************************************************
//             DEFINE
//*********************************************************

// LCD

8051SM-10x15 Manual                                                                  Page 18
#define LCD_RS         0x01
#define LCD_RW         0x02
#define LCD_E         0x04
#define LCD_BACKLIGHT 0x08
#define LCD_D4        0x10
#define LCD_D5        0x20
#define LCD_D6        0x40
#define LCD_D7        0x80
#define LCD_PORT        P2
#define LCD_DATA        0x01
#define LCD_CTRL        0x00
#define LCD_C_BLINK_ON 0x09
#define LCD_C_BLINK_OFF 0xfe
#define LCD_C_ON         0x0a
#define LCD_C_OFF        0xfd
#define LCD_DISPLAY_ON 0x0c
#define LCD_DISPLAY_OFF 0xfb
#define LCD_BACKLIGHT_ON      0x24
#define LCD_BACKLIGHT_OFF     0x25

//**********************************************************
//                PROTOTYPE
//**********************************************************
// LCD
void LCDInit(unsigned char x,unsigned char y);
void LCDOff(void);
void LCDClrSCR(void);
void LCDGotoXY(unsigned char,unsigned char);
void LCDWriteString(char *);
void LCDWriteConstString(const char *);
void LCDWriteChar(char);
void LCDWriteData(unsigned char,unsigned char);
void LCDWait(void);
void LCDDelay50us(int Delay);
void LCDTextAttr(unsigned char attribute);
void LCDContrast(unsigned char Cont);

//***********************************************************
//             GLOBAL VARIABLE
//***********************************************************
// LCD
unsigned char MaxX, MaxY, LCDStat;
char Text[16];
//***********************************************************
//             MAIN
//***********************************************************

8051SM-10x15 Manual                                             Page 19
void main()
{
  LCDInit(16,2);
  LCDClrSCR();
  LCDGotoXY(1,1);
  LCDWriteConstString("Test Test Test Test0");
  LCDGotoXY(1,2);
  LCDWriteConstString("--------------------0");

    while(1);
}

//***********************************************************
// LCD Code
/************************************************************
Name:       void LCDClrSCR(void)
Description: Clear the LCD
**************************************************************/
void LCDClrSCR(void)
{
  LCDWait();
  LCDWriteData(LCD_CTRL,0x01); // Clear display
}
/*************************************************************
Name:       LCDGotoXY(unsigned char x, unsigned char y)
Description: Position cursor on the LCD at X & Y location
Input:     X -> X position on the LCD
        Y -> Y position on the LCD
**************************************************************/
void LCDGotoXY(unsigned char x,unsigned char y)
{
  unsigned char address;

    x--;
    if (MaxY < 3)
    {
      switch(y)
      {
        case 'x01' :
        address = 0 + x;
        break;
        case 'x02' :
        address = 64 + x;
        break;
      }
    }

8051SM-10x15 Manual                                               Page 20
else
{
  switch(y)
  {
    case 'x01' :
    address = 0 + x;
    break;
    case 'x02' :
    address = 64 + x;
    break;
    case 'x03' :
    address = 20 + x;
    break;
    case 'x04' :
    address = 84 + x;
    break;
  }
}
LCDWriteData(LCD_CTRL,address | 0x80);
}
/***********************************************************
Name:        WriteByteLCD(char byte)
Description: Write a byte on the LCD at cursor position
************************************************************/
void LCDWriteChar(char byte)
{
  char tmp;
  tmp = byte & 0xf0;
  tmp = tmp >> 4;
  tmp += 0x30;
  if (tmp > 0x39) tmp += 0x07;
  LCDWriteData(LCD_DATA,tmp);
  tmp = byte & 0x0f;
  tmp += 0x30;
  if (tmp > 0x39) tmp += 0x07;
  LCDWriteData(LCD_DATA,tmp);
}
/***********************************************************
Name:        void LCDWriteString(char *ptr)
Description: Write a string from RAM on the LCD
Input:      string pointer
************************************************************/
void LCDWriteString(char *ptr)
{
  unsigned char i;



8051SM-10x15 Manual                                             Page 21
for (i=1;i<41;i++)
{
  if (*ptr == 0x00) break;
  LCDWriteData(LCD_DATA,*ptr++);
}
}
/************************************************************
Name:       void LCDWriteConstString(const char *ptr)
Description: Write a constant string on the LCD
Input:    string pointer
**************************************************************/
void LCDWriteConstString(const char *ptr)
{
  unsigned char i;

for (i=1;i<41;i++)
{
  if (*ptr == 0x00) break;
  else if (i == 21) LCDGotoXY(1,2);
  LCDWriteData(LCD_DATA,*ptr++);
}
}
/**************************************************************
Name:        void LCDWriteData(unsigned char rs, unsigned char ch)
Description: Write a byte in rs of the LCD
Input:     rs -> Register select
        ch -> byte to write
***************************************************************/
void LCDWriteData(unsigned char rs,unsigned char ch)
{
  unsigned char Stat;

Stat = LCD_PORT & LCD_BACKLIGHT;
LCD_PORT = Stat;
LCDWait();
if ((ch & 0x80) == 0x80) LCD_PORT |= LCD_D7;
if ((ch & 0x40) == 0x40) LCD_PORT |= LCD_D6;
if ((ch & 0x20) == 0x20) LCD_PORT |= LCD_D5;
if ((ch & 0x10) == 0x10) LCD_PORT |= LCD_D4;
if (rs == 1) LCD_PORT |= LCD_RS;
LCDDelay50us(1);
LCD_PORT |= LCD_E;
LCD_PORT &= ~LCD_E;
LCD_PORT = Stat;
if ((ch & 0x08) == 0x08) LCD_PORT |= LCD_D7;
if ((ch & 0x04) == 0x04) LCD_PORT |= LCD_D6;

8051SM-10x15 Manual                                                  Page 22
if ((ch & 0x02) == 0x02) LCD_PORT |= LCD_D5;
if ((ch & 0x01) == 0x01) LCD_PORT |= LCD_D4;
if (rs == 1) LCD_PORT |= LCD_RS;
 LCDDelay50us(1);
LCD_PORT |= LCD_E;
LCD_PORT &= ~LCD_E;
}
/**********************************************************
Name:          void LCDWait(void)
Description: wait for the LCD to be ready
***********************************************************/
void LCDWait(void)
{
  int i,j;
  for (i=0;i<20;i++)
  {
    for (j=1;j<120;j++);
  }
}
/*********************************************************
Name:          void LCDDelay50us(int Delay)
Description: Delay of 50 us with a 16Mhz resonator
Input:        Delay X x 50us
**********************************************************/
void LCDDelay50us(int Delay)
{
  int i,j;
  for (i=0;i<Delay;i++)
  {
    for (j=1;j<120;j++);
  }
}
/**********************************************************
Name:          void LCDTextAttr(unsigned char Attribute)
Description: Set the LCD attribute
Input:        LCD_C_BLINK_ON : Cursor blink on
           LCD_C_BLINK_OFF : Cursor blink off
           LCD_C_ON         : Cursor on
           LCD_C_OFF         : Cursor off
           LCD_DISPLAY_ON : Display ON
           LCD_DISPLAY_OFF : Display OFF
************************************************************/
void LCDTextAttr(unsigned char attribute)
{
switch (attribute)
    {

8051SM-10x15 Manual                                             Page 23
case LCD_C_BLINK_ON:
    LCDStat |= LCD_C_BLINK_ON;
    LCDWriteData(LCD_CTRL,LCDStat);
    break;
 case LCD_C_BLINK_OFF:
    LCDStat &= LCD_C_BLINK_OFF;
    LCDWriteData(LCD_CTRL,LCDStat);
    break;
 case LCD_C_ON:
    LCDStat |= LCD_C_ON;
    LCDWriteData(LCD_CTRL,LCDStat);
    break;
 case LCD_C_OFF:
    LCDStat &= LCD_C_OFF;
    LCDWriteData(LCD_CTRL,LCDStat);
    break;
 case LCD_DISPLAY_ON:
    LCDStat |= LCD_DISPLAY_ON;
    LCDWriteData(LCD_CTRL,LCDStat);
    break;
 case LCD_DISPLAY_OFF:
    LCDStat &= LCD_DISPLAY_OFF;
    LCDWriteData(LCD_CTRL,LCDStat);
    break;
 case LCD_BACKLIGHT_ON:
    LCD_PORT |= LCD_BACKLIGHT;
    break;
 case LCD_BACKLIGHT_OFF:
    LCD_PORT &= ~(LCD_BACKLIGHT);
    break;
 }
}
/*************************************************************
Name:       void LCDOn(unsigned char X, unsigned char Y)
Description: Initialize LCD in 4bit mode
Input:     unsigned char X -> X size
        unsigned char Y -> Y size
**************************************************************/
void LCDInit(unsigned char X, unsigned char Y)
{
  MaxX = X;
  MaxY = Y;
  LCDStat = 0x0c;
  LCD_PORT = 0x00;
  LCD_PORT = ~(LCD_D7+LCD_D6+LCD_D5+LCD_D4+LCD_E+LCD_RS+LCD_RW);
  LCD_PORT |= LCD_BACKLIGHT;

8051SM-10x15 Manual                                                Page 24
LCDDelay50us(340);
    LCD_PORT = (LCD_D5 + LCD_D4 + LCD_BACKLIGHT);
    LCD_PORT |= LCD_E;
    LCD_PORT &= ~LCD_E;
    LCDDelay50us(100);
    LCD_PORT |= LCD_E;
    LCD_PORT &= ~LCD_E;
    LCDDelay50us(100);
    LCD_PORT |= LCD_E;
    LCD_PORT &= ~LCD_E;
    LCDDelay50us(100);
    LCD_PORT = (LCD_D5 + LCD_BACKLIGHT);
    LCD_PORT |= LCD_E;
    LCD_PORT &= ~LCD_E;
    LCDDelay50us(100);
    if (Y == 1) LCDWriteData(LCD_CTRL,0x20); // 1 line
    else LCDWriteData(LCD_CTRL,0x28);        // 2 line
    LCDWriteData(LCD_CTRL,0x0c);          // Disp ON-Cur OFF-Blink OFF
    LCDWriteData(LCD_CTRL,0x01);           // Clear display
    LCDDelay50us(50);
    LCDWriteData(LCD_CTRL,0x06);           // Cursor INC Shift OFF
}




                     For more details visit: www.dicovermechatronics.blogspot.com
                                     Email: 2007.anish@gmail.com
                                             Cell: 09970825313



8051SM-10x15 Manual                                                                 Page 25

More Related Content

What's hot (19)

AT89C52 Data sheet
AT89C52 Data sheetAT89C52 Data sheet
AT89C52 Data sheet
 
At mega16 summary
At mega16 summaryAt mega16 summary
At mega16 summary
 
8 hw con-and_intel_hex_file
8 hw con-and_intel_hex_file8 hw con-and_intel_hex_file
8 hw con-and_intel_hex_file
 
atmega8
atmega8atmega8
atmega8
 
Atmel
AtmelAtmel
Atmel
 
Micro lec note2 (1)
Micro lec note2 (1)Micro lec note2 (1)
Micro lec note2 (1)
 
Micro lec note2
Micro lec note2Micro lec note2
Micro lec note2
 
8051 Microcontroller
8051 Microcontroller8051 Microcontroller
8051 Microcontroller
 
16 f877
16 f87716 f877
16 f877
 
At89 c51
At89 c51At89 c51
At89 c51
 
Programming with PIC microcontroller
Programming with PIC microcontroller Programming with PIC microcontroller
Programming with PIC microcontroller
 
At89s51
At89s51At89s51
At89s51
 
At89c4051
At89c4051At89c4051
At89c4051
 
At 89s51
At 89s51At 89s51
At 89s51
 
4 io port-programming
4 io port-programming4 io port-programming
4 io port-programming
 
Micro lec note2
Micro lec note2Micro lec note2
Micro lec note2
 
Intro2 Robotic With Pic18
Intro2 Robotic With Pic18Intro2 Robotic With Pic18
Intro2 Robotic With Pic18
 
Embedded systems io programming
Embedded systems   io programmingEmbedded systems   io programming
Embedded systems io programming
 
Atmega16 Microconntroller Data sheet
Atmega16 Microconntroller Data sheetAtmega16 Microconntroller Data sheet
Atmega16 Microconntroller Data sheet
 

Viewers also liked

Microcontroller 8051 training
Microcontroller 8051 trainingMicrocontroller 8051 training
Microcontroller 8051 trainingPradip Bhandari
 
8051 microcontroller
8051 microcontroller8051 microcontroller
8051 microcontrollerJhemi22
 
Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051Jay Patel
 
Embedded system 8051 Microcontroller
Embedded system 8051 MicrocontrollerEmbedded system 8051 Microcontroller
Embedded system 8051 Microcontrollerankitsharmaj
 
Embedded c programming guide e book atmel 8051 / 89c51 /89c52
Embedded c programming guide e book atmel 8051 / 89c51 /89c52Embedded c programming guide e book atmel 8051 / 89c51 /89c52
Embedded c programming guide e book atmel 8051 / 89c51 /89c52Raghav Shetty
 
Solution manual 8051 microcontroller by mazidi
Solution manual 8051 microcontroller by mazidiSolution manual 8051 microcontroller by mazidi
Solution manual 8051 microcontroller by mazidiMuhammad Abdullah
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051Rashmi
 
Applications of 8051 microcontrollers
Applications of 8051 microcontrollersApplications of 8051 microcontrollers
Applications of 8051 microcontrollersDr.YNM
 
Programming ATmega microcontroller using Embedded C
Programming ATmega microcontroller using Embedded CProgramming ATmega microcontroller using Embedded C
Programming ATmega microcontroller using Embedded CVarun A M
 
8051 Microcontroller Notes
8051 Microcontroller Notes8051 Microcontroller Notes
8051 Microcontroller NotesDr.YNM
 
8051 experiments1
8051 experiments18051 experiments1
8051 experiments1tt_aljobory
 

Viewers also liked (14)

8051
80518051
8051
 
Microcontroller 8051 training
Microcontroller 8051 trainingMicrocontroller 8051 training
Microcontroller 8051 training
 
8051 microcontroller
8051 microcontroller8051 microcontroller
8051 microcontroller
 
Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051
 
Embedded system 8051 Microcontroller
Embedded system 8051 MicrocontrollerEmbedded system 8051 Microcontroller
Embedded system 8051 Microcontroller
 
Embedded c programming guide e book atmel 8051 / 89c51 /89c52
Embedded c programming guide e book atmel 8051 / 89c51 /89c52Embedded c programming guide e book atmel 8051 / 89c51 /89c52
Embedded c programming guide e book atmel 8051 / 89c51 /89c52
 
Solution manual 8051 microcontroller by mazidi
Solution manual 8051 microcontroller by mazidiSolution manual 8051 microcontroller by mazidi
Solution manual 8051 microcontroller by mazidi
 
8051 Presentation
8051 Presentation8051 Presentation
8051 Presentation
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
 
Applications of 8051 microcontrollers
Applications of 8051 microcontrollersApplications of 8051 microcontrollers
Applications of 8051 microcontrollers
 
Programming ATmega microcontroller using Embedded C
Programming ATmega microcontroller using Embedded CProgramming ATmega microcontroller using Embedded C
Programming ATmega microcontroller using Embedded C
 
8051 Microcontroller Notes
8051 Microcontroller Notes8051 Microcontroller Notes
8051 Microcontroller Notes
 
MD51 Lab Manual
MD51 Lab ManualMD51 Lab Manual
MD51 Lab Manual
 
8051 experiments1
8051 experiments18051 experiments1
8051 experiments1
 

Similar to 8051 smd kit_manual

8051 kit manual
8051 kit manual8051 kit manual
8051 kit manualanishgoel
 
8051microcontroller
8051microcontroller 8051microcontroller
8051microcontroller manish080
 
8051 microcontroller
8051 microcontroller 8051 microcontroller
8051 microcontroller Gaurav Verma
 
At 89c51
At 89c51At 89c51
At 89c51Mr Giap
 
Microcontroller 8051 By Mitesh kumar
Microcontroller 8051 By Mitesh kumarMicrocontroller 8051 By Mitesh kumar
Microcontroller 8051 By Mitesh kumarMitesh Kumar
 
At 89c52
At 89c52At 89c52
At 89c52Mr Giap
 
PIC16F877A C Programming.ppt
PIC16F877A C Programming.pptPIC16F877A C Programming.ppt
PIC16F877A C Programming.pptIlaiyarajaS1
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051Moeez Shem
 
Automatic main gate controller
Automatic main gate controllerAutomatic main gate controller
Automatic main gate controllerPROJECTRONICS
 
Unit_I.pptx
Unit_I.pptxUnit_I.pptx
Unit_I.pptxPrithiv9
 
8051 microcontroller lecture ppt by Tarun Khaneja ( 9034406598 )
8051 microcontroller lecture ppt by Tarun Khaneja ( 9034406598 )8051 microcontroller lecture ppt by Tarun Khaneja ( 9034406598 )
8051 microcontroller lecture ppt by Tarun Khaneja ( 9034406598 )Tarun Khaneja
 
FOSOH-V (TM) preliminary schematics
FOSOH-V (TM) preliminary schematicsFOSOH-V (TM) preliminary schematics
FOSOH-V (TM) preliminary schematicsAli Uzel
 
P89 lpc920 921_922_9221
P89 lpc920 921_922_9221P89 lpc920 921_922_9221
P89 lpc920 921_922_9221trieuvantam
 
Atmel microcontrollers-a tmega328-p_datasheet
Atmel microcontrollers-a tmega328-p_datasheetAtmel microcontrollers-a tmega328-p_datasheet
Atmel microcontrollers-a tmega328-p_datasheetAlexTronciu
 
Datasheet 89S8253.pdf
Datasheet 89S8253.pdfDatasheet 89S8253.pdf
Datasheet 89S8253.pdfEFran9
 

Similar to 8051 smd kit_manual (20)

8051 kit manual
8051 kit manual8051 kit manual
8051 kit manual
 
8051microcontroller
8051microcontroller 8051microcontroller
8051microcontroller
 
8051 microcontroller
8051 microcontroller 8051 microcontroller
8051 microcontroller
 
8051 MICROCONTROLLER
8051 MICROCONTROLLER 8051 MICROCONTROLLER
8051 MICROCONTROLLER
 
At 89c51
At 89c51At 89c51
At 89c51
 
Microcontroller 8051 By Mitesh kumar
Microcontroller 8051 By Mitesh kumarMicrocontroller 8051 By Mitesh kumar
Microcontroller 8051 By Mitesh kumar
 
At 89c52
At 89c52At 89c52
At 89c52
 
8051 full ppt
8051 full ppt8051 full ppt
8051 full ppt
 
PIC16F877A C Programming.ppt
PIC16F877A C Programming.pptPIC16F877A C Programming.ppt
PIC16F877A C Programming.ppt
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
 
89 v51rd2bn
89 v51rd2bn89 v51rd2bn
89 v51rd2bn
 
Meta88full
Meta88fullMeta88full
Meta88full
 
Automatic main gate controller
Automatic main gate controllerAutomatic main gate controller
Automatic main gate controller
 
Unit_I.pptx
Unit_I.pptxUnit_I.pptx
Unit_I.pptx
 
8051 microcontroller lecture ppt by Tarun Khaneja ( 9034406598 )
8051 microcontroller lecture ppt by Tarun Khaneja ( 9034406598 )8051 microcontroller lecture ppt by Tarun Khaneja ( 9034406598 )
8051 microcontroller lecture ppt by Tarun Khaneja ( 9034406598 )
 
FOSOH-V (TM) preliminary schematics
FOSOH-V (TM) preliminary schematicsFOSOH-V (TM) preliminary schematics
FOSOH-V (TM) preliminary schematics
 
P89 lpc920 921_922_9221
P89 lpc920 921_922_9221P89 lpc920 921_922_9221
P89 lpc920 921_922_9221
 
Microcontroller 8051 gs
Microcontroller 8051 gsMicrocontroller 8051 gs
Microcontroller 8051 gs
 
Atmel microcontrollers-a tmega328-p_datasheet
Atmel microcontrollers-a tmega328-p_datasheetAtmel microcontrollers-a tmega328-p_datasheet
Atmel microcontrollers-a tmega328-p_datasheet
 
Datasheet 89S8253.pdf
Datasheet 89S8253.pdfDatasheet 89S8253.pdf
Datasheet 89S8253.pdf
 

More from anishgoel

Computer Organization
Computer OrganizationComputer Organization
Computer Organizationanishgoel
 
Learning vhdl by examples
Learning vhdl by examplesLearning vhdl by examples
Learning vhdl by examplesanishgoel
 
Dot matrix module interface wit Raspberry Pi
Dot matrix module interface wit Raspberry PiDot matrix module interface wit Raspberry Pi
Dot matrix module interface wit Raspberry Pianishgoel
 
Input interface with Raspberry pi
Input interface with Raspberry piInput interface with Raspberry pi
Input interface with Raspberry pianishgoel
 
Learning Python for Raspberry Pi
Learning Python for Raspberry PiLearning Python for Raspberry Pi
Learning Python for Raspberry Pianishgoel
 
Raspberry Pi
Raspberry PiRaspberry Pi
Raspberry Pianishgoel
 
learning vhdl by examples
learning vhdl by exampleslearning vhdl by examples
learning vhdl by examplesanishgoel
 
Digital System Design Basics
Digital System Design BasicsDigital System Design Basics
Digital System Design Basicsanishgoel
 
digital design of communication systems
digital design of communication systemsdigital design of communication systems
digital design of communication systemsanishgoel
 
Rtos concepts
Rtos conceptsRtos concepts
Rtos conceptsanishgoel
 
8051 Microcontroller Timer
8051 Microcontroller Timer8051 Microcontroller Timer
8051 Microcontroller Timeranishgoel
 
8051 Microcontroller I/O ports
8051 Microcontroller I/O ports8051 Microcontroller I/O ports
8051 Microcontroller I/O portsanishgoel
 
Serial Communication Interfaces
Serial Communication InterfacesSerial Communication Interfaces
Serial Communication Interfacesanishgoel
 
Embedded systems ppt iv part d
Embedded systems ppt iv   part dEmbedded systems ppt iv   part d
Embedded systems ppt iv part danishgoel
 
Embedded systems ppt iv part c
Embedded systems ppt iv   part cEmbedded systems ppt iv   part c
Embedded systems ppt iv part canishgoel
 
Embedded systems ppt iv part b
Embedded systems ppt iv   part bEmbedded systems ppt iv   part b
Embedded systems ppt iv part banishgoel
 
Embedded systems ppt ii
Embedded systems ppt iiEmbedded systems ppt ii
Embedded systems ppt iianishgoel
 
Embedded systems ppt iii
Embedded systems ppt iiiEmbedded systems ppt iii
Embedded systems ppt iiianishgoel
 
Embedded systems ppt iv part a
Embedded systems ppt iv   part aEmbedded systems ppt iv   part a
Embedded systems ppt iv part aanishgoel
 
Embedded systems ppt i
Embedded systems ppt iEmbedded systems ppt i
Embedded systems ppt ianishgoel
 

More from anishgoel (20)

Computer Organization
Computer OrganizationComputer Organization
Computer Organization
 
Learning vhdl by examples
Learning vhdl by examplesLearning vhdl by examples
Learning vhdl by examples
 
Dot matrix module interface wit Raspberry Pi
Dot matrix module interface wit Raspberry PiDot matrix module interface wit Raspberry Pi
Dot matrix module interface wit Raspberry Pi
 
Input interface with Raspberry pi
Input interface with Raspberry piInput interface with Raspberry pi
Input interface with Raspberry pi
 
Learning Python for Raspberry Pi
Learning Python for Raspberry PiLearning Python for Raspberry Pi
Learning Python for Raspberry Pi
 
Raspberry Pi
Raspberry PiRaspberry Pi
Raspberry Pi
 
learning vhdl by examples
learning vhdl by exampleslearning vhdl by examples
learning vhdl by examples
 
Digital System Design Basics
Digital System Design BasicsDigital System Design Basics
Digital System Design Basics
 
digital design of communication systems
digital design of communication systemsdigital design of communication systems
digital design of communication systems
 
Rtos concepts
Rtos conceptsRtos concepts
Rtos concepts
 
8051 Microcontroller Timer
8051 Microcontroller Timer8051 Microcontroller Timer
8051 Microcontroller Timer
 
8051 Microcontroller I/O ports
8051 Microcontroller I/O ports8051 Microcontroller I/O ports
8051 Microcontroller I/O ports
 
Serial Communication Interfaces
Serial Communication InterfacesSerial Communication Interfaces
Serial Communication Interfaces
 
Embedded systems ppt iv part d
Embedded systems ppt iv   part dEmbedded systems ppt iv   part d
Embedded systems ppt iv part d
 
Embedded systems ppt iv part c
Embedded systems ppt iv   part cEmbedded systems ppt iv   part c
Embedded systems ppt iv part c
 
Embedded systems ppt iv part b
Embedded systems ppt iv   part bEmbedded systems ppt iv   part b
Embedded systems ppt iv part b
 
Embedded systems ppt ii
Embedded systems ppt iiEmbedded systems ppt ii
Embedded systems ppt ii
 
Embedded systems ppt iii
Embedded systems ppt iiiEmbedded systems ppt iii
Embedded systems ppt iii
 
Embedded systems ppt iv part a
Embedded systems ppt iv   part aEmbedded systems ppt iv   part a
Embedded systems ppt iv part a
 
Embedded systems ppt i
Embedded systems ppt iEmbedded systems ppt i
Embedded systems ppt i
 

Recently uploaded

ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Food processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture honsFood processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture honsManeerUddin
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 

Recently uploaded (20)

ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
Food processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture honsFood processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture hons
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 

8051 smd kit_manual

  • 1. User’s Manual for 8051 Development Kit 8051SM-10x15 Developed at S.R.K.N.E.C. M.Tech. VLSI Lab By: Anish Goel Assist. Prof. Electronics Dept. (M.S.E.E., NJIT, USA)
  • 2. CONTENTS 1. Introduction 2. Details of the development kit and features. 3. Connecting and powering up the kit. 4. Tutorial on RIDE and Flash Magic 5. Sample codes 8051SM-10x15 Manual Page 2
  • 3. Chapter 1 Introduction This development kit is a high end 8051microcontroller development kit intended for advanced embedded applications. The kit is developed using surface mount technology, double sided PCB and uses surface mounting components. The development kit contains the following: 1. A 10cm x 15cm 8051 Development kit PCB with following devices on it: a. P89V51RD2FBC microcontroller chip. b. MAX232 chip c. DS 1307 RTC chip d. AT24C16 EEPROM chip e. ULN2803 chip f. SMD LED’s – 8 Nos. g. Pushbutton Switches – 6 Nos. h. Serial DB-9 Connector. i. 32.768 Khz crystal and 3V battery for RTC j. LM7805 voltage regulator IC and filtering capacitors. k. 11.0592 MHz crystal and other discrete components. 2. A serial Cable. 3. A CD containing the required software’s and this instruction manual. 4. 16x2 LCD module mounted on 16 pin FRC connector. 5. 5x2 FRC/ribbon cables – 4 Nos. 6. D.C. Adaptor 8051SM-10x15 Manual Page 3
  • 4. Chapter 2 Details of the development kit and Features 10 1 11 2 12 3 13 4 14 15 2 2 12 5 16 6 17 7 18 8 19 9 20 8051SM-10x15 Manual Page 4
  • 5. Identification 1 ------------------------------------------------------ Outputs of ULN2803 2 ------------------------------------------------------ LED’s 3 ------------------------------------------------------ ULN 2803 IC 4 ------------------------------------------------------ AT24C16 IC 5 ------------------------------------------------------ FRC connectors * 6 ------------------------------------------------------ DC Jack 7 ------------------------------------------------------ Capacitor and filter 8 ------------------------------------------------------Input Switches 9 ------------------------------------------------------ON/OFF Switch 10 ------------------------------------------------------LCD contrast control preset 11 ------------------------------------------------------ LCD connector 12 ------------------------------------------------------ Serial Port DB-9 Connector 13 ------------------------------------------------------MAX232 IC 14 ------------------------------------------------------DS1307 RTC IC 15 ------------------------------------------------------Crystal for RTC 16 ------------------------------------------------------Crystal for microcontroller 17 ------------------------------------------------------P89V51RD2 MuC 18 ------------------------------------------------------Expansion Slot 19 ------------------------------------------------------Battery back-up for RTC 20 ------------------------------------------------------Power ON LED * Refer to following sections for detailed configuration. 8051SM-10x15 Manual Page 5
  • 6. Features: 1. The size of the kit is very small, due to SMD’s and double sided PCB and it is extremely handy and can be easily used without proper lab setup with a laptop machine. Size in cm: 10 x 15 2. CPU of the development kit P89V51RD2FBC which is a In-system programmable microcontroller with intel 8051 architecture. 3. For basic input/output interface LED’s and switches are provided. 4. The switches are provided as per configuration of a menu driven program. 5. ULN2803 IC provides up to 8 Darlington pairs that may be used for driving motors or relays. 6. A MAX-232 IC with capacitors is interfaced to the microcontroller at its SCI port to provide serial communication. 7. Power-ON reset circuitry is provided on the board that resets the microcontroller when it is powered up. A reset switch is also present to reset the microcontroller at any instance. 8. DC adaptor is provided to power up the kit. A ON/OFF switch is present to turn the kit ON/OFF. Power-ON indicator LED indicates if the kit is getting power. 9. A 11.0592 MHz crystal is present on the board to provide clock to the chip. 10.Male FRC connector pins are available on the kit as expansion slot to interface any other PCB or device to the microcontroller besides the ON- board interfaces. 11.LCD is interfaced in 4 bit mode and backlight of the LCD can be turned ON/OFF by software. Contrast control is provided using preset. 12. DS1307 Real time clock IC with crystal and battery back-up is available on- board to support real time applications. 13. AT24C16 EEPROM chip (2KB) is present on board to learn I2C interface and provide memory to the kit. 14. All ports of 8051 are available at the FRC male connectors of 5x2 configurations to make the connections flexible. Any of the on-board 8051SM-10x15 Manual Page 6
  • 7. interfaces and devices may be connected to any of these ports using the FRC ribbon cables. Pin connections for MuC on the Kit. Pin Number Function Connected to: Comments 1 Port 1 5th Bit (P1.5) Port 1 Con. Pin 6 -- 2 Port 1 6st Bit (P1.6) Port 1 Con. Pin 7 -- 3 Port 1 7th Bit (P1.7) Port 1 Con. Pin 8 -- 4 Reset Reset Switch -- th 5 Port 3 0 Bit (P3.0)/RXD Port 3 Con. Pin 1 -- 6 NIC NC -- st 7 Port 3 1 Bit (P3.1)/TXD Port 3 Con. Pin 2 -- 8 Port 3 2nd Bit (P3.2) Port 3 Con. Pin 3 -- 9 Port 3 3rd Bit (P3.3) Port 3 Con. Pin 4 -- 10 Port 3 4th Bit (P3.4) Port 3 Con. Pin 5 -- 11 Port 3 5th Bit (P3.5) Port 3 Con. Pin 6 -- 12 Port 3 6th Bit (P3.6) Port 3 Con. Pin 7 -- 13 Port 3 7th Bit (P3.7) Port 3 Con. Pin 8 -- 14 XTAL1 Crystal -- 15 XTAL2 Crystal -- 16 VSS GND -- 17 NIC NC -- th 18 Port 2 0 Bit (P2.0 ) Port 2 Con. Pin 1 -- 19 Port 2 1st Bit (P2.1) Port 2 Con. Pin 2 -- 20 Port 2 2nd Bit (P2.2) Port 2 Con. Pin 3 -- 21 Port 2 3rd Bit (P2.3) Port 2 Con. Pin 4 -- 22 Port 2 4th Bit (P2.4) Port 2 Con. Pin 5 -- 23 Port 2 5th Bit (P2.5) Port 2 Con. Pin 6 -- 24 Port 2 6th Bit (P2.6) Port 2 Con. Pin 7 -- 25 Port 2 7th Bit (P2.7) Port 2 Con. Pin 8 -- 26 PSEN VCC -- 27 ALE NC -- 28 NIC NC -- 29 EA/Vpp VCC -- 30 Port 0 7th Bit (P0.7 ) Port 0 Con. Pin 8 -- 31 Port 0 6th Bit (P0.6) Port 0 Con. Pin 7 -- 32 Port 0 5th Bit (P0.5) Port 0 Con. Pin 6 -- 33 Port 0 4th Bit (P0.4) Port 0 Con. Pin 5 -- 34 Port 0 3rd Bit (P0.3) Port 0 Con. Pin 4 -- 8051SM-10x15 Manual Page 7
  • 8. 35 Port 0 2nd Bit (P0.2) Port 0 Con. Pin 3 -- st 36 Port 0 1 Bit (P0.1) Port 0 Con. Pin 2 -- th 37 Port 0 0 Bit (P0.0) Port 0 Con. Pin 1 -- 38 VCC VCC -- 39 NIC NC -- 40 Port 1 0th Bit (P1.0) Port 1 Con. Pin 1 -- 41 Port 1 1st Bit (P1.1) Port 1 Con. Pin 2 -- nd 42 Port 1 2 Bit (P1.2) Port 1 Con. Pin 3 -- rd 43 Port 1 3 Bit (P1.3) Port 1 Con. Pin 4 -- th 44 Port 1 4 Bit (P1.4) Port 1 Con. Pin 5 -- * NIC: No internal Connection. ** NC: Not connected. Connection details from FRC connectors and Devices point of view ULN2803 PORT 0 Pin Config. of all FRC’s LED’s PORT 1 1 2 3 4 5 6 7 8 LCD PORT 3 9 10 Switch and I2C PORT 2 8051SM-10x15 Manual Page 8
  • 9. Connection details: Component FRC’s Microcontroller FRC’s FRC Connector Connected FRC Connector Connected Connector Pin to Connector Pin to Name Name 1 ULN CH 8 1 P0.0 2 ULN CH 7 2 P0.1 3 ULN CH 6 3 P0.2 4 ULN CH 5 4 P0.3 ULN 5 ULN CH 4 Port 0 5 P0.4 2803 6 ULN CH 3 6 P0.5 7 ULN CH 2 7 P0.6 8 ULN CH 1 8 P0.7 9 NC 9 VCC 10 NC 10 GND 1 LED 1 1 P1.0 2 LED 2 2 P1.1 3 LED 3 3 P1.2 4 LED 4 4 P1.3 LED’s 5 LED 5 Port 1 5 P1.4 6 LED 6 6 P1.5 7 LED 7 7 P1.6 8 LED 8 8 P1.7 9 LED’s Cathode 9 VCC 10 NC 10 GND 1 RS 1 P3.0 2 RW 2 P3.1 3 EN 3 P3.2 4 LEC Backlight 4 P3.3 LCD 5 DB4 Port 3 5 P3.4 6 DB5 6 P3.5 7 DB6 7 P3.6 8 DB7 8 P3.7 9 VCC 9 VCC 10 GND 10 GND 1 UP(0) 1 P2.0 2 CANCEL(1) 2 P2.1 3 ENTER(2) 3 P2.2 4 DOWN(3) 4 P2.3 Switches 5 A(4) Port 2 5 P2.4 and 6 B(5) 6 P2.5 8051SM-10x15 Manual Page 9
  • 10. I2C 7 SCL 7 P2.6 8 SDA 8 P2.7 9 VCC 9 VCC 10 GND 10 GND 8051SM-10x15 Manual Page 10
  • 11. Chapter 3 Connecting and powering up the kit 1. Power is provided to the kit through DC adaptor provided with the kit. 2. Do not connect A.C. adaptor or DC adaptor with opposite polarity configuration pin. 3. Plug-in the adaptor in the A.C socket and insert the output pin of the adaptor into the D.C. jack present on the kit PCB. 4. After connecting the adaptor, push the ON/OFF switch. 5. The power LED on the kit turns ON to indicate that the kit is powered up properly. 6. The serial cable provided with the kit is used to transfer the hex code from the PC to the kit and also as a serial link between the kit and any other device while performing serial communication. 7. Connect one of the ends of the serial cable (Male connector) to the female serial DB-9 connector on the kit. 8. Connect the other end of this cable to the serial port of the computer (Desktop). 9. A USB to serial convertor may be used if the kit is to be connected to a Laptop. 10.There is no indication whether the serial link between the kit and computer is has been established. It is automatically verified once a program is transferred from the computer to the microcontroller successfully. 8051SM-10x15 Manual Page 11
  • 12. Chapter 4 Tutorial on RIDE and Flash Magic Executing sample programs using RIDE. 1. Open the RIDE software. 2. To make a new project: • Project New • Specify a “Name”. • Directory where the project is to be stored. • Target family as 80C51. • Click “Next”. • Select the target device as: Atmel-AT89S52, or Philips- P89C/V51RD2xx. 8051SM-10x15 Manual Page 12
  • 13. • Clock on “Finish” 3. The place on the left hand side is the project window. It shows all the details about the project. 4. To create new file: File New C File. 5. Write your code into the window on the right and save it. 6. Right click on your project name in the project window and click on “Add node source/application”. 7. Brows the saved C-File and click ok. This includes the C-File in the project. 8. To generate .HEX file of the project press F9. The hex file is generated is there are no errors in the code. 9. The location of the .HEX file is shown at the bottom of the RIDE window. 8051SM-10x15 Manual Page 13
  • 14. 10. This file can be directly transferred to the microcontroller using Flash magic. Programming the microcontroller P89C/V51RD2BN using Philips Flash Magic 1. Open the Philips flash magic software. 2. Make the following setting in the software: • Select the appropriate COM port where the kit is connected. • Select the Baud rate (Generally keep it at 9600) • Select the device (89C51RD2xx or 89V51RD2) according to the microcontroller place on board. • Place a tick on “Erase all flash” 3. Brows your code’s .HEX File I the hex file space. 8051SM-10x15 Manual Page 14
  • 15. 4. Click on the “Start” button. 5. The software gives a message “Reset the device in ISP mode now” (in case of 89V51RD2) 6. Turn the kit off by pressing the pushbutton switch (ON/OFF) switch and then switch it on. The above box disappears and the hex file gets transferred. 7. After the software shows “Finish” (bottom right of the window) Press “RESET” switch to execute your program. 8051SM-10x15 Manual Page 15
  • 16. Chapter 5 Sample codes Code 1 This code will blink LED’s alternatively. Connect a FRC cable from the connector labeled “Port 1” to connector labeled “LED” /*Change the numbers 0xaa and 0x55 to change the pattern of the LED’s.*/ # include<reg51rx.h> main() { int t; P1=0xaa; for(t=0;t<50000;t++); P1=0x55; for(t=0;t<50000;t++); main(); } Code 2 This code checks if any of the switches at port 2 is pressed and then blinks the LED’s at port 1. Connect a FRC cable from the connector labeled “Port 1” to connector labeled “LED” Connect another FRC cable from connector labeled “Port 2” to connector labeled “I2C and Switches”. # include<reg51rx.h> void prog1(); void delay(); main() { int r; 8051SM-10x15 Manual Page 16
  • 17. P2=0xff; if (P2!=0xff) { prog1(); } } void prog1(void) { P1=0x00; delay(); P1=0xff; delay(); main(); } void delay(void) { int t; for(t=0;t<50000;t++); } Code 3 Set the baud rate on hyper-terminal at 9600 bps /************************************************************/ /* this displays how to serially communicate without printf */ /************************************************************/ /* Change the matter in the statement “Hello World” to change the message. #include<reg51rx.h> void comsend(char *); void cominit(); void main() 8051SM-10x15 Manual Page 17
  • 18. { cominit();//initialize UART for communication comsend("Hello World");//send the string while(1);//stop } void cominit() { TH1=-3;//timer 1 used as baud rate generator, gives 9600 baud TMOD=0x20;//timer 1 in mode 1 TR1=1;//start timer 1 SCON=0x50;//intialize UART } void comsend(char *dat)//read data { char data temp;//temporary for(temp=0;dat[temp];temp++)//count characters in the string { TI=0; SBUF=dat[temp];//transmit character while(!TI);//wait for transmission } } Code 4 This code will display a message on the LCD. Connect a FRC cable from the connector labeled “Port 2” to connector labeled “LCD” #include <reg51rx.h> //******************************************************** // DEFINE //********************************************************* // LCD 8051SM-10x15 Manual Page 18
  • 19. #define LCD_RS 0x01 #define LCD_RW 0x02 #define LCD_E 0x04 #define LCD_BACKLIGHT 0x08 #define LCD_D4 0x10 #define LCD_D5 0x20 #define LCD_D6 0x40 #define LCD_D7 0x80 #define LCD_PORT P2 #define LCD_DATA 0x01 #define LCD_CTRL 0x00 #define LCD_C_BLINK_ON 0x09 #define LCD_C_BLINK_OFF 0xfe #define LCD_C_ON 0x0a #define LCD_C_OFF 0xfd #define LCD_DISPLAY_ON 0x0c #define LCD_DISPLAY_OFF 0xfb #define LCD_BACKLIGHT_ON 0x24 #define LCD_BACKLIGHT_OFF 0x25 //********************************************************** // PROTOTYPE //********************************************************** // LCD void LCDInit(unsigned char x,unsigned char y); void LCDOff(void); void LCDClrSCR(void); void LCDGotoXY(unsigned char,unsigned char); void LCDWriteString(char *); void LCDWriteConstString(const char *); void LCDWriteChar(char); void LCDWriteData(unsigned char,unsigned char); void LCDWait(void); void LCDDelay50us(int Delay); void LCDTextAttr(unsigned char attribute); void LCDContrast(unsigned char Cont); //*********************************************************** // GLOBAL VARIABLE //*********************************************************** // LCD unsigned char MaxX, MaxY, LCDStat; char Text[16]; //*********************************************************** // MAIN //*********************************************************** 8051SM-10x15 Manual Page 19
  • 20. void main() { LCDInit(16,2); LCDClrSCR(); LCDGotoXY(1,1); LCDWriteConstString("Test Test Test Test0"); LCDGotoXY(1,2); LCDWriteConstString("--------------------0"); while(1); } //*********************************************************** // LCD Code /************************************************************ Name: void LCDClrSCR(void) Description: Clear the LCD **************************************************************/ void LCDClrSCR(void) { LCDWait(); LCDWriteData(LCD_CTRL,0x01); // Clear display } /************************************************************* Name: LCDGotoXY(unsigned char x, unsigned char y) Description: Position cursor on the LCD at X & Y location Input: X -> X position on the LCD Y -> Y position on the LCD **************************************************************/ void LCDGotoXY(unsigned char x,unsigned char y) { unsigned char address; x--; if (MaxY < 3) { switch(y) { case 'x01' : address = 0 + x; break; case 'x02' : address = 64 + x; break; } } 8051SM-10x15 Manual Page 20
  • 21. else { switch(y) { case 'x01' : address = 0 + x; break; case 'x02' : address = 64 + x; break; case 'x03' : address = 20 + x; break; case 'x04' : address = 84 + x; break; } } LCDWriteData(LCD_CTRL,address | 0x80); } /*********************************************************** Name: WriteByteLCD(char byte) Description: Write a byte on the LCD at cursor position ************************************************************/ void LCDWriteChar(char byte) { char tmp; tmp = byte & 0xf0; tmp = tmp >> 4; tmp += 0x30; if (tmp > 0x39) tmp += 0x07; LCDWriteData(LCD_DATA,tmp); tmp = byte & 0x0f; tmp += 0x30; if (tmp > 0x39) tmp += 0x07; LCDWriteData(LCD_DATA,tmp); } /*********************************************************** Name: void LCDWriteString(char *ptr) Description: Write a string from RAM on the LCD Input: string pointer ************************************************************/ void LCDWriteString(char *ptr) { unsigned char i; 8051SM-10x15 Manual Page 21
  • 22. for (i=1;i<41;i++) { if (*ptr == 0x00) break; LCDWriteData(LCD_DATA,*ptr++); } } /************************************************************ Name: void LCDWriteConstString(const char *ptr) Description: Write a constant string on the LCD Input: string pointer **************************************************************/ void LCDWriteConstString(const char *ptr) { unsigned char i; for (i=1;i<41;i++) { if (*ptr == 0x00) break; else if (i == 21) LCDGotoXY(1,2); LCDWriteData(LCD_DATA,*ptr++); } } /************************************************************** Name: void LCDWriteData(unsigned char rs, unsigned char ch) Description: Write a byte in rs of the LCD Input: rs -> Register select ch -> byte to write ***************************************************************/ void LCDWriteData(unsigned char rs,unsigned char ch) { unsigned char Stat; Stat = LCD_PORT & LCD_BACKLIGHT; LCD_PORT = Stat; LCDWait(); if ((ch & 0x80) == 0x80) LCD_PORT |= LCD_D7; if ((ch & 0x40) == 0x40) LCD_PORT |= LCD_D6; if ((ch & 0x20) == 0x20) LCD_PORT |= LCD_D5; if ((ch & 0x10) == 0x10) LCD_PORT |= LCD_D4; if (rs == 1) LCD_PORT |= LCD_RS; LCDDelay50us(1); LCD_PORT |= LCD_E; LCD_PORT &= ~LCD_E; LCD_PORT = Stat; if ((ch & 0x08) == 0x08) LCD_PORT |= LCD_D7; if ((ch & 0x04) == 0x04) LCD_PORT |= LCD_D6; 8051SM-10x15 Manual Page 22
  • 23. if ((ch & 0x02) == 0x02) LCD_PORT |= LCD_D5; if ((ch & 0x01) == 0x01) LCD_PORT |= LCD_D4; if (rs == 1) LCD_PORT |= LCD_RS; LCDDelay50us(1); LCD_PORT |= LCD_E; LCD_PORT &= ~LCD_E; } /********************************************************** Name: void LCDWait(void) Description: wait for the LCD to be ready ***********************************************************/ void LCDWait(void) { int i,j; for (i=0;i<20;i++) { for (j=1;j<120;j++); } } /********************************************************* Name: void LCDDelay50us(int Delay) Description: Delay of 50 us with a 16Mhz resonator Input: Delay X x 50us **********************************************************/ void LCDDelay50us(int Delay) { int i,j; for (i=0;i<Delay;i++) { for (j=1;j<120;j++); } } /********************************************************** Name: void LCDTextAttr(unsigned char Attribute) Description: Set the LCD attribute Input: LCD_C_BLINK_ON : Cursor blink on LCD_C_BLINK_OFF : Cursor blink off LCD_C_ON : Cursor on LCD_C_OFF : Cursor off LCD_DISPLAY_ON : Display ON LCD_DISPLAY_OFF : Display OFF ************************************************************/ void LCDTextAttr(unsigned char attribute) { switch (attribute) { 8051SM-10x15 Manual Page 23
  • 24. case LCD_C_BLINK_ON: LCDStat |= LCD_C_BLINK_ON; LCDWriteData(LCD_CTRL,LCDStat); break; case LCD_C_BLINK_OFF: LCDStat &= LCD_C_BLINK_OFF; LCDWriteData(LCD_CTRL,LCDStat); break; case LCD_C_ON: LCDStat |= LCD_C_ON; LCDWriteData(LCD_CTRL,LCDStat); break; case LCD_C_OFF: LCDStat &= LCD_C_OFF; LCDWriteData(LCD_CTRL,LCDStat); break; case LCD_DISPLAY_ON: LCDStat |= LCD_DISPLAY_ON; LCDWriteData(LCD_CTRL,LCDStat); break; case LCD_DISPLAY_OFF: LCDStat &= LCD_DISPLAY_OFF; LCDWriteData(LCD_CTRL,LCDStat); break; case LCD_BACKLIGHT_ON: LCD_PORT |= LCD_BACKLIGHT; break; case LCD_BACKLIGHT_OFF: LCD_PORT &= ~(LCD_BACKLIGHT); break; } } /************************************************************* Name: void LCDOn(unsigned char X, unsigned char Y) Description: Initialize LCD in 4bit mode Input: unsigned char X -> X size unsigned char Y -> Y size **************************************************************/ void LCDInit(unsigned char X, unsigned char Y) { MaxX = X; MaxY = Y; LCDStat = 0x0c; LCD_PORT = 0x00; LCD_PORT = ~(LCD_D7+LCD_D6+LCD_D5+LCD_D4+LCD_E+LCD_RS+LCD_RW); LCD_PORT |= LCD_BACKLIGHT; 8051SM-10x15 Manual Page 24
  • 25. LCDDelay50us(340); LCD_PORT = (LCD_D5 + LCD_D4 + LCD_BACKLIGHT); LCD_PORT |= LCD_E; LCD_PORT &= ~LCD_E; LCDDelay50us(100); LCD_PORT |= LCD_E; LCD_PORT &= ~LCD_E; LCDDelay50us(100); LCD_PORT |= LCD_E; LCD_PORT &= ~LCD_E; LCDDelay50us(100); LCD_PORT = (LCD_D5 + LCD_BACKLIGHT); LCD_PORT |= LCD_E; LCD_PORT &= ~LCD_E; LCDDelay50us(100); if (Y == 1) LCDWriteData(LCD_CTRL,0x20); // 1 line else LCDWriteData(LCD_CTRL,0x28); // 2 line LCDWriteData(LCD_CTRL,0x0c); // Disp ON-Cur OFF-Blink OFF LCDWriteData(LCD_CTRL,0x01); // Clear display LCDDelay50us(50); LCDWriteData(LCD_CTRL,0x06); // Cursor INC Shift OFF } For more details visit: www.dicovermechatronics.blogspot.com Email: 2007.anish@gmail.com Cell: 09970825313 8051SM-10x15 Manual Page 25