/* this is lcd1602. */c module
# include "config. H"
# include "lcd1602. H"
Void LCD_Read_busy ()
{
Uchar busy;
LCD1602_DB=0 XFF;
LCD1602_RS=0;
LCD1602_RW=1;
Do
{
LCD1602_EN=1;
Busy=LCD1602_DB;
LCD1602_EN=0;
}
While (busy & amp; 0 x80);
}
Void LCD_Write_cmd uchar (CMD)
{
LCD_Read_busy ();
LCD1602_RS=0;
LCD1602_RW=0;
LCD1602_DB=CMD;
LCD1602_EN=1;
LCD1602_EN=0;
}
Void LCD_Write_dat uchar (dat)
{
LCD_Read_busy ();
LCD1602_RS=1;
LCD1602_RW=0;
LCD1602_DB=dat;
LCD1602_EN=1;
LCD1602_EN=0;
}
Void Init_LCD1602 ()
{
X38 LCD_Write_cmd (0);
LCD_Write_cmd (0 x0f);
LCD_Write_cmd x06 (0);
LCD_Write_cmd (0 x01);
}
Void LCD1602_Set_Cursor (uchar x, uchar y)
{
If (y)
X |=0 x40;
X |=0 x80;
LCD_Write_cmd (x);
}
Void LCD_Dis_STR (uchar x, uchar y, uchar * STR)
{//this is keil shows the location of the warning on the compiler this is line 66
LCD1602_Set_Cursor (x, y);
While (* STR!='\ 0')
{
Str++ LCD_Write_dat (*);
}
}
/* this is the main function module. The main c */
# define _MAIN_C
# include "config. H"
# include "lcd1602. H"
Void main ()
{
Init_LCD1602 ();
LCD_Dis_STR (6, 0, "Hello");
while(1);
}
/* this is about function declaration and definition statement config. H */
# # ifndef _CONFIG_H
# define _CONFIG_H
#include
#include
11059200 ul//# define MAIN_Fosc macro definition master clock HZ
//rename existing data type
Typedef signed int int16;//a 16-bit signed integer
Typedef signed char int8;//8-bit signed type
Typedef unsigned char uchar8;//8-bit unsigned type
Typedef unsigned char uchar;//8-bit unsigned type
Typedef unsigned int uint16;//a 16-bit unsigned type
Typedef unsigned int uint;//a 16-bit unsigned type
Typedef unsigned long uint32;//32-bit unsigned type
//hardware interface definition
/* * LCD1602 LCD pin/
# define LCD1602_DB P0
Sbit LCD1602_RS=P3 ^ 5;
Sbit LCD1602_RW=P3 ^ 6;
Sbit LCD1602_EN=P3 ^ 4;
# endif
/* this are some of the function declaration lcd1602 */
# # ifndef _LCD1602_H
# define _LCD1602_H
Void Init_LCD1602 ();//initialize the lCD1602
Void LCD_Dis_STR (uint uint x, y, uint * STR);//lcd1602 write string
Void LCD1602_Set_Cursor (uchar x, uchar y);//LCD1602 set the cursor position, according to
# endif