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

is there any free trial version available for step7 professional and wincc comfort v17. i searched and downloaded TRIAL Download STEP 7...
Replies
1
Views
69
Hello. I have a db which is 1000 INT, and this db is represented in WinCC as a raw data type set of 5x 400 Bytes. This set is read with a script...
Replies
1
Views
82
Hello Experts I am working on a project with WinCC Unified v16 PC system and want to create an option on the screen to export logs to the...
Replies
0
Views
70
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
109
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
85
Back
Top Bottom