⬆️ ⬇️

Programming of industrial automation interfaces

HMI (Human-Machine-Interface) is a broad concept encompassing engineering solutions that enable the operator to interact with the machines he manages. The term Human-Machine Interfaces refers to the whole range of control panels from radio tape recorders to pilot cabs. HMI panels are produced by almost all the giants of the electronics industry (Siemens, Motorolla, Mitsubishi). I'll show you what the development process for the Pro-Face GP2301 panel looks like.



Create one screen with buttons and lights, complicated by the requirements of the TZ. The development will be carried out in the native Pro-Face GP Pro environment, the program already has version number 7 and everything inside is very well thought out and polished that you can start developing based on the experience of visual programming under Windows.



This is what the window of the project manager looks like; now we need only one button - the [Screen] screen editor.





In the screen editor create a new screen like Base Screen.

')





On the newly created screen, add 5 buttons, which, when pressed, invert the bit to the specified address (0100). When specifying an address, the bits are set by simply adding the sequence number of the bit to the address:



All addressing is 16-bit, the bytes have to rake hands.







At the same address and bits we will tie up light bulbs that will light up when a certain bit is set at address 0100.







Now with the help of the Transfer utility and the COM cable, fill the project into the panel. Everything we have drawn before the fill is rasterized (yes yes that’s right, because all the primitives in the development environment are vector and stretch to any size perfectly) and are presented in the internal 64-color representation.







The process of pouring and test run can be viewed on the video.







As always, standard components, when used on practical tasks, are not suitable for any reason. It happened this time. According to the TOR, the buttons should not change the bits, but write down their number 0, 1, 2, 3, or 4 at the desired address. In the component libraries, there are such buttons, but there are only bulbs illuminating from the bits.



We will solve the problem as follows - the buttons will record their number at 0101, a special script will set the desired bit at 0100 in accordance with the fact that it is in 0101. We will not remove the existing buttons from the screen (let them remain to indicate where to click) and on top of them we put a transparent touch sensitive area, it is called the Touch Panel Input. As seen in the picture above the buttons, a transparent area appeared, indicated by a grid of dots. In the properties, we can choose a lot of interesting things, but we only need to set the 16 bit word at 0101. The number specified in the Constant field is recorded in memory.







The functionality of the development environment allows you to write small scripts, our panel is the simplest, it does not even know how to divide into fractional numbers and is limited only to integer mathematics, but there are models with a built-in mat processor and then the script can solve both trigonometry and statistics. The scripts are called D-Script and can be either global, or run when a specific screen is active. In the window for adding / editing a script there is a very handy toolbar on the left, and even a small helper in writing the code that occurs when we read the address in memory and helps to correctly draw the address to the memory cell.







In our example, the script runs from the timer every second and sets the bits in cell 0100, depending on the value in 0101. In addition to the timer, the script can be hung on:





our script is quite simple:

if ([w:0101]==0) {

[w:0100]=1

}

endif



if ([w:0101]==1) {

[w:0100]=2

}

endif



if ([w:0101]==2) {

[w:0100]=4

}

endif



if ([w:0101]==3) {

[w:0100]=8

}

endif



if ([w:0101]==4) {

[w:0100]=16

}

Endif



In principle, all that is required of us we have implemented. With the controller, the panel communicates via the COM port according to the RS232 or RS422 standard. The communication protocol itself depends on the controller; branded Siemens and others allow the panel to send interrupts to the controller and the panel does not work until it finds the controller. In our case, the Memory Link protocol is used, through which only the controller is active. The protocol allows the controller to read and write to the memory panel. eg:

[ESC] R 0100 - reads the contents at 0100, which will receive from the panel in response

[ESC] A FFFF - if written there FFFF



write command:

[ESC] W 0100, 000F - not affected in any way, so you have to read forcibly if control of the record is required.

Source: https://habr.com/ru/post/80990/



All Articles