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

📄 t6963.c

📁 DJ出品程序 :T6963显示程序 调用内部字库显示 已经经过调试 mcu:stc
💻 C
字号:
/**************************************************************************************/
/*函数 ST01(void)
  功能  判断STA1,STA0
/**************************************************************************************/
void  ST01()		// 状态位STA1,STA0判断(读写指令和读写数据)
{
	do
	{
	}
	while(!(lcmcw & 0x03));
}

/**************************************************************************************/

/**************************************************************************************/
void ST3(void)		// 状态位ST3判断(数据自动写状态)
{
	do
	{
	}
	while(!(lcmcw & 0x08))	;
}

/**************************************************************************************/

/**************************************************************************************
void  ST6(void)		// 状态位ST6判断(屏读/屏拷贝状态)
{
	do
	{
	}
	while(!(LCMCW & 0x40))	;
}
/**************************************************************************************/
/*函数  WriteData(u8 uData)
  功能  写数据到LCD
  
/**************************************************************************************/
void Writedata1(u8 uData)		// 写数据
{
	ST3();
	lcmdw = uData;

}

/**************************************************************************************/
/*函数  Writedata2(u8 uCmd,u8 uPar1)
  功能  写单参数数据到LCD
  
/**************************************************************************************/
void Writedata2(u8 uPar1,u8 uCmd)	// 写单参数的指令
{
	ST01();
	lcmdw = uPar1;
    ST01();
	lcmcw = uCmd;
}
/**************************************************************************************/
/*函数  Writedata3(u8 uCmd,u8 uPar1,u8 uPar2)
  功能   写双参数的指令到LCD
  
/**************************************************************************************/
void Writedata3(u8 uPar1,u8 uPar2,u8 uCmd)	// 写双参数的指令
{
	ST01();
	lcmdw = uPar1;
	ST01();
	lcmdw = uPar2;
	ST01();
    lcmcw = uCmd;
}

/**************************************************************************************/
/*函数  WritedataUcmd(u8 uCmd,u8 uPar1)
  功能   写无参数的指令到LCD
  
/**************************************************************************************/
void WriteCmd(u8 uCmd)		// 写无参数的指令
{
	ST01();
	lcmcw = uCmd;
}

// 设置文本区当前地址
void SetTxtPos(u8 urow, u8 ucol)
{
	u16  iPos;
    iPos = urow * 20 + ucol;
	Writedata3(iPos ,iPos /256,LC_ADD_POS);
}
// 清屏
void LCD_Clear(void)
{
	u16  i,j;
    SetTxtPos(0,0);
	WriteCmd(LC_AUT_WR);				// 自动写
	for(j=0;j<300;j++)
	{
	 for(i=0;i<20;i++)
	 {
		ST3();
		Writedata1(0x00);				// 写数据
	 }
	}
	WriteCmd(LC_AUT_OVR);				// 自动写结束
	Writedata3(0x00,0x00,LC_ADD_POS);	// 重置地址指针
}

// LCM 初始化
void LCD_Init(void)
{
	Writedata3(0x00,0x00,LC_TXT_STP);   	// 文本显示区首地址
	Writedata3(30,0x00,LC_TXT_WID);    	// 文本显示区宽度   30
	Writedata3(0x00,0x08,LC_GRH_STP);    	// 图形显示区首地址
	Writedata3(30,0x00,LC_GRH_WID);	    // 图形显示区宽度   30个字节
	WriteCmd(LC_CUR_SHP|0x01);	    	    // 光标形状
	WriteCmd(LC_MOD_OR);				    // 显示方式设置
	WriteCmd(LC_DIS_SW|0x08);	        	// 显示开关设置
}

/****************************************************************************/
/*计算数组长度
****************************************************************************/
u8 len(u8 *s)
{
      u8  L = 0;   
      while( *s!='\0')   
      {   
         s++;   
         L++;   
      }   
       return   L;   
}

/***************************************************************************显示英文字符串
函数名称:LCD_Dis_CharStr()
功    能:能利用T9693C内部字符发生器CGROM,在液晶屏上显示西文数组
入口参数:x,y,stl stl为字符串
出口参数:无
说    明:x,y对应是字符在屏上的字符坐标
****************************************************************************
LCD_Dis_Char(u8 x,u8 y,u8 *stl)
{
    u8 i,stlen;
	stlen=len(stl);              //计算字符串长度
    SetTxtPos(x,y);		    	//设置地址
	for(i=0;i<stlen;i++)        
	{
    	Writedata2((stl[i]-0x20),LC_INC_WR);   //地址加一
	}
}


main()
{
     LCD_Init();
     LCD_Clear();
     LCD_Dis_Char(0,0,"abcd");   //显示abcd
     while(1);





}

⌨️ 快捷键说明

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