Sign in to follow this  
Followers 0
dcalderonv

RSView ME 4.0 bit masking

5 posts in this topic

Hello, Maybe you can help with this: I have an ME application where I have some HMI tags mapping device tags, and I need to get some individual bit values. e. g. The HMI tag named WORD123, addresses the PLC INT tag B20:0. for some animations I need to isolate bit 3 from that word, but when I try to apply a bitwise AND, I get errors saying than is not a valid floating point operation. When I do it with a HMI Memory tag, it works fine, but even declaring the HMI device tag as an uint, doesn't make it work. Do you know another way to do so, instead of creating PLC tags pointing direct to the device? Thanks in advance Best regards.

Share this post


Link to post
Share on other sites
If you wish to use bit 3 of a word you have set up, use the following syntax in the connections tab for the Tag / expression: {WORD123} & 8 for bit 0 it would be & 1, bit 1 it would be & 2 and so on (binary style)

Share this post


Link to post
Share on other sites
Tks ratcliffe, Actually, that's what Im trying to do, but it only works when the tag is a Memory tag, i. e, doesn't addressing a device tag. Another suggestion?

Share this post


Link to post
Share on other sites
If memory serves me correctly... to address bit 3 of the word you should be able to just specify the bit at the end of the word in the connections tab, for bit three it would be.. WORD123.3 EDIT: Have you tryed defining a Data Type other than default, you may want to try specifying this as an integer data type Edited by TechJunki

Share this post


Link to post
Share on other sites
I get it; you only want to define the tag WORD123 and use it both as a word and use the sub-element "bit 03" as a boolean value. As you've seen, you can't treat HMI Tags as SLC addresses and just add the bit number and use it as a boolean: "TAG123.3" isn't a valid tag. You could define an HMI Tag as a Discrete value and address it to B20:0/3. Or you could make your HMI tag an Integer data type and perform the expression "TAG123 & 8 = 8" to get a zero or a one depending on the value of Bit 03. Remember that performing a Bitwise AND just passes through the bit value at Bit 03 to the target expression value, which in this case would make it 8 (not 1). Add the Equal expression and you get a zero or one value. You have already seen that the Default datatype for Analog type tags is Floating Point, making Bitwise operations invalid. My choice would be to create a new HMI tag addressed directly to the Bit, instead of making RSView ME run it through both the HMI Tag database and the Expression engine. Edited by Ken Roach

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0