KeilC实训报告Word格式.docx

上传人:b****1 文档编号:15319664 上传时间:2022-10-29 格式:DOCX 页数:21 大小:99.86KB
下载 相关 举报
KeilC实训报告Word格式.docx_第1页
第1页 / 共21页
KeilC实训报告Word格式.docx_第2页
第2页 / 共21页
KeilC实训报告Word格式.docx_第3页
第3页 / 共21页
KeilC实训报告Word格式.docx_第4页
第4页 / 共21页
KeilC实训报告Word格式.docx_第5页
第5页 / 共21页
点击查看更多>>
下载资源
资源描述

KeilC实训报告Word格式.docx

《KeilC实训报告Word格式.docx》由会员分享,可在线阅读,更多相关《KeilC实训报告Word格式.docx(21页珍藏版)》请在冰豆网上搜索。

KeilC实训报告Word格式.docx

table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};

unsignedcharCount;

voiddelay10ms(void)

{

unsignedchari,j;

for(i=20;

i>

0;

i--)

for(j=248;

j>

j--);

}

voidmain(void)

Count=0;

while

(1)

{

P1=table[Count/10];

P2=table[Count%10];

if(P3_7==0)

delay10ms();

if(P3_7==0)

{

Count++;

if(Count==100)

{

}

while(P3_7==0);

}

}

2、计数器减

Unsignedcharcode

unsignedcharCount=0;

bitk=0;

voiddelay10ms(void)

unsignedchari,j;

for(i=20;

for(j=248;

}

while

(1)

{

if(Count>

=99||Count<

=0)

k=!

k;

delay10ms();

if(k==0)

Count++;

elseif(k==1)

{Count--;

}

if(Count==100)

{Count=0;

while(P3_7==0);

}

3.定时中断

屏幕截图

#include<

sbitP3_2=P3^2;

unsignedcharcodetable[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};

Count=0;

EX0=1;

EA=1;

{P1=table[Count/10];

P2=table[Count%10];

voidservice_int1()interrupt1

if(P3_2==0)

Count++;

{

Count=0;

while(P3_2==0);

4、中断加减

 

#include<

bitk=0;

voiddelay10ms(void)

{

voidmain(void)

P2=table[Count%10];

voidservice_int0()interrupt0

delay10ms();

if(P3_2==0)

if(k==0)

Count++;

elseif(k==1)

Count--;

if(Count>

=10||Count<

=0)

k=!

5、秒表

=20||Count<

k=~k;

}

voidservrce_int1()interrupt1

delay10ms();

if(k==0)

Count++;

}

elseif(k==1)

Count--;

6、LCD显示“A、B”

reg51.h>

intrins.h>

sbitRS=P2^0;

sbitRW=P2^1;

sbitE=P2^2;

sbitBF=P0^7;

voiddelay1ms()

for(i=0;

i<

10;

i++)

for(j+10;

j<

33;

j++);

voiddelay(unsignedcharn)

unsignedchari;

n;

delay1ms();

unsignedcharBusyTest(void)

bitresult;

RS=0;

RW=1;

E=1;

_nop_();

result=BF;

E=0;

returnresult;

voidWriteInstruction(unsignedchardictate)

while(BusyTest()==1);

RW=0;

P0=dictate;

voidWriteAddress(unsignedcharx)

WriteInstruction(x|0x80);

voidWriteData(unsignedchary)

RS=1;

P0=y;

voidLcdInitiate(void)

delay(15);

WriteInstruction(0x38);

delay(5);

WriteInstruction(0x0c);

WriteInstruction(0x06);

delay(5);

LcdInitiate();

WriteAddress(0x07);

WriteData('

A'

);

WriteAddress(0x40);

B'

六、时间显示

sbitset_H=P2^5;

sbitset_M=P2^6;

sbitset_S=P2^7;

unsignedcharhour=12,minite=0,second=0,mscnt;

for(j=0;

voidWriteInstruction(unsignedchardictate)

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 表格模板 > 调查报告

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1