C51 COMPILER V7.05   LCD                                                                   07/22/2011 16:19:10 PAGE 1   


C51 COMPILER V7.05, COMPILATION OF MODULE LCD
OBJECT MODULE PLACED IN lcd.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE lcd.c BROWSE DEBUG OBJECTEXTEND

stmt level    source

   1          //-----------------------------------------------------------------------------------------------------//
   2          // PROJECT NAME  -  LCD TEST
   3          // AUTHOR - BHAUSAHEB UDAGAVE
   4          // DATE OF ALTERED - 16/7/2011
   5          // HARDWARE - RFID KIT WITH P89V51RD2 BASED 
   6          // SOFTWARE - EMBEDDED C
   7          //-----------------------------------------------------------------------------------------------------//
   8          
   9          //----------------------------------HEADER Declarations--------------------------------------//
  10          #include <reg51.h>
  11          #include <string.h>
  12          //----------------------------------LCD Declarations--------------------------------------//
  13          void initlcd(void);
  14          void cmd_lcd(unsigned char command);
  15          void data_lcd(unsigned char data2lcd);
  16          void lcd_shortdelay(void);
  17          void delay_ms(unsigned int milliseconds);
  18          #define CLR_LCD cmd_lcd(0x01); delay_ms(5)
  19          #define RETURN_HOME_LCD cmd_lcd(0x02); delay_ms(5)  
  20          #define LCD_PORT P1
  21          
  22          sbit enable=P3^4;
  23          sbit regsel=P3^5;
  24          
  25          void data_mode(void);
  26          
  27          void printlcd(unsigned char *message, unsigned char row, unsigned char col);
  28          
  29          
  30          //----------------------------------MAIN PROGRAM--------------------------------------//
  31          
  32          void main(void)
  33          {
  34   1         initlcd();
  35   1         
  36   1         while(1)
  37   1         {
  38   2            data_mode();
  39   2         }
  40   1      }
  41          
  42          void data_mode(void)
  43          {
  44   1        // while(1)
  45   1        // {
  46   1            printlcd(" LCD TEST.. ", 0, 0);
  47   1            cmd_lcd(0x0C);
  48   1            delay_ms(1000);
  49   1                CLR_LCD;
  50   1                delay_ms(1000);
  51   1            RETURN_HOME_LCD;
  52   1        // }
  53   1      }
  54          
  55          void initlcd()
C51 COMPILER V7.05   LCD                                                                   07/22/2011 16:19:10 PAGE 2   

  56          {
  57   1         enable=0;
  58   1         delay_ms(20);
  59   1         cmd_lcd(0x30);
  60   1         delay_ms(5);
  61   1         cmd_lcd(0x30);
  62   1         cmd_lcd(0x30);
  63   1         cmd_lcd(0x38);
  64   1         cmd_lcd(0x08);
  65   1         CLR_LCD;
  66   1         cmd_lcd(0x06);
  67   1         cmd_lcd(0x0e);
  68   1      }
  69          
  70          void cmd_lcd(unsigned char command)
  71          {
  72   1         LCD_PORT=command;
  73   1         regsel=0;
  74   1         enable=1;
  75   1         enable=0;
  76   1         lcd_shortdelay();
  77   1      }
  78          
  79          void data_lcd(unsigned char databyte)
  80          {   
  81   1         LCD_PORT=databyte;
  82   1         regsel=1;
  83   1         enable=1;
  84   1         enable=0;
  85   1         lcd_shortdelay();
  86   1      }
  87          void printlcd(unsigned char *message, unsigned char row, unsigned char col)
  88          {
  89   1         cmd_lcd(0x80 + (0x40*row) + col);
  90   1         
  91   1         for(; *message; message++)
  92   1            data_lcd(*message);
  93   1         
  94   1      }
  95          
  96          void lcd_shortdelay(void)
  97          {
  98   1         unsigned char t=23;
  99   1         while(t--);
 100   1      }
 101             
 102          void delay_ms(unsigned int ms)
 103          {
 104   1         unsigned char t1;
 105   1         unsigned int t2;
 106   1      
 107   1         for(t1=0; t1<ms; t1++){
 108   2            for(t2=0; t2<711; t2++);
 109   2         }
 110   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    225    ----
   CONSTANT SIZE    =     13    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
C51 COMPILER V7.05   LCD                                                                   07/22/2011 16:19:10 PAGE 3   

   DATA SIZE        =   ----       5
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)
