How to use the input/output field of WinCC to achieve this function

In the actual project application, the input of some key data needs to be promptly confirmed by the operator. As shown below:

figure 1

When the value 99 is entered in the input/output field and the carriage return is entered, the data is not immediately entered in the variable but a confirmation message window pops up. If you select “Yes” at this time, the data will be input to the corresponding variable. If you select “No”, the corresponding variable will keep the original value unchanged. The following describes how to use the input/output fields of WinCC to implement this function.

1. Prerequisites Create two variables of the same data type DisplayValue and TempValue, where DisplayValue is actually a variable to be controlled and TempValue is used as a temporary variable. As shown below:

figure 2

2. Input/output field property settings Create a new input/output field in the screen and open the properties dialog. Select Properties  Output/Input  Output Values. Right-click on the dynamic part, as shown in the following figure:

image 3

Open the dynamic dialog. Select the variable you want to control (in this case, the variable: DisplayValue) and configure the data type. As shown below:

Figure 4

3. Input/output domain event settings

3.1 Change Action Settings Select the same input/output field and open the Properties dialog box. Select Event  Attributes  Output/Input  Enter Value. Right-click on the Change Action section as shown below:

Figure 5

Open the Direct Connection dialog box. The source section is left at the default setting, and the target section is selected to connect directly to a temporary variable (in this case, TempValue ). As shown below:

Figure 6

3.2 Keyboard Release Action Settings Select the same input/output field and open the Properties dialog box. Select the event  Keyboard  Release and click the right mouse button in the Actions section, as shown in the following figure:

Figure 7

Open the C action editor. Write code to determine if the operator has finished typing and press Enter. As shown below:

Figure 8

The detailed code is as follows:

Int TempValue=GetTagWord("TempValue");

Char szBuffer[20];

Sprintf( szBuffer,"Input number:%d",TempValue);

If ( nChar==13 )//if press enter{int xRet = MessageBox(NULL,szBuffer,

"confirm window", MB_YESNO|MB_ICONQUESTION|MB_SYSTEMMODAL);

//messageif ( xRet == IDYES )//confirm operate{SetTagWord("DisplayValue",

TempValue);

// set data}
}

When the system is running, once the carriage return signal is detected in the input/output field, the system will pop up the confirmation window as shown in Figure 1.

New Energy Cable

New Energy Cable,4P Closed Wire,Computer Fan Connection Cable,Silicone Wire New Energy Cable

Dongguan ZhiChuangXing Electronics Co., LTD , https://www.zcxelectronics.com