![]() |
||
|
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc. |
||
| ||
New Here? Please read this important info!!!
|
|
#1 |
|
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. |
|
|
|
#2 |
|
Member
![]() Join Date: Aug 2005
Location: Arkansas
Posts: 1,085
|
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 by CharlesM; July 8th, 2006 at 11:18 AM. |
|
|
|
#3 |
|
Member
![]() Join Date: May 2006
Location: Wroclaw
Posts: 14
|
OK. it's great.
But how to get information about single bit from Word TAG? |
|
|
|
#4 |
|
Lifetime Supporting Member + Moderator
|
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.
__________________
Jesper
|
|
|
|
#5 |
|
Member
![]() Join Date: May 2006
Location: Wroclaw
Posts: 14
|
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). |
|
|
|
#6 | ||
|
Member
![]() Join Date: May 2006
Location: Alberta
Posts: 49
|
Quote:
Quote:
|
||
|
|
|
#7 |
|
Member
![]() Join Date: Aug 2005
Location: Arkansas
Posts: 1,085
|
http://www.plctalk.net/qanda/showthread.php?t=16734
Look at this old post. It has code on how to break down a word into bits. |
|
|
|
#8 |
|
Lifetime Supporting Member + Moderator
|
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.
__________________
Jesper
Last edited by JesperMP; July 10th, 2006 at 12:47 PM. |
|
|
|
#9 |
|
Member
![]() Join Date: May 2006
Location: Wroclaw
Posts: 14
|
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.
|
|
|
|
#10 |
|
Member
|
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 are 10 types of people in this world.. Those who understand binary and those who don't! |
|
|
|
#11 |
|
Lifetime Supporting Member + Moderator
|
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.
__________________
Jesper
|
|
|
|
#12 |
|
Member
![]() Join Date: May 2006
Location: Wroclaw
Posts: 14
|
:-)
I want to read one bit from TAG type WORD. But I need some similar function like SetBitInTag... but ReadBitInTag. |
|
|
|
#13 |
|
Lifetime Supporting Member + Moderator
|
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.
__________________
Jesper
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Topics
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| WinCC with MS Access | shandra_ck | LIVE PLC Questions And Answers | 3 | February 6th, 2006 09:08 AM |
| WINCC and Internal Tags, how... | Combo | LIVE PLC Questions And Answers | 2 | December 15th, 2005 08:17 AM |
| WinCC project reading STEP 7 project symbol table | Pandiani | LIVE PLC Questions And Answers | 1 | August 11th, 2005 03:20 PM |
| WinCC 5.0 sp2, save tags in CSV problem | johnny | LIVE PLC Questions And Answers | 3 | May 26th, 2005 07:22 PM |
| Access to WinCC tags from VB application | mareki | LIVE PLC Questions And Answers | 0 | May 22nd, 2004 08:33 AM |