#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程序********************
//*
没有合适的资源?快使用搜索试试~ 我知道了~
Proteus单片机 步进电机(仿真实例).rar
共16个文件
bak:2个
pwi:1个
plg:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 178 浏览量
2023-04-15
18:52:52
上传
评论
收藏 47KB RAR 举报
温馨提示
免责声明:资料部分来源于合法的互联网渠道收集和整理,部分自己学习积累成果,供大家学习参考与交流。收取的费用仅用于收集和整理资料耗费时间的酬劳。 本人尊重原创作者或出版方,资料版权归原作者或出版方所有,本人不对所涉及的版权问题或内容负法律责任。如有侵权,请举报或通知本人删除。
资源推荐
资源详情
资源评论
收起资源包目录
Proteus单片机 步进电机(仿真实例).rar (16个子文件)
步进电机
motor.DSN 125KB
LCD_display_motor1
moter_and_LCD_display_Opt.Bak 996B
moter_and_LCD_display.hex 6KB
moter_and_LCD_display 17KB
moter_and_LCD_display.Uv2 2KB
moter_and_LCD_display.LIB 8KB
programe.c 14KB
programe.LST 25KB
moter_and_LCD_display.lnp 46B
moter_and_LCD_display.Opt 1KB
moter_and_LCD_display.plg 1KB
programe.OBJ 20KB
moter_and_LCD_display.M51 17KB
moter_and_LCD_display_Uv2.Bak 0B
Last Loaded motor.DBK 125KB
motor.PWI 1KB
共 16 条
- 1
资源评论
荣华富贵8
- 粉丝: 215
- 资源: 7653
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功