⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jm12864m.c

📁 LCD 人机界面 用61单片机做的,请大家指点下
💻 C
字号:
//*========================================================
//* 函数名称: LCD_Set_xy(unsigned char x,unsigned char y)   
//* 函数功能: 确定LCD显示的位置                             
//* 入口参数: x:LCD水平坐标,0-----------7(字节)                  
//*           y:LCD垂直坐标,0-----------3(字节)                  
//*========================================================
void LCD_Set_xy(unsigned char x,unsigned char y)
 {
    unsigned char address;
	switch(y)
	{
		case 0:
	   			address = 0x0080 + x;   //第一行地址为:0x0080----0x0087
	    		break;                  
    	case 1:
	    		address = 0x0090 + x;   //第二行地址为:0x0090----0x0097
				break;
		case 2:
				address = 0x0088 + x;   //第三行地址为:0x0088----0x008F
				break;
    	case 3:
				address = 0x0098 + x;   //第四行地址为:0x0098----0x009F
				break;
		default:
				address = 0x0080 + x;   //默认第一行
	}
    	LCD_W_Command(address);
 }
//*========================================================
//* 函数名称: LCD_Print_String(unsigned char *str)          
//* 函数功能: 显示一个字符串                               
//* 入口参数: *str:字符串指针                              
//*========================================================
 void LCD_Print_String(unsigned char *str)
 {  
    unsigned char x;
    while( (*str)!='\0' )
    {  
       x=*str;
       LCD_W_Data(x);
       str++;
    }
 }
//*========================================================
//* 函数名称: LCD_Print_xyString(unsigned char X,unsigned char Y,unsigned char *str) 
//* 函数功能: 在特定的位置显示一个字符串                                             
//*========================================================
 void LCD_Print_xyString(unsigned char X,unsigned char Y,unsigned char *str)
{
	LCD_Set_xy(X,Y);
	LCD_Print_String(str);
}
//*========================================================
//* 函数名称: LCD_Initial(void)                                                          
//* 函数功能: 初始化LCD,进行功能设定,                                                
//*========================================================
void LCD_Initial(void)
{
   Set_LCD_Control_Output();			//设置LCD的控制口为输出
   LCD_W_Command(0x0030);            	//功能设定:基本指令
   LCD_W_Command(0x0018);            
   LCD_W_Command(0x0001);           	//清除显示器
   LCD_W_Command(0x000C);            	//模式设定:开显示,关光标,不闪烁
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -