一.课题名称:自动售货机的PLC控制二.概述图1所示为一自动售货机示意图,其工作要求如下:1.此售货机可投入1元、5元或10元硬币。2.当投入的硬币总值超过12元时,汽水按钮指示灯亮;当投入的硬币总值超过15元时,汽水及咖啡按钮指示都亮。3.当汽水按钮灯亮时,按汽水按钮,则汽水排出7s后自动停止,这段时间内,汽水指示灯闪动。4.当咖啡按钮灯亮时,按咖啡按钮,则咖啡排出7s后自动停止,这段时间内,咖啡指示灯闪动。5.当投入的硬币总值超过所需的钱数(汽水12元,咖啡15元)时,找钱指示灯亮,表示找钱动作,并退出多余的钱。咖啡按钮汽水按钮汽水咖啡找零指示找零口硬币入口图1自动售货机示意图三.设计任务及要求1.根据题意,设计该PLC控制系统。2.PLC选择及I/O及其它PLC元器件分配。3.选择电器元件,编制元件目录表。找钱、汽水及咖啡指示灯为6.3V指示灯。4.绘制梯形图。5.用计算机绘制主电路图、PLC控制电路图、电器元件布置图。6.编写设计说明书及设计小结。四.设计方案提示1.I/O地址X0:1元识别器X1:5元识别器X2:10元识别器X3:咖啡按钮X4:汽水按钮X5:复位按钮Y0:咖啡出口Y1:汽水出口Y2:咖啡指示灯Y3:汽水指示灯Y4:找钱指示灯Y5:找钱出口2.方案提示①硬币投入值的累加可采用计数指令,也可用INC加1指令或ADD加法指令。②汽水和咖啡选择可采用比较指令。摘要本设计自动售货机以三菱FX2N-48MR型PLC为核心,能实现售货机的自动售货功能,并能够长期稳定运行。本文介绍了自动售货机的基本原理以及工作流程,从硬件和软件上对系统进行了较详细的设计。在软件设计时以一次交易过程为例,把交易过程分为几个程序块,分别对程序块编写梯形图程序,最后完成了总个系统的设计,使所设计系统达到了设计要求。利用PLC控制的自动售货机提高了系统的稳定性,保证自动售货机能够长期稳定运行。关键词自动售货机;PLC;梯形图ABSTRACTThedesignofthevendingmachinewithMitsubishiFX2N-48MR-PLCasthecore,toachievetheautomaticvendingmachinesalesfunctions,andbeabletorunthelong-termstability.Thispaperintroducesthebasicprinciplesofthevendingmachine,aswellasworkflow,fromthehardwareandsoftwaresystemsforthemoredetaileddesign.Inthesoftwaretodesignacourseofdealing,forexample,thetransactionprocessisdividedintoseveralblocks,eachblockforthepreparationoftheladderprogram,lastmonthcompletedatotalsystemdesign,sothatthesystemdesignedtomeetthedesignrequirements.PLCcontroloftheuseofvendingmachinestoimprovethestabilityofthesystemtoensurethatvendingmachinesbeabletorunthelong-termstability.KeywordsVendingmachine;PLC;Ladderdiagram目录1绪论···························································································11.1自动售货机简介····································································11.2自动售货机的基本功能···························································12系统方案论证···············································································32.1PLC的特点···········································································32.2PLC控制自动售货机的优点······················································43系统硬件设计···············································································53.1系统的输入/输出信号及PLC选型··············································53.2I/O地址分配········································································53.3PLC控制外部接线电路····························································64系统软件设计···············································································74.1系统流程图···········································································74.2计币系统··············································································74.3比较系统和选择系统······························································84.4饮料供应系统·······································································94.5退币系统和复位系统······························································94.6系统总体PLC编程梯形图·······················································105结束语·······················································································11参考文献·························································································12致谢·······························································································1311绪论1.1自动售货机简介从自动售货机的发展趋势来看,它的出现是由于劳动密集型的产业构造向技术密集型社会转变的产物。大量生产、大量消费以及消费模式和销售环境的变化,要求出现新的流通渠道;而相对的超市、百货购物中心等新的流通渠道的产生,人工费用也不断上升;再加上场地的局限性以及购物的便利性等这些因素的制约,无人自动售货机作为一种必须的机器便应运而生了。从广义来讲投入硬币、纸币、信用卡等后便可以销售商品的机械,从狭义来讲就是自动销售商品的机械。从供给的条件看,自动售货机可以充分补充人力资源的不足,适应消费环境和消费模式的变化,24小时无人售货的系统可以更省力,运营时需要的资本少、面积小,有吸引人们购买好奇心的自身性能,可以很好地解决人工费用上升的问题等各项优点。自动售货机使用数量最多的国家主要是日本、美国、英国和韩国。从不同的种类来看,咖啡茶的自动售货机约占全部售货机的40%以上;另外,还有冰饮料自动售货机、听装饮料自动售货机、办公咖啡自动售货机和照片胶粘标签自动售货机、票类自动售货机、手机充电自动售货机、成人用品自动售货机、生活用品自动售货机、烟、方便面自动售货机等多种。自动售货机主要的设置场所包括学校、楼房、公共机关、地铁等,公共汽车站、公园、体育场、展示场、工厂等。运营自动售货机产业的公司在全国大约有800余个,而销售自动售货机原料、商品流通、机械销售的公司大约达到了1150个。1.2自动售货机的基本功能在实际生活中,我们见到的售货机可以销售一些简单的日用品,如饮料、常用药品和小的生活保健用品等。售货机的基本功能就是对投入的货币进行运算,并根据货币数值判断是否能够购买某种商品,并作出相应的反应。举一个简单的例子来说明,例如:售货机中有8中商品,其中01号商品(代表第一种商品)价格为2.60元,02商品为3.50元,其余类推。现投入1个1元硬币,当投入的货币超过01商品的价格时,01商品的选择按钮处应有变化,提示可以购买,其他商品同比。当按下选择01商品的价格时,售货机进行减法运算,从投入的货币总值中减去01商品的价格同时启动相应的电机,提取01号商品到出货口。此时售货机继续进行等待外部命令,如继续交易,则同上,如果此时不再购买而2按下退币按钮,售货机则要进行退币操作,退回相应的货币,并在程序中清零,完成此次交易。由此看来,售货机一次交易要涉及加法运算、减法运算以及在退币时的逻辑运算,这是它的内部功能。还要有货币识别系统和货币的传动来实现完整的售货、退币功能。自动售货机的工作流程图如图1.1所示。图1.1自动售货机工作流程图32系统方案论证本设计通过多种方案的比较和对照,并从PLC的特点与应用出发,选定了自动售货机PLC控制设计方案。2.1PLC的特点PLC是一种用于工业自动化控制的专用计算机,实质上属于计算机控制方式。PLC与普通微机一样,以通用或专用CPU作为字处理器,实现通道(字)的运算和数据存储,另外还有位处理器(布尔处理器),进行点(位)运算与控制。PLC控制一般具有可靠性高、易操作、维修、编程简单、灵活性强等特点。(1)可靠性:对可维修的产品,可靠性包括产品的有效性和可维修性。A.PLC不需要大量的活动元件和接线电子元件,它的接线大大减少,与此同时,系统的维修简单,维修时间短。B.PLC采用了一系列可靠性设计的方法进行设计,例如,冗余设计,断电保护,故障诊断和信息保护及恢复等,提高了MTBF,降低了MTTR使可靠性提高。C.PLC有较高的易操作性,它具有编程简单,操作方便,维修容易等特点,一般不易发生操作的错误。D.PLC是为工业生产过程控制而专门设计的控制装置,它具有比通用计算机控制更简单的编程语言和更可靠的硬件。采用了精简化的编程语言,编程出错率大大降低,而为工业恶劣操作环境设计的硬件使可靠性大大提高。E.在PLC的硬件方面,采用了一系列提高可靠性的措施。例如,采用可靠性的元件:采用先进的工艺制造流水线制造;对干扰的屏蔽、隔离和滤波等;对电源的断电保护;对存储器内容的保护等。F.PLC的软件方面,也采取了一系列提高系统可靠性的措施。例如,采用软件滤波;软件自诊断;简化编程语言等。(2)易操作性,PLC的易操作性表现在下列几个方面:A、操作方便对PLC的操作包括程序输入和程序更改的操作。大多数PLC采用编程器进行输入和更改的操作。编程器至少提供了输入信息的显示,对大中型的PLC,编程器采用了CRT屏幕显