- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
超声波避障小车c程序(Ultrasonic obstacle avoidance car C program)
超声波避障小车c程序(Ultrasonic obstacle avoidance car C program)
The trigger signal / angle P3.0
Accept / signal pin p3.2
#include reg52.H / / device configuration file
#include intrins.h
Sbit TX=P3^0; / / trigger signal pin
Sbit K1=P3^4;
Sbit K2=P3^5;
Sbit PWM1=P3^6; //pwm signal output
Sbit PWM2=P3^7;
Static char click=0;
Unsigned, char, ZK1, ZK2;
Unsigned int time=0;
Unsigned int timer=0;
Unsigned char posit=0;
Unsigned long S=0;
Bit flag =0;
Unsigned char const discode[] ~0xC0 ={, ~0xF9, ~0xA4, ~0xB0, ~0x99, ~0x92, ~0x82, ~0xF8, ~0x80, ~0x90};
Unsigned, char, const, positon[3]={, 0x7F, 0xbf, 0xdf};
Unsigned char disbuff[4] 0,0,0,0 ={};
Void delay (void) / 0us error
{
Unsigned, char, a, b;
For (b=215; b0; b--)
For (a=45; a0; a--);
}
Void Display (void)
{
{P0=discode[disbuff[posit]];}
P2=positon[posit];
If (++posit=3)
Posit=0;
}
Void Conut (void)
{
Time=TH0*256+TL0;
TH0=0;
TL0=0;
S= (time*1.7) /100;
Disbuff[0]=S%1000/100;
Disbuff[1]=S%1000%100/10;
Disbuff[2]=S%1000%10%10;
}
Void, Timer2Interrupt ()
{
RCAP2H=0x0fe;
RCAP2L=0x33;
ET2=1; / / allow T2 timer interrupt
EA=1; / / open interrupt
TR2=1; / / T2 start timer
}
Void zd0 () interrupt 1
{
Flag=1;
}
The void zd3 () interrupt 3 //T1 interrupt is used to scan the digital tube and the 800MS boot module
{
TH1=0x0f8;
TL1=0x30;
Display ();
Timer++;
If (timer=400)
{
Timer=0;
TX=1; //800MS starts the module once
_nop_ ();
_nop_ ();
_nop_ ();
_nop_ ();
_nop_ ();
_nop_ ();
_nop_ ();
_nop_ ();
_nop_ ();
_nop_ ();
_nop_ ();
_nop_ ();
_nop_ ();
_nop_ ();
_nop_ ();
_nop_ ();
_nop_ ();
_nop_ ();
_nop_ ();
_nop_ ();
_nop_ ();
TX=0;
}
}
Void Timer2 (void) interrupt 5
{
TF2=0; / / T2 timer overflow interrupt when the user needs to clear the overflow flag
RCAP2H=0x0fe;
RCAP2L=0x33; / * * / recovery timer initial value
++click;
If (click=100) click=0;
If (click=ZK1)
PWM1=1;
Else
PWM1=0;
If (click=ZK2)
PWM2=1;
Else
PWM2=0;
}
Void main (void)
{
TMOD=0x19; / / T0 1, GATE=1;
TH0=0;
TL0=0;
TH1=0x0f8; //2MS timing
TL1=0x30;
ET0=1; / / T0 is allowed
您可能关注的文档
- 财务名词解释(Explanation of financial terms).doc
- 财务会计(financial accounting).doc
- 负离子臭氧(Negative ion ozone).doc
- 负能量食物(Negative energy food).doc
- 财务成本计量研究(Research on financial cost measurement).doc
- 财务会计新一轮税制改革问题研究会计再教育试题(A new round of tax reform in financial accounting).doc
- 财务指标汇总(Summary of financial indicators).doc
- 财产清查知识点(Property inventory knowledge points).doc
- 财务管理制度范本(Model of financial management system).doc
- 财务会计单项选择题(Individual choice of financial accounting).doc
- 超声波(Ultrasonic).doc
- 超声考试大纲(Ultrasonic examination outline).doc
- 超声波清洗机(Ultrasonic cleaning machine).doc
- 超声诊断2(Ultrasonic diagnosis 2).doc
- 超声的部分基础知识(Part of the basics of ultrasound).doc
- 超声诊断仪类型(Types of ultrasonic diagnostic apparatus).doc
- 超好看超搞笑的美国喜剧(Super good-looking super funny American Comedy).doc
- 超实用刀法刀功技巧大全(Super practical knife knife work skills Daquan).doc
- 超声造影(Contrast-enhanced ultrasound).doc
- 超导的魅力(The glamour of superconductivity).doc
文档评论(0)