|
/*------------------------------------------------------------------------------------------
[文件名] 12232.c
[版本] V1.5
[作者] 鞠春阳
[最后修改时间] 2003年5月12日
[版权所有] 哈尔滨众邦龙科技开发有限公司 www.mcuzb.com
[12232资料] 请到www.mcuzb.com下载
[程序说明] .h文件请在本站内搜索如果没有的话 可以到论坛留言所取
===========================================================================================*/
#include "reg51.h"
#include "intrins.h"
#include "absacc.h"
#include ".\inc\ASCII816.h" //标准ASCII码库
#include ".\inc\HZTable.h" //自制的汉字库
#include ".\inc\menu.h" //自制的菜单库
sbit LCD12232_A0=P3^3;
sbit LCD12232_RW=P3^1; //读写
sbit LCD12232_E1=P3^5; //片选1(Master)
sbit LCD12232_E2=P3^4; //片选2(slave)
#define LCD12232_DATA P1 //数据口
void ClearScreen(void);
/*----------------------------------------------------------------------------
调用方式:void OutMI(unsigned char i)
函数说明:发指令i到主窗口。(内函数,私有,用户不直接调用)
------------------------------------------------------------------------------*/
void OutMI(unsigned char i)
{
LCD12232_E2=0; //确认
LCD12232_A0=0;
LCD12232_RW=1;
LCD12232_E1=1; _nop_();
LCD12232_DATA = i;
while( LCD12232_DATA & 0x80 ); //busy?
LCD12232_E1=0; _nop_(); LCD12232_RW=0;
LCD12232_E1=1; _nop_(); LCD12232_DATA=i;_nop_();
LCD12232_E1=0; _nop_();
}
/*------------------------------------------------------------------------------
调用方式:void OutMD(unsigned char i)
函数说明:发数据i到主窗口。(内函数,私有,用户不直接调用)
-------------------------------------------------------------------------------*/
void OutMD(unsigned char i)
{
LCD12232_E2=0; //确
LCD12232_A0=0;
LCD12232_RW=1;
LCD12232_E1=1; _nop_();
LCD12232_DATA = i;
while( LCD12232_DATA & 0x80 );
LCD12232_E1=0; _nop_();LCD12232_A0=1;
LCD12232_RW=0;
LCD12232_E1=1; _nop_();
LCD12232_DATA=i; _nop_();
LCD12232_E1=0; _nop_();
}
*------------------------------------------------------------------------------
调用方式:void OutSI(unsigned char i)
函数说明:发指令i到从窗口。(内函数,私有,用户不直接调用)
-------------------------------------------------------------------------------*/
void OutSI(unsigned char i)
{
LCD12232_E1=0; //确认
LCD12232_A0=0;
LCD12232_RW=1;
LCD12232_E2=1; _nop_();
LCD12232_DATA = i;
while( LCD12232_DATA & 0x80 );
LCD12232_E2=0; _nop_();
LCD12232_RW=0;
LCD12232_E2=1; _nop_();
LCD12232_DATA=i; _nop_();
LCD12232_E2=0; _nop_();
}
/*------------------------------------------------------------------------------
调用方式:void OutSD(unsigned char i)
函数说明:发数据i到从窗口。(内函数,私有,用户不直接调用)
-------------------------------------------------------------------------------*/
void OutSD(unsigned char i)
{
LCD12232_E1=0; //确认
LCD12232_A0=0;
LCD12232_RW=1;
LCD12232_E2=1; _nop_();
LCD12232_DATA =i;
while( LCD12232_DATA & 0x80 );
LCD12232_E2=0; _nop_();
LCD12232_A0=1;
LCD12232_RW=0;
LCD12232_E2=1; _nop_();
LCD12232_DATA=i; _nop_();
LCD12232_E2=0; _nop_();
} /*--------------------------------------------------------------------------------------------------*/
//显示8*8点阵
//字模被竖着切分
//lin:行(0-3), column: 列(0-14)
//address : 字模区首地址
void Show88(unsigned char lin,unsigned char column,unsigned int address)
{
unsigned char i,j; if( column > 14) return; if( column OutSI( 0xB8 | lin); //设置显示行
OutSI( 0 ); //右屏
for(i=0; i 7) //8*8点阵都在右屏(Slave)
{ OutSI( 0xB8 | lin); //设置显示行
OutSI( column*8-61 );
for(i=0; i/*------------------------------------------------------------------------------------------------*/
//显示8*16字符
//旋转90度:字模被竖着切分
//lin:行(0-3), column: 列(0-15)
//character:字符代码(标准ASCII码)
void ShowChar(unsigned char lin,unsigned char column,unsigned char character)
{ lin=lin
/*------------------------------------------------------------------------------
调用方式:void LcdIni(void)
函数说明:12232点阵液晶初始化,开机后仅调用一次。
------------------------------------------------------------------------------*/
void InitLCD(void)
{
OutMI(0XE2);OutSI(0XE2);//复位
OutMI(0XAE);OutSI(0XAE);//POWER SAVE
OutMI(0XA4);OutSI(0XA4);//动态驱动
OutMI(0XA9);OutSI(0XA9);//1/32占空比
OutMI(0XA0);OutSI(0XA0);//时钟线输出
OutMI(0XEE);OutSI(0XEE);//写模式
OutMI(0XC0);OutMI(0X00);//显示起始行为0,列地址为0
OutSI(0XC0);OutSI(0X00);//显示起始行为0,列地址为0
OutMI(0XAF);OutSI(0XAF); //开显示
ClearScreen();
} /*------------------------------------------------------------------------------
调用方式:void clrscr(void)
函数说明:清屏
------------------------------------------------------------------------------*/
void clrscr(void)
{
unsigned char i;
unsigned char page;
for( page=0;page62) {window=1;address=x%62;}
else address=x;
SetPage(page,page);
SetAddress(address,address);
if (window)
{
PutChar0(bmp);
}
else
{
PutChar1(bmp);// Master ,画上层
}
SetPage(page+1,page+1);
SetAddress(address,address);
if (window)
{
PutChar0(bmp[i+width]);
}
else
{
PutChar1(bmp[i+width]);//画下层
}
i++;
}
}
void ClearScreen(void)
{
unsigned char i;
unsigned char page;
for (page=0;page15) return; //!!编译器有问题,须强制退出
ShowChar(lin, i , byte);
i=i+1;
}
else // byte >= 0x80(汉字)
{
if(i>15) return; //!!编译器有问题,须强制退出
byte=byte & 0x7f; //最高位置0,即:减去0x8000
hzcode=(unsigned int)byte 14) return; if( column 7) //8*8点阵都在右屏(Slave)
{ OutSI( 0xB8 | lin); //设置显示行
OutSI( column*8-62 );
dat="ReadByte_2();
for(i=0;ivoid Reset() //液晶复位
{
_nop_(); _nop_();}
[/td]
[/tr]
|
|