Created
December 29, 2016 12:42
-
-
Save jpdillingham/77f4e3286947eee67be4d4862c0897b4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dim Tags as TagGroup | |
Dim TagsInError as StringList | |
Dim Result as boolean | |
Dim ReadReasult as Integer | |
Dim Timeout as Long | |
' set timeout limit to now + 15 seconds | |
Timeout = Timer + 15 | |
Set Tags = CreateTagGroup(Me.AreaName) | |
'****************************************************** | |
' write a value to a tag | |
'****************************************************** | |
Tags.Add(<TagToWrite>) | |
Tags.Item(<TagToWrite>).PendingWriteValue = <NewValue> | |
Result = Tags.WritePendingValues(TagsInError) | |
if (Result) then | |
' write succeeded | |
else | |
' write failed. do something with TagsInError. or not. | |
end if | |
'****************************************************** | |
' read a value from a tag | |
'****************************************************** | |
Tags.Add(<TagToRead>) | |
Tags.Item(<TagToRead>).RefreshFromSource | |
Do While True | |
ReadResult = Tags.Item(<TagToRead>).Value | |
if (ReadResult > 0) Then Exit Do | |
If (Timer > Timeout) Then Exit Do | |
DoEvents | |
Loop | |
If (ReadResult = 1) Then | |
' read succeeded | |
Else | |
' read failed | |
End if | |
Set Tags = Nothing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you!