#include <AT89X51.h>
#include <stdio.h>
#include <math.h>
#define uc unsigned char
#define ui unsigned int
#define LCDPAGE 0xB8 //设置页指令。
#define LCDLINE 0x40 //设置列指令。
sbit E= P3^5;
sbit RW=P3^4;
sbit RS=P3^2;
sbit L=P3^1; //左半平面
sbit R=P3^0; //右半平面
sbit Busy=P2^7;// //忙 判断位
uc scan_key1,scan_key2; //按键功能选择,00 停止,01 正转 10 反转
uc step1;step2;
static step_index;
ui count1,count2; //定时
uc butter; //按键
static speed; //速度参数
//;本文件为16×16点阵中文字库文件,字的横向8点构成一字节,左边点在字节的高
//位,字符点阵四角按左上角→右上角→左下角→右下角取字
//;如你想在以后继续用HZDotReader打开文件,追加汉字点阵数据,请不要修改或增删所有注释
uc code JIANG[]=
{
//;江 CBDAD
0x10,0x60,0x01,0xC6,0x30,0x00,0x04,0x04,
0x04,0xFC,0x04,0x04,0x04,0x04,0x00,0x00,
0x04,0x04,0x7E,0x01,0x20,0x20,0x20,0x20,
0x20,0x3F,0x20,0x20,0x20,0x20,0x20,0x00,
};
uc code XI[]=
{
//;西 CCEF7
0x02,0xF2,0x12,0x12,0x12,0xFE,0x12,0x12,
0x12,0xFE,0x12,0x12,0x12,0xF2,0x02,0x00,
0x00,0x7F,0x28,0x24,0x22,0x21,0x20,0x20,
0x20,0x21,0x22,0x22,0x22,0x7F,0x00,0x00,
};
uc code LI[]=
{
//;理 CC0ED
0x44,0x44,0xFC,0x44,0x44,0x00,0xFE,0x92,
0x92,0xFE,0x92,0x92,0x92,0xFE,0x00,0x00,
0x10,0x10,0x0F,0x08,0x48,0x40,0x45,0x44,
0x44,0x7F,0x44,0x44,0x44,0x45,0x40,0x00,
};
uc GONG[]=
{
//;工 CB9A4
0x00,0x00,0x02,0x02,0x02,0x02,0x02,0xFE,
0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3F,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,
};
uc code DA[]=
{
//;大 CB4F3
0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x7F,
0xA0,0x20,0x20,0x20,0x20,0x30,0x20,0x00,
0x00,0x40,0x40,0x20,0x10,0x0C,0x03,0x00,
0x01,0x06,0x08,0x10,0x20,0x60,0x20,0x00
};
uc XUE[]=
{
//;学 CD1A7
0x40,0x30,0x10,0x12,0x5C,0x54,0x50,0x51,
0x5E,0xD4,0x50,0x18,0x57,0x32,0x10,0x00,
0x00,0x02,0x02,0x02,0x02,0x02,0x42,0x82,
0x7F,0x02,0x02,0x02,0x02,0x02,0x02,0x00,
};
uc code ZI[]= //自动化
{
0x00,0x00,0x00,0xF8,0x48,0x48,0x4C,0x4B,
0x4A,0x48,0x48,0x48,0xF8,0x00,0x00,0x00,
0x00,0x00,0x00,0xFF,0x44,0x44,0x44,0x44,
0x44,0x44,0x44,0x44,0xFF,0x00,0x00,0x00,
};
uc code DONG[]=
{
0x20,0x24,0x24,0xE4,0x24,0x24,0x24,0x20,
0x10,0x10,0xFF,0x10,0x10,0xF0,0x00,0x00,
0x08,0x1C,0x0B,0x08,0x0C,0x05,0x4E,0x24,
0x10,0x0C,0x03,0x20,0x40,0x3F,0x00,0x00,
};
uc code HUA[]=
{
0x80,0x40,0x20,0xF8,0x07,0x02,0x00,0x00,
0xFF,0xC0,0x60,0x30,0x1C,0x08,0x00,0x00,
0x00,0x00,0x00,0x7F,0x00,0x04,0x02,0x01,
0x3F,0x40,0x40,0x40,0x40,0x78,0x00,0x00,
};
uc code CHANG[]= //常
{
0x20,0x18,0x08,0x09,0xEE,0xAA,0xA8,0xAF,
0xA8,0xA8,0xEC,0x0B,0x2A,0x18,0x08,0x00,
0x00,0x00,0x3E,0x02,0x02,0x02,0x02,0xFF,
0x02,0x02,0x12,0x22,0x1E,0x00,0x00,0x00,
};
uc code YUN[]= //运
{
0x40,0x41,0xCE,0x04,0x00,0x20,0x22,0xA2,
0x62,0x22,0xA2,0x22,0x22,0x22,0x20,0x00,
0x40,0x20,0x1F,0x20,0x28,0x4C,0x4A,0x49,
0x48,0x4C,0x44,0x45,0x5E,0x4C,0x40,0x00,
};
uc code XING[]= //行
{
0x10,0x08,0x84,0xC6,0x73,0x22,0x40,0x44,
0x44,0x44,0xC4,0x44,0x44,0x44,0x40,0x00,
0x02,0x01,0x00,0xFF,0x00,0x00,0x00,0x00,
0x40,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,
};
uc code ZHENG[ ] =
{
/*正 CD5FD */
0x00,0x02,0x02,0xC2,0x02,0x02,0x02,0x02,
0xFE,0x82,0x82,0x82,0x82,0x82,0x02,0x00,
0x20,0x20,0x20,0x3F,0x20,0x20,0x20,0x20,
0x3F,0x20,0x20,0x20,0x20,0x20,0x20,0x00,
};
uc code ZHUAN[ ] =
{
/*转 CD7AA */
0xC8,0xA8,0x9C,0xEB,0x88,0x88,0x88,0x40,
0x48,0xF8,0x4F,0x48,0x48,0x48,0x40,0x00,
0x08,0x08,0x04,0xFF,0x04,0x04,0x00,0x02,
0x0B,0x12,0x22,0xD2,0x0E,0x02,0x00,0x00,
};
uc code FAN[ ] =
{
/*反 CB7B4 */
0x00,0x00,0xFE,0x12,0x72,0x92,0x12,0x12,
0x12,0x11,0x91,0x71,0x01,0x00,0x00,0x00,
0x40,0x30,0x4F,0x40,0x20,0x21,0x12,0x0C,
0x0C,0x12,0x11,0x20,0x60,0x20,0x00,0x00,
};
uc code TING[] =
{
/*停 CCDA3 */
0x80,0x40,0x20,0xF8,0x07,0x02,0x04,0x74,
0x54,0x55,0x56,0x54,0x74,0x04,0x04,0x00,
0x00,0x00,0x00,0xFF,0x00,0x03,0x01,0x05,
0x45,0x85,0x7D,0x05,0x05,0x05,0x03,0x00,
};
uc code ZHI[ ] =
{
/*止 CD6B9 */
0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,
0xFF,0x40,0x40,0x40,0x40,0x40,0x00,0x00,
0x40,0x40,0x40,0x40,0x7F,0x40,0x40,0x40,
0x7F,0x40,0x40,0x40,0x40,0x40,0x40,0x00,
};
uc code JIA[]= //加
{
0x00,0x08,0x08,0x08,0xFF,0x08,0x08,0xF8,
0x00,0xF8,0x08,0x08,0x08,0xF8,0x00,0x00,
0x40,0x20,0x18,0x07,0x00,0x20,0x40,0x3F,
0x00,0x7F,0x10,0x10,0x10,0x3F,0x00,0x00,
};
uc code SU[]= //速
{
0x40,0x42,0xCC,0x00,0x04,0xE4,0x24,0x24,
0xFF,0x24,0x24,0x24,0xE4,0x04,0x00,0x00,
0x40,0x20,0x1F,0x20,0x48,0x49,0x45,0x43,
0x7F,0x41,0x43,0x45,0x4D,0x40,0x40,0x00,
};
uc code JIAN[]= //减
{
0x00,0x02,0xEC,0x00,0xF8,0x28,0x28,0x28,
0x28,0x28,0xFF,0x08,0x8A,0xEC,0x48,0x00,
0x02,0x5F,0x20,0x18,0x07,0x00,0x1F,0x49,
0x5F,0x20,0x13,0x0C,0x13,0x20,0x78,0x00,
}; //输出空白区域
uc code BAI[]=
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
uc code DI[]= //低
{
0x40,0x20,0xF0,0x0C,0x07,0x02,0xFC,0x44,
0x44,0x42,0xFE,0x43,0x43,0x42,0x40,0x00,
0x00,0x00,0x7F,0x00,0x00,0x00,0x7F,0x20,
0x10,0x28,0x43,0x0C,0x10,0x20,0x78,0x00,
};
//////////////////函数声明 **************////////
//************************************************
void iniLCD(void);
void chkbusy(void);
void wcode(uc cd) ;
void wdata(uc dat);
void disrow(uc page,uc col,uc *temp);
void display( uc page,uc col,uc *temp);
void ground(step); //转步
void run1(); //正转
void run2();
void stop();
void delay(ui time);
//************************************
//**************LCD初始化 ***************
//*********************************
void iniLCD(void) //初始化
{ L=1;R=1;
wcode(0x38);
wcode(0x0f); //开显示 设置
wcode(0xc0); //设置显示启动为第一行
wcode(0x01); //清屏
wcode(0x06); //画面不动,光标右移。
}
//******************LCD判断忙的子程序**********
//**********************************************8
void chkbusy(void) // 测LCD忙状态
{
E=1; //使能LCD
RS=0; //读写指令
RW=1; //读
P2=0xff; //读操作前先进行一次空读操作 ,接下来才能读到数据
while(!Busy); //等待,不忙退出
}
//*****************************************
//*****************写指令代码*****************
//***********************************************
void wcode(uc cd) //写指令 代码
{
chkbusy(); //写等待
P2=0xff; //使能LCD
RW=0; //读禁止
RS=0; //输出 设置
P2=cd; //写数据代码
E=1; //以下两句产生下降沿
E=0; //
}
//*******************把显示数据写到内存单元中 *****************
void wdata(uc dat) //写显示数据
{
chkbusy(); //写等待
P2=0xff; //使能LCD
RW=0; //读禁止
RS=1; //输出 设置
P2=dat; //写数据代码
E=1; //以下两句产生下降沿
E=0; //
}
//***********************************************
//****************显示LCD程序********************
//*
荣华富贵8
- 粉丝: 223
- 资源: 7653
最新资源
- Python中的图像处理.zip
- Python中的一个简单区块链.zip
- Python中的网络分析.zip
- Python中的一个小词云生成器.zip
- springboot189基于SpringBoot电商平台的设计与实现.zip
- springboot189基于SpringBoot电商平台的设计与实现.zip
- Python中的在线机器学习.zip
- springboot190基于springboot框架的工作流程管理系统的设计与实现.zip
- springboot190基于springboot框架的工作流程管理系统的设计与实现.zip
- Python中的张量和动态神经网络,具有强大的GPU加速.zip
- Python中的音频指纹和识别.zip
- Python中数据结构和算法的最小示例.zip
- Python中近似近邻库的基准测试.zip
- Python中一个强大的SpiderWeb爬虫系统.zip
- RE2是一个快速、安全、线程友好的正则表达式引擎替代方案,可以回溯PCRE、Perl和Python中使用的正则表达式引.zip
- Python资源大全中文版包括Web框架网络爬虫模板引擎数据库数据可视化图片处理等由开源前哨和Python开发者微信公.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈