Follow us :

Chapter 1 Easy Programming Makes Better Project

time2017/04/28

The Easier Programming, the Better Project

Even though every software engineers in automation field are familiar to  software programming of PLC and HMI, there are some unexpected situation happens during operation. For example, instructions, formulas, parameters we programmed are all correct, there not exist external interference, and wiring and switch is normal, but the equipment does not work well, that is because of programming bug.

It requires a certain step in accordance with the preparation of a reasonable operating mechanism to quantify the process of programming, which improves the flexible of programming and decreases bugs to make equipment runs well.

SETP_Ⅰ、I/O Allocation——Logical allocation of I/O is the basic of programming

Allocate the same function of Input and output together, as below picture showed:

图片1

图片2

It is good for programming, convenient to search and easy for wiring.

X0、X1、Y0、Y1 can be reserved, if enough, for high speed counting and pulse output.

As for emergency stop button, stop button, forward, back, rise,up, external switch is recommended for closed contacts and open contacts in programming. As a result that the equipment will not cause damage because of switch problem.

The selection of Analog: current type is preferred. The on-site practicing proves that anti-jamming capability of current is almost 80% higher than Voltage.

If possible, select analog type to control the third party device, because the analog response speed is much greater than the communication response speed.

SETP_Ⅱ、Device Planning—–Excellent device planning is benefit to build stable projects

I do believe you have found that as for the same project, some programming are complicated and difficult to understand, but some are not, that it is because of different device planning that makes it different.

D0~D10 should be allocated to HMI system, such as writing address, screen display, language etc, as below picture showed:

图片3

图片4

D20~D99 should be allocated to communication, setting of special modules and constant for calculation, as below picture showed:

图片5

图片6

图片7

Others should begin with even and use floating operations, not only can improve the precision, but also avoid address conflicts and overlay (All Wecon HMI Series support floating points setting and display). Because the division operation integer or double integer exist remainder which occupies register, but floating can solve this problem. For example, the intermediate variable usage of D100~D999

图片8

图片9

In multi-axis control system, storage in each axis is recommended to separate

For example:D1000~D1999 are allocated to Y0.

D2000~D2999 are allocated to Y1.

D3000~D3999 are allocated to Y2.

D4000~D4999 are allocated to Y3.

图片10

图片11

D6000~D7999 are allocated to HMI date setting and display with remark of H indicating this part of register belongs to HMI. The address format should be 32bit floating which avoids conflicts with register.

图片12

The allocation of M device is the same with date register D, which should be well-organized.

图片13

Address writing is recommended by EXCEL table and imported to PLC project once finished. Wecon PLC Editor supports the import and export of device remarks.

Remark H for HMI, A for automation, * for variable and hidden access, which avoid conflicts and overlap, and also easy for future search and update.

Device planning like managing the storehouse, different dates should be programmed in certain area for different functions, so as to be tracked easily.