10/1/2015 5:19 PM | |
Joined: 9/23/2005 Last visit: 4/29/2024 Posts: 4325 Rating: (1426) |
“Simple Samples” are small projects that demonstrate simple features. The target is give a quick overview about the theme and be used as start point for related discussions. Follow there are a short description and the configuration main steps.
Description:
By clicking on button a Boolean variable is inverted (true - false). To invert a bit could be easily adapted for other simple script tasks (set bit, reset bit, set value, etc.). It is also base of many other simple samples.
Requirements: WinCC V7.3.
Configuration main steps:
VB Script (direct read / write)
Sub OnClick(Byval Item)
HMIRuntime.tags("HMI_Tag_1").write (1 - HMIruntime.Tags("HMI_Tag_1").read)
End Sub
VB Script (“object manipulation”)
Sub OnClick(Byval Item)
Dim MyTag Set MyTag = HMIRuntime.Tags("HMI_Tag_1")
MyTag.Read MyTag.Value = 1 - MyTag.Value MyTag.Write
End Sub
C Script
#include "apdefap.h" void OnClick(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName) { // WINCC:TAGNAME_SECTION_START // syntax: #define TagNameInAction "DMTagName" #define MyTag "HMI_Tag_3" // next TagID : 1 // WINCC:TAGNAME_SECTION_END
// WINCC:PICNAME_SECTION_START // syntax: #define PicNameInAction "PictureName" // next PicID : 1 // WINCC:PICNAME_SECTION_END
SetTagBit(MyTag, !GetTagBit(MyTag));
}
References: Portal SIMATIC WinCC in Online Support https://support.industry.siemens.com/cs/br/pt/view/93906404/en
Manual WinCC V7.3: Working with WinCC https://support.industry.siemens.com/cs/ww/en/view/102754925
WinCC V7.3 Scripting: VBS, ANSI-C, VBA https://support.industry.siemens.com/cs/ww/en/view/102777678
Application and tools Demo projects for SIMATIC WinCC V7.3 https://support.industry.siemens.com/cs/br/pt/view/93148272/en
Example Blocks for WinCC V7 and STEP 7 V5 (for S7-300 with SCL and S7-400 with CFC, SCL) https://support.industry.siemens.com/cs/br/pt/view/68679830/en
Example blocks for WinCC V7 and STEP 7 (TIA Portal) (for S7-1200 and S7-1500 in SCL) https://support.industry.siemens.com/cs/br/pt/view/31624179/en
Project: Due a size / format restrictions, the project are first compacted with 7z format (project.z7) and after that attached to a zip archive (data.zip).
AttachmentData.zip (426 Downloads) |
Denilson Pegaia |
|
This contribution was helpful to7 thankful Users |
Follow us on