WinCC felxible VB access to TAGs

adner

Member
Join Date
May 2006
Location
Wroclaw
Posts
14
Hello,

does anybody know, how to access to single bit of TAG data type Word?

Instruction: SmartTags("TagName") allow only to access whole word.

I want to make something similar like instruction SetBitInTag (but I want only to read one bit from TAG).

BR,
Piotr.
 
You can call the SetBitinTag from a script. By using the code helper you can use any functions or scripts.

Take a look at system functions in this attachment
 
Last edited:
I remember that I made some script for Citect to do just that.

Dont remember exactly how I did it, but it involved using word logic (AND, OR, XOR) to mask out the non relevant bits and then comparing with 1 for bit 0, 2 for bit 1, 4 for bit 2, 8 for bit 3 etc.
 
hmmm...
in WinCC flexible? I want to do it as simple, as it is possible (I've limited no of lines in VB script - 50 lines in TP270).
 
adner said:
But how to get information about single bit from Word TAG?

I don't use WinCC flexible, but maybe you could do something like this (just replace the "HMIRuntime.Tags" part). This function returns a True/False for the bit state 1/0:

Function BitState(Byref cTagName, Byval iBit)
Dim oTag
Set oTag = HMIRuntime.Tags(cTagName)
oTag.Read
BitState = (oTag.Value And 2^iBit) > 0
Set oTag = Nothing
End Function
 
If we are talking about just one or two words, then a quick-and-dirty way to do it is to create a number of bool tags that point to the same addresses in the PLC as the word tag.
Of course, this isnt useful if you are after processing many words.

edit:
To get more functionality, for use in scripts for example, then create a boolean array tag.
You can access the individual tag in the array like this:

For example "My_bool_array(n)" where "n" is the number of each individual cell in the array.
 
Last edited:
unfortunatelly I've lots of this signals. And... I've limitation in no of lines in script. So... I've to write some smart function.
 
I have kept out of this thread because I don't use WinCC Flex, but I do use WinCC. So I am wondering if WinCC Flex is that much different that you can't access a bit in a word or double word tag like you can in WinCC?

You would do this by selecting 'dynamic dialogue', then 'Bit', assign the tag, than select the bit within the tag, can't you do that in Flex?

Paul
 
There is a similar function "SetBitInTag".

There are a number of ways to access many bits in different tags.
I think that Adner should describe what it is that he want to achieve. Then we can help him better.
 
:)
I want to read one bit from TAG type WORD. But I need some similar function like SetBitInTag... but ReadBitInTag.
 
What is it that you want to achieve in the end ?

What we have discussed so far are just methods to achieve what you want to do.

So far, my best bet is to setup a boolean array tag. You can then access the individual bits in a script that doesnt take up much memory.
You can also access the individual bits for use in animations in screens and such with no need for any script code.
 

Similar Topics

Does anyone happen to know how to install the graphic picture in HMI when I go into blower selection there are no graphics shown not only blower...
Replies
1
Views
63
Hi folks, I'm not as accustom with Siemens & WinCC, however I've been asked to increase the amount of data an existing application is logging...
Replies
2
Views
65
I have created a project in TIA Portal v16 Upd6 with S7-1200 (6ES7214-1AG40-0XB0) and WinCC Unified (PC station). The communication between the...
Replies
4
Views
145
I am creating a project with WinCC Unified v16 Upd6 (PC runtime) with an S7-1200. The communication is good between the PC and the PLC as I can...
Replies
6
Views
191
hello s7-400h and wincc are connected to each other via Ethernet. I need help on how to do time synchronization
Replies
0
Views
54
Back
Top Bottom