Rapidly develop embedded applications using AWTK and AWPLC (2) - Zoumadeng

Publisher:EE小广播Latest update time:2022-10-19 Source: EEWORLDKeywords:AWTK Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

AWPLC is a PLC system independently developed by ZLG (compatible with IEC61131-3). This article uses a simple revolving lantern program to demonstrate how to use AWTK and AWPLC to quickly develop embedded applications.


background


AWTK stands for Toolkit AnyWhere. It is an open source GUI engine developed by ZLG. It is a universal GUI engine designed for embedded systems, WEB, various applets, mobile phones and PCs. It provides users with a powerful, efficient, reliable, easy-to-use GUI engine that can easily create cool effects.


AWPLC is a PLC system independently developed by ZLG (compatible with IEC61131-3). The runtime library (Runtime) of AWPLC is developed based on ZLG TKC and can be ported to any mainstream RTOS and embedded system. The integrated development environment (IDE) of AWPLC is developed based on AWTK and can run on Windows, MacOS and Linux systems. One of the main goals of AWPLC is to introduce the low-code development method of PLC into embedded software, thereby improving the development efficiency and reliability of embedded software.


Introduction


The revolving lantern is easy to implement, and it uses multiple function blocks such as shift and counter. PLC tutorials like to choose it as an example. This article uses a simple revolving lantern program to demonstrate how to quickly develop embedded applications using AWTK and AWPLC.


1. System composition


The system includes:


A button to trigger the next light to turn on.

8 LEDs. Light up in turn to create a revolving lantern effect.


2. Software simulation


Buttons and LEDs are simulated in software.



PLC Program


  1. Variable Definition



In this system, several variables need to be defined:


PB0 button. Mapped to the first digital input (%IX0.0).

LEDS 8 LEDs. Mapped to the first 8 digital (ie one byte) outputs (%QB0.0).


The specific configuration is shown in the figure below:


3.2 Function Block Diagram


Basic working principle: Circularly shift the constant 1 to the left. Each time the button is pressed, it shifts 1 bit to the left and writes the result to the LEDS variable. LEDS is an 8-bit unsigned integer (ie, one byte), corresponding to the first 8 digital outputs.

* Note that the data type of constant 1 must be specified as USINT (that is, 8-bit unsigned number) to ensure that the loop is performed according to 8 bits.


The specific implementation is shown in the following figure:


image.png


user interface


The application does not require programming. You can design the interface with AWTK Designer and bind the controls to the model. The following is an introduction to the binding method of controls and models. AWTK-MVVM is used here, and the data binding rules are exactly the same as AWTK-MVVM.


The model can use io, plc or io+plc. io can be used to bind IO variables, and plc can be used to bind program PLC internal variables.


Example:


ow v-model="io+plc" tr_text="AWPLC demo">

Since the symbol % has a special function in the program, when binding IO variables, replace % with _. For example, write %QX0.0 as _QX0.0.


Example:


Keywords:AWTK Reference address:Rapidly develop embedded applications using AWTK and AWPLC (2) - Zoumadeng

Previous article:Rapidly developing embedded applications using AWTK and AWPLC (1) - Temperature controller
Next article:Rapidly develop embedded applications using AWTK and AWPLC (3) - Timer

Latest Industrial Control Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号