資源簡介
ocmj4x8c顯示模塊手冊和驅動源碼,ocmj4x8c-7模塊 89c51單片機

代碼片段和文件信息
/*****************************************************************************************************
?**??OCMJ4X8C-7驅動程序
?** ?開發者:?sunweiguo??
?**??時??間:?2009-09-29
?** ?在使用上遇到問題可以通過電子郵件的方式聯系[sunweiguo@yeah.net]
?*****************************************************************************************************/
#include?“lcdocmj4x8c.h“
/*******************************************************************************
?**?函數名稱:void?lcd_init()
?**?功能描述:設備初始化
?**?參數說明:無
?**?備 注:sunweiguo?2009-10-09
?*******************************************************************************/
void?lcd_init()
{
//復位
lcd_rst?=?LOW;
delay?(10);
lcd_rst?=?HIGH;
lcd_psb?=?HIGH;
lcd_en?=?LOW;
lcd_WriteCommand(0x34);//功能設定:8位控制接口,擴充指令集
????lcd_WriteCommand(0x30);//功能設定:8位控制接口,基本指令集???
????lcd_WriteCommand(0x01);//清楚顯示
????lcd_WriteCommand(0x06);//點設定:光標右移,整體顯示不移動
lcd_WriteCommand(0x0c);//睡眠模式:脫離睡眠模式
return;
}
/*******************************************************************************
?**?函數名稱:void?lcd_busy()
?**?功能描述:設備忙標志
?**?參數說明:無
?**?備 注:sunweiguo?2009-10-09
?*******************************************************************************/
void?lcd_busy()
{
lcd_data?=?0xff;
lcd_rs?=?LOW;
lcd_rw?=?HIGH;
lcd_en?=?HIGH;
while(lcd_busy_flag);
lcd_en?=?LOW;
return;
}
/*******************************************************************************
?**?函數名稱:void?lcd_clear()
?**?功能描述:清除屏幕內容
?**?參數說明:無
?**?備 注:sunweiguo?2009-10-09
?*******************************************************************************/
void?lcd_clear()
{
lcd_WriteCommand(0x01);
return;
}?
/*******************************************************************************
?**?函數名稱:void?lcd_dispString(uchar?row?uint?speed?uchar?*msg)
?**?功能描述:在屏幕上顯示字符串
?**?參數說明:1?row:行號;?2??speed:顯示速度;?3??*msg:顯示內容
?**?備 注:sunweiguo?2009-10-09
?*******************************************************************************/
void?lcd_dispString(uchar?row?uint?speed?uchar?*msg)
{
uchar?l_row=0;
//地址轉換
switch(row)
{
case?0:?l_row=0x80;?break;
case?1:?l_row=0x90;?break;
case?2:?l_row=0x88;?break;
case?3:?l_row=0x98;?break;
}
//定位顯示地址
lcd_WriteCommand(l_row);
//寫顯示數據
while?(*msg)
{
???lcd_WriteData(*msg++);
???delay(speed);
}
return;
}
?
?
?/*******************************************************************************
??**?函數名稱:void?lcd_WriteCommand(uchar?Command)
??**?功能描述:向LCD寫命令字符
??**?參數說明:1??Command:命令字符
??**?備 注:sunweiguo?2009-10-09
??*******************************************************************************/
void?lcd_WriteCommand?(uchar?Command)
{
????//設備忙判斷
lcd_busy();
lcd_rs?=?LOW;
lcd_rw?=?LOW;
lcd_en?=?LOW;
lcd_data?=?Command;
//使能設備
lcd_en?=?HIGH;
delay(5);
lcd_en?=?LOW;
return;
}
/*******************************************************************************
?**?函數名稱:void
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????4752??2009-11-13?09:07??lcdocmj4x8c.c
?????文件???????4046??2009-11-13?09:07??lcdocmj4x8c.h
?????文件????1728956??2009-09-30?17:04??ocmj4x8c.pdf
-----------?---------??----------?-----??----
??????????????1737754????????????????????3
- 上一篇:NS2 TCL腳本
- 下一篇:飛客蠕蟲病毒專殺工具
評論
共有 條評論