novice calculation question.

briana banks

Member
Join Date
Jul 2005
Posts
242
Hi All

register REG of type integer.
i wish to know when each bit is "on" (or "off") by comparison of the total value.
each bit in the register represent a message on the HMI
i dont want create 16 HMI boolean tags.


Thanks
 
Last edited:
briana banks said:
Hi All

register REG of type integer.
i wish to know when each bit is "on" by the total value.

Thanks

Isn't the base of all calcs in binary? Take the integer and look at it in binary as each bit changes. You can look at any integer in a scientific calculator, even the one in Windows XX, in decimal then just click on binary to see what the individual bit word would be.
John
 
:confused:

I need a formula.it supposed to be : total value - 2^something...
i need to know when a certain bit in the register is "on" (or "off") by
the total value of the integer register.
 
Briana,

Starting with bit zero which has a decimal value of one when on, each subsequent bit is double the decimal value of the previous bit and this repeats for however many bits you have.
For example if bits 0, 1, and 2 were on your decimal value would be 7.

8 bit registers have a maximum decimal value of 255, 16 bit has a maximum decimal value of 65,535 etc.

Hope this helps.

Jon.
 
Starting with bit zero which has a decimal value of one when on, each subsequent bit is double the decimal value of the previous bit and this repeats for however many bits you have.
For example if bits 0, 1, and 2 were on your decimal value would be 7.

I know that...

Given the decimal value i want to know which bits are on, using
a formula to display or hide a message in the HMI.

i dont want to compare the given value to many constant values.
i need a formula.
 
AND the variable with a decimal value that represents the bit you are looking for. For instance if your message is visible when bit 3 is on, the expression would be "Variable AND 8".
 
If you use a message list object in the HMI this will display a different message for each bit that is on. Most HMIs have this object.
 
Ahhhh... now we know what you're wanting to do. If you're wanting help, it always helps to tell us exactly what you're wanting to do or what the problem is.

Depending on your HMI package, most of them can directly reference a specific bit in an analog register. That way you don't have to write the formula...

Which HMI are you using? Someone here will be able to tell you the specific format to use.
 
Hi,

Could be usefull to tell us which HMI-platform. Will there be several bits active at any given time? Will there be different messages for each decimal value?

Take for instance WinCC-Flex, it is rather easy to get 1 message per bit or 1 message at a time or multiple messages or 1 message per decimal value.

Not very hard to accomplish this and actualy no calculations needed.

Gief more info so we can provide a clearer answer.

Jeebs
 
post_new.gif
Today, 07:08 AM #6 danny.michael vbmenu_register("postmenu_221918", true);





THANKs DANY.
How can i forget such things...
 
wish someone would explain this for me

I got the idea that 16 tags needed created, normally this could be done with 16 bits. In this case was there a need to have 16 tags that pertain to a numeric value? If so why not compare the numeric value? i.e. if certain bits are on in a register it will relate to a numeric value.

I get the idea this HMI may be written in VB etc.; which was not mentioned and could/would make a big difference pertaining to responses.

Maybe it is me but sometimes the questions and/or answers are confusing.

May want to check out this thread: http://www.plctalk.net/qanda/showthread.php?t=28755&highlight=questions
 
Whoever you are (because your moniker is obviously.... well... ahem... 'muff said), see this thread:

http://www.plctalk.net/qanda/showthread.php?t=31707

Whether it saves you any work or not will depend on the application. The method shown in that thread (using RSView) is actually easier than creating 16 different tags, is easy to configure using the duplicattion tool, and at the same time it uses only one tag. I use this method when I am creating diagnostic screens that show the state of bits on an entire IO card or chassis.
 

Similar Topics

Hi, first time poster just wondering if anyone has any tips for a novice of the PLC world, I've worked with them a fair bit within schooling and...
Replies
9
Views
3,242
We're a used machinery merchant and have a Siemens PLC that has lost its program due to a dead battery. We have the software to download but, at...
Replies
22
Views
6,554
Hi I’ve got a door and window switch from RS (190-1011) with a 4 core cabl - red, white, green, and yellow . The red and white are the switch and...
Replies
12
Views
1,317
I'm self taught so far, so hang with me as I try to explain my issue. I've got an archived program file for a PVP6 that I'm opening on FT ME ver...
Replies
13
Views
2,511
If 95% of our PLCs are AB (micro 1500, slc5/03,04 make up the bulk) what would be the language to learn to use scripting? Also to move towards...
Replies
8
Views
2,164
Back
Top Bottom