节点文献

基于IEC61131-3标准的PLC底层开发

The PLC System Program Design Based on IEC61131-3

【作者】 李伟华

【导师】 张永德;

【作者基本信息】 北京化工大学 , 控制理论与控制工程, 2008, 硕士

【摘要】 IEC61131-3标准作为工业自动化控制系统编程语言的国际标准,其开放性和先进性得到了广泛关注和充分肯定。开发符合IEC61131-3标准的自动化产品意义重大,也是必要的。本文根据IEC61131-3标准定义的编程模型,实现了下位机系统程序设计和与上位机的通信功能。下位机采用ATmega64微处理器,实现了对上位机用户程序的装载和执行,包括串口通信、功能块的执行、用户变量的地址分配等。上位机基于Visual C++6.0开发了符合IEC61131-3编程标准的PLC用户编程环境程序。本课题使用的处理器采用了ATMEL公司的ATmega64单片机,软件开发环境采用了ICCAVR编译器和AVR Studio仿真器。在ICCAVR编写完成系统程序后,通过JTAG接口下载到PLC的FLASH存储区,并加密。下位机系统程序,对用户变量实现了动态分配,也就是根据用户使用的变量的个数分配内存空间。目前市场上多数PLC采用固定内存分配,即每款产品的不同类型的变量都有最大个数的限制,并分配固定的内存空间。与固定内存分配相比,动态分配内存既避免了用户编程时受到最大支持变量个数的限制,也节省了下位机内存空间。另外,下位机在装载上位机的用户程序的过程中,进行了指令扩展和代码转换,大大提高了PLC的运行速度。这两点是本课题的创新所在。为了便于读者理解和文章的完整性,本文首先对硬件和上位机用户编程环境做了简单介绍;后根据下位机系统程序流程依次介绍各个模块的设计。本课题按照预期设计思想完成了PLC下位机系统程序的开发,并下载到处理器中,在仿真情况下能够正常运行,达到了期望效果。

【Abstract】 As the standard of programming language of automation control system, IEC61131-3 standard is widely used and gains agreement. It’s very important to develop products based on this standard.Based on the content about programming module in IEC61131-3, develop the system program of PLC and the communication function with PC.The users’ programming environment is developed on Windows operating system and VC++, based on IEC61131-3 standard.The key technology has three parts. The first part is the design of physical hardware, which is finished by a hardware engineer. The second is the development of users’ programming environment, including edit window development, algorithm of translating ladder diagram to executive codes, and serial port communication. The two parts are introduced simply.The main part is the system program of PLC, which is the bridge of physical hardware and users’ program. The third part is the main point of this paper. The system program performed loading the users control program, users’ program explanation and execution, error application, interrupt response and so on.The CPU of PLC used was Atmega64 singlechip. The development tools were necessary, and I used the ICCAVR compiler and AVR Studio emulator. After finishing the system program of PLC under ICCAVR complier, download it to flash memory of PLC through JTAG interface.The system program finished dynamic storage allocation, locating the memeory based on the number of variables users used. Most PLCs adopted fixed storage allocation, allocating the memory by supportable maximum. Compared with fixed storage allocation, the dynamic storage allocation avoided the limitation of sullortable maximum to users, and save a lot of memeroy. On the other hand, the system program expanded the instructs and converted the codes from four bytes to six bytes, which increased the program execution speed.To good comprehension, the paper first introduced the hardware and users’ programming environment of PLC. Secondly, give a detailed introduction about the system program. The system programs were downloaded to the Atmega64 singlechip, and achieved the expectation effect in the emulation state.

  • 【分类号】TP273
  • 【被引频次】4
  • 【下载频次】373
节点文献中: 

本文链接的文献网络图示:

本文的引文网络