In the actual project application, the input of some key data needs to prompt the operator to confirm the error before proceeding. As shown below:
figure 1
When you enter a value of 99 in the input/output field and press Enter, the data is not immediately entered into the variable, but a confirmation message window pops up. At this time, if you select "Yes" then 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 implement this function using the input/output fields of WinCC.
1. Prerequisites Create two variables of the same data type, DisplayValue and TempValue, where DisplayValue is the actual variable to be controlled and TempValue is used as a temporary variable. As shown below:
figure 2
2. The attribute settings of the input/output fields create a new input/output field in the screen and open the properties dialog. Select Properties ïƒ Output / Input ïƒ Output Value, right click on the dynamic part, as shown below:
image 3
Open the dynamic dialog. Select the variable you want to control (in this case the variable is: DisplayValue) and configure the data type. As shown below:
Figure 4
3. Input/output field event settings
3.1 Change Action Settings Select the same input/output field to open the Properties dialog box. Select Event ïƒ Attributes ïƒ Output / Input ïƒ Input Values, right click on the Change Actions section, as shown below:
Figure 5
Open the direct connection dialog. The source section remains at its default setting, and the target section selection is directly connected to the temporary variable (in this case: TempValue ). As shown below:
Figure 6
3.2 Keyboard Release Action Settings Select the same input/output field to open the Properties dialog box. Select Event ïƒ Keyboard ïƒ Release, right click on the action part, as shown below:
Figure 7
Open the C Action Editor. Write a code that determines if the operator has finished typing and presses 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, "confirmation window", MB_YESNO|MB_ICONQUESTION|MB_SYSTEMMODAL);//message
If ( xRet == IDYES )//confirm operate
{
SetTagWord("DisplayValue",TempValue);// set data
}
}
When the system is running, once a carriage return signal is detected in the input/output field, the system will pop up a confirmation window as shown in Figure 1.
4. Additional information:
Test environment for the above: Windows XP professional SP2+ WinCC V 7.0 SP1 ASIA. For a detailed description of the MessageBox function, please refer to the relevant documentation of Microsoft.
Rexroth Servo Motor Replacement
Rexroth Servo Motor Replacement technical advantages:
•Optional power-off brake protection
•High positioning accuracy, stable speed, improve production efficiency
•Easy to wire and lead out, reducing engineering difficulty and cost
•Highly integrated design, reducing installation complexity and saving space
•Customizable features in a variety of sports modes
•Provide application solutions and development kit support for various scenarios, shortening the user's development cycle
•Real-time fault monitoring and protection functions, including over-current, overload, over-voltage, under-voltage, overheating, overspeed, over-tolerance protection
Rexroth Servo Motor Replacement,Rexroth Servo Motor,Rexroth Servo Drive,Rexroth Servo Motor Repair
Kassel Machinery (zhejiang) Co., Ltd. , https://www.kasselservo.com