资源描述:
《基于avr的移动小车通信与控制软件设计》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、摘要本文主要介绍了基于AVR的移动小车通信与控制软件设计。AVR单片机是ATMEL公司推出的世界上著名的高性能低功耗非易失性存储器和数字集成电路的一流半导体,它的EEPROM电可擦除技术、闪速存储器技术和质量、高可靠性的生产技术,在COMS器件生产领域中,ATMEL的先进设计水平、优秀的生产工艺及封装技术一直处于世界的领先地位。软件设计的核心芯片选用8位的AVR单片机ATmega32。采用C语言设计单片机应用系统程序,C语言具有良好的程序结构,适用于模块化程序设计。通过C语言编译器ICCAVR和集成开发环境AVRstudio编译和写入硬件。连接PC机
2、进行程序调试,按下键盘“m”“n”和空格键,在PC机中中能正确显示。按下键盘“上”“下”“左”“右”键,小车能按照键盘的指示,左转、右转,或者前进、后退。软件编程主要是依据PS/2键盘协议的,它是一种双向同步串行协议。每次数据线上发送一位数据并且每在时钟线上发一个脉冲就被读入。键盘可以发送数据到主机,而主机也可以发送数据到设备,但主机总是在总线上有优先权,它可以在任何时候抑制来自于键盘的通讯,只要把时钟拉低即可。所有数据安排在字节中,每个字节为一帧,包含了11-12个位。程序写入后,小车能按照键盘的指示正常运行。关键词:AVR单片机;移动小车;C语言
3、;PS/2键盘协议71AbstractThearticlemainlyintroducedbasedontheAVRtraversingcranecorrespondenceandthecontrolsoftwaredesign.TheAVRmicrocontrollerisintheworldwhichATMELCorporationpromotesthefamoushighperformancelowpowerlossnonvolatilestorageanddigitalintegratedcircuit'sfirst-classsemicon
4、ductor,itsEEPROMelectricitymaycleanthetechnology,dodgethefastmemorytechnologyandthequality,theredundantreliableproductiontechnology,intheCOMScomponentrealmofproduction,theATMELadvanceddesignhorizontal,theoutstandingtechniqueofproductionandthesealtechnologyhasbeenintheworldthele
5、adingposition.Softwaredesign'scorechipselects8-bitAVRmicrocontrollerATmega32.UsestheClanguagedesignmonolithicintegratedcircuitapplicationsystemprocedure,theClanguagehasthegoodprogramstructure,issuitableinthemodularizedprogramdesign.ThroughClanguagecompilerICCAVRandintegrateddev
6、elopmentenvironmentAVRstudiotranslatesandreadsinthehardware.窗体顶端ConnectsPCmachinetocarryontheprogramdebugging,pressesdownthekeyboard“m”“n”andthespacebar,candemonstratecorrectlyinPCmachine.Pressesdownthekeyboard“up”“down”“left”“right”thekey,thecarcandefertokeyboard'sinstruction,
7、advance,backlash,orleft-turn,right-turn.窗体底端ThesoftwareprogrammingismainlybasedonthePS/2keyboardprotocol,itsabidirectionalsynchronousserialprotocol.DataissentonebitatatimeontheDatalineandisreadoneachtimeClockispulsed.Thekeyboard/mousecansenddatatothehostandthehostcansenddatatot
8、hedevice,butthehostalwayshaspriorityoverthebusandcanin