已阅读5页,还剩2页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
D0.3D4.7t0.7171819202122324C1C2C3C4C5C6C7C8C1C2C3C4C5C6C7C8C8C1C2C3C4C7C6C5B2B13B2B3B4B5B6B7B8B8B6 B43B217524321 1781920A1A2A3A4A5A6A7A8T7T0T1T2T3T4T6T7T5T0T1T2T3T4T6T5D3D3D2D2D1D4D5D6D7 D7D4 D5 D6D1D0D0E1E2E3E4A1A2A3A4Z1Z0Z0Z1Z1Z0 Z2E6E7E8E5171819E1E324E56E78XTAL218XTAL119ALE30EA31PSEN29RST9P0./AD039P0.1/AD138P0.2/AD237P0.3/AD336P0.4/AD435P0.5/AD534P0.6/AD63P0.7/AD732P2.7/A1528P2.0/A821P2.1/A92P2./A1023P2.3/A124P2.4/A1225P2.5/A1326P2.6/A1427P1.01P1.2P1.23P1.34P1.45P1.56P1.67P1.78P3.0/RXD10P3.1/TXD1P3.2/INT012P3./INT113P3.4/T014P3.7/RD17P3.6/WR16P3.5/T115U180C31C130PC230PD034D13D232D331D430D529D628D727RD5WR36A09A18REST35CS6PA04PA13PA22PA31PA440PA539PA638PA737PB018PB119PB220PB321PB42PB523PB624PB725PC014PC115PC216PC317PC413PC512PC61PC710U2825AD03 Q02D14 15D27 Q26D38 39D413 Q412D514 515D617 Q616D718 719OE1LE1U374LS37A23BC21D0E118290112233445566778899101013124315146517U474154A23BC21D0E118290112233445566778899101013124315146517U574154 A23BC21D0E118290112233445566778899101013124315146517U674154A23BC21D0E118290112233445566778899101013124315146517U77415412 3 456910 8A02 B018A13 B117A24 B216A35 B315A46 B414A57 B513A68 B612A79 B71CE19AB/A1U974LS24512365489=7 +CON0ABCD1 2 43+8.8IN15IN27ENA6 OUT12OUT23ENB1 OUT313OUT414IN310IN412SENSA1SENSB15 GND8VS4VC9L298+36VU1NADD71463D5124D31029D1807E6RW5S4VS1D2VE3LCD1LM016L+5V/*/*兰州交通大学电子电工实验中心 */*2009-8-2*/*/#include“reg51.h“#include“intrins.h“#include“math.h“#include“absacc.h“#define PORTA XBYTE0x8500#define PORTB XBYTE0x8502#define PORTC XBYTE0x8504#define PORTC0 XBYTE0x8506#define nop _nop_()#define Right_RUN 1#define Left_RUN 0unsigned long RunSpeed=76;unsigned char RUNState=1;sbit RS=P20;sbit RW=P21;sbit E=P22;sbit P17=P17;bit flag=0;unsigned char xx=“speed(n/min):“;unsigned char SD=“76“;char state214=“direction:cw“,“direction:ccw“;unsigned char FLG,INMA=0;unsigned char t,s=0x01;unsigned int a;main()void OPJIAN();unsigned char JIAN();unsigned char JIANZHI();void speed();void SHOW_LCD();void show_state();void write1();void writ2(unsigned char i);void delay();void time();void busy();unsigned char i;i=0x90;PORTC0=i;i=0x01;TMOD=i;t=0x10;a=0x0f;TH0=0x10;TL0=0x0f;FLG=INMA; SHOW_LCD();show_state();EA=1;ET0=1;TR0=1;while(1)i=JIAN();if(i!=0)time();time();i=JIAN();if(i!=0)INMA=JIANZHI();OPJIAN();time();if(FLG!=INMA|flag=1) FLG=INMA;SHOW_LCD();show_state();flag=0;void SHOW_LCD()/*lcd 设置程序*/P1=0x38;write1();delay();P1=0x38;write1();delay(); P1=0x38;write1();delay();P1=0x01;write1();delay();P1=0x0f;write1();delay();P1=0x06;write1();delay();P1=0x0c;write1();void show_state()/*状态显示程序*/unsigned char i=0;P1=0x80;write1();while(xxi!=0)writ2(xxi);i+;delay();i=0;while(SDi!=0)writ2(SDi);delay();i+;P1=0xc0;write1();i=0;if(RUNState=Right_RUN)while(state0i!=0)writ2(state0i);i+;elseif(RUNState=Left_RUN)while(state1i!=0)writ2(state1i);i+;void write1()/*lcd 写控制字*/RS=0;RW=0;E=0;busy();E=1;voi
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
评论
0/150
提交评论