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

📄 lcdop.c

📁 程序实现LC75823驱动
💻 C
字号:
#define _LCD_INCLUDE
#include "include.h"

//=======================Pin Define==========================
sbit LcdCL = P1^0;
sbit LcdDI = P1^1;
sbit LcdCE = P1^2;

code BYTE CCBADDR[]={0x41};
code BYTE StrDispOther[]={0x00,0x00,0x00,0x00,0x00};//remains 5 bytes inclued DR SC BU
code WORD StrDisp[]={0x6301,0x6000,0x4718,0x1234,0x2345,//0~4
						0x0000,0x6000,0x4718,0x1234,0x2345,//5~9
						0x0000,0x6000,0x4718,0x1234,0x2345,//A~E
						0x0000,0x6000,0x4718,0x1234,0x2345,//F~J
						0x0000,0x6000,0x4718,0x1234,0x2345,//K~O
						0x0000,0x6000,0x4718,0x1234,0x2345,//P~T
						0x0000,0x6000,0x4718,0x1234,0x2345,//U~Y
						0x2345};//Z
						
WORD *DispDataPstr = StrDisp;	
//====================================================
void LcdSendOneByte(BYTE Data)
{
	BYTE DataBit;

	for (DataBit = 0; DataBit < 8; DataBit++)
	{
		LcdCL = 0;
		if (Data & 0x01) //LSB send first
			LcdDI = 1;
		else
			LcdDI = 0;
		LcdCL = 1;
		Data >>= 1;
	}
}

void LcdSend15Bits(WORD Data)
{
	BYTE DataBit;

	for (DataBit = 0; DataBit < 15; DataBit++)
	{
		LcdCL = 0;
		if (Data & 0x01) //LSB send first
			LcdDI = 1;
		else
			LcdDI = 0;
		LcdCL = 1;
		Data >>= 1;
	}
}

void LcdDisplay(WORD *DataPstr)
{
	BYTE ByteCount, *StrDataPstr;

	//CCBADDR = 0x41
	LcdSendOneByte(*CCBADDR);

	//send data display	
	LcdCE = 1; //enable Lcd chip
	for (ByteCount = 0; ByteCount < 8; ByteCount++)
	{
		LcdSend15Bits(*DataPstr);
		DataPstr++;
		if (DataPstr > StrDisp + 35)		//0 will behind the z
			DataPstr = StrDisp; 			
	}

	//send others include DR SC BU
	StrDataPstr = StrDispOther;
	for (ByteCount = 0; ByteCount < sizeof(StrDispOther); ByteCount++)
	{
		LcdSendOneByte(*StrDataPstr);
		DataPstr++;
	}	

	LcdCE = 0; //disable Lcd chip
}

void LcdRollOver(BYTE RollFlag)
{
	LcdDisplay(DispDataPstr);
	if (RollFlag == LEFT)
	{
		DispDataPstr++;
		if (DispDataPstr > StrDisp + 35)
			DispDataPstr = StrDisp;
	}
	else
	{
		DispDataPstr--;
		if (DispDataPstr < StrDisp)
			DispDataPstr = StrDisp + 35;
	}
}

⌨️ 快捷键说明

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