第一范文网 - 专业文章范例文档资料分享平台

关于单片机的毕业论文

来源:用户分享 时间:2025/6/9 12:26:28 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

临沂大学

4.3系统程序 C程序:

#include \#include \#include \

#define busy 0x80

#define uchar unsigned char #define uint unsigned int

sbit RS=P2^3; sbit RW=P2^4; sbit E=P2^5; sbit KEY1=P2^0; sbit KEY2=P2^1; sbit KEY3=P2^2;

uchar code tab[8]={0x02,0x06,0x04,0x0C,0x08,0x09,0x01,0x03}; uchar temp;

void delay(uchar k) { uint i,j;

for(i=0;i

for(j=0;j<60;j++)

25

临沂大学

{;} } }

void test_1602busy() {

P0=0xFF; E=1; RS=0; RW=1; _nop_(); _nop_(); while(P0&busy) { E=0; _nop_(); E=1; _nop_(); } E=0; }

void write_1602Command(uchar co) {

test_1602busy(); RS=0; RW=0; E=0;

26

临沂大学

_nop_(); P0=co; _nop_(); E=1; _nop_(); E=0; }

void write_1602Data(uchar Data) {

test_1602busy(); P0=Data; RS=1; RW=0; E=1; _nop_(); E=0; }

void init_1602(void) {

write_1602Command(0x38); delay(5);

write_1602Command(0x01); delay(5);

write_1602Command(0x06);

27

临沂大学

delay(5);

write_1602Command(0x0F); delay(5);

write_1602Command(0x0C); }

void DisplayOneChar(uchar X, uchar Y, uchar DData) { Y&=1; X&=15; if(Y)X|=0x40; X|=0x80;

write_1602Command(X); write_1602Data(DData); }

void display_1602(uchar *DData,X,Y) {

uchar ListLength=0; Y&=0x01; X&=0x0F; while(X<16) {

DisplayOneChar(X,Y,DData[ListLength]); ListLength++; X++; } }

28

搜索更多关于: 关于单片机的毕业论文 的文档
关于单片机的毕业论文.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c3pn6l3xe3947le04lla9_8.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top