How to convert multi bit IO to Integer (RC8/RC8A/COBOTTA)

Modified on Fri, 11 Oct at 8:12 PM

Please read our Legal Disclaimer before executing any steps on this article. 



Overview

  1. Determine which input bits (Port numbers) you want to convert into integer (DINT) format
  2. Use the DefIO command in your pacscript program to designate the variable type and bit location



Tools and Parts needed

  • Full version of Wincaps 3 software. 

Example


Note: 
The different parameters that are included within the DefIO command structure



You can enter almost any name for your tag here. If the tag name you entered is invalid then you will get an error when you check your syntax. When using this command it designates your “Tag Name” as an Integer data type.

In the above example it will take bit input (port #) 560 – 591 (starting port + 31 bits) and convert it into an integer and place that value into the local tag name you designated.

You can then reference this value through the local variable later in your program or you can transfer it to a Global variable to access in all programs. This copies the value into the Global Integer I20 



You can then see the input value under your variable list. You also have the option of putting a mask in if you only want to use a portion of the 32 bits to input into your integer. 



Placing the &B designates each bit in the integer to read status (1) or omit status (0). In the above example the top 8 bits of the 32 bit Integer is ignored and the value is determined only by the remaining bits flagged “1”.


When using the mask you must have a “1” or “0” designated for each bit of the corresponding data type. 


Note:
Masking does not work with Single (Real number) data type


You can also use this Integer conversion with output or internal IO bits. When using a mask with output IO keep in mind it does not actually mask the value of the variable you are referencing , only the value in the actual output bits.


Owner's Manual Reference

https://www.fa-manuals.denso-wave.com/en/usermanuals/000312/

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article