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

📄 lcddim.c

📁 OCM12232LCD的C驱动源码
💻 C
字号:
#include"config.h"

//************LCD底层函数

void LCD_Cls(void) //清屏
{LCD_Busy();
 RS=0;
 RW=0;
 DB=0x01;
 E=1;
 _nop_();
 _nop_();
 E=0;
}

void LCD_Screen(void) //屏幕开禁止光标
{LCD_Busy();
 RS=0;
 RW=0;
 DB=0x0c;
 E=1;
 _nop_();
 _nop_();
 E=0;
}

void LCD_Busy(void) //检测忙
{DB=0xff;
 RS=0;
 RW=1;
 E=1;
 while(BF==1);
 E=0;
}

void LCD_Write_Code(unsigned char CODE) //写字符
{LCD_Busy();
 RS=1;
 RW=0;
 DB=CODE;
 E=1;
 _nop_();
 _nop_();
 E=0;
}

void LCD_Addr(unsigned char ADDR) //显示位置
{LCD_Busy();
 RS=0;
 RW=0;
 DB=ADDR;
 E=1;
 _nop_();
 _nop_();
 E=0;
}

void LCD_Comm_Basic(void) //8位基本指令
{LCD_Busy();
 RS=0;
 RW=0;
 DB=0x30;
 E=1;
 _nop_();
 _nop_();
 E=0;
}

void LCD_Comm_Add(void) //8位扩展指令
{LCD_Busy();
 RS=0;
 RW=0;
 DB=0x34;
 E=1;
 _nop_();
 _nop_();
 E=0;
}

void LCD_Input(void) //显示光标
{LCD_Busy();
 RS=0;
 RW=0;
 DB=0x0f;
 E=1;
 _nop_();
 _nop_();
 E=0;
}

void LCD_Right_Mov(void) //光标右移
{LCD_Busy();
 RS=0;
 RW=0;
 DB=0x14;
 E=1;
 _nop_();
 _nop_();
 E=0;
}

void LCD_Left_Mov(void) //光标左移
{LCD_Busy();
 RS=0;
 RW=0;
 DB=0x10;
 E=1;
 _nop_();
 _nop_();
 E=0;
}

unsigned char LCD_Read_RAM(void) //读RAM
{unsigned char DATA;
 LCD_Busy();
 RS=1;
 RW=1;
 E=1;
 _nop_();
 DATA=DB;
 E=0;
 LCD_Busy();    //第二次读有效
 RS=1;
 RW=1;
 E=1;
 _nop_();
 DATA=DB;
 E=0;
 return(DATA);
}

unsigned char LCD_Read_Addr(void) //读位置参数
{unsigned char PLACE;
 LCD_Busy();
 RS=0;
 RW=1;
 E=1;
 _nop_();
 PLACE=DB;
 E=0;
 return(PLACE);
}



⌨️ 快捷键说明

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