FAQ: Can the decimal or binary value of multiple inputs be read and compared?
Breadcrumb
Contact Us
contactUsAction
There are eight local inputs in an MP940 system. In addition to viewing and using these bits individually, they can also be utilized using the I/O variable "Local_Input_Bank" for MotionWorks+ and the input word (IW00000 by default) for MotionWorks. This variable returns an integer value that corresponds to the bits that have been turned on. For instance, if bits 1, 3, 5, and 7 are on and all others off, then the register that holds these values is 10101010 in binary, which is 170 in decimal. Therefore, Local_Input_Bank=170 in that case.
Armed with this knowledge, special "tricks" can be used to isolate a smaller group of inputs for our use. To do this, the "Bitwise AND" comparator is used. The Bitwise AND comparison (MW+ uses '&' for this) converts integers to their binary equivalent and compares each bit individually. This requires using a mask to choose which bits to look at and which to ignore.
For instance, if the program requires the use of bits 3, 4, and 5 to choose one of eight index lengths, take the Local_Input_Bank variable and bitwise AND it with the mask 00111000 (bits 3-5 on, all others off). The result for bits 3, 4, and 5 will be whatever the input is for that bit, and the other bits will all be zero (anything ANDed with zero results in zero).
Result = ???????? & 00111000 = 00???000
For an example and more info see the attached .PDF document
SAFETY PRECAUTIONS AND INSTRUCTIONS FOR USE OF FAQ INFORMATION!
Please read and understand the product instruction manual before installing, servicing or operating Yaskawa products. FAQ content and illustrations are provided as technical advice to augment the information in manual, not supersede it. It is not possible to give detailed instructions for all types of installation or support activities. The information described in the FAQs are subject to change without notice to improve the product or FAQ. Yaskawa assumes no responsibility for errors or omissions or damages resulting from the use of the information contained in any FAQ. All warnings, cautions and product instruction for product use must be followed. Installation, operation and maintenance should be carried out by qualified personnel. Failure to observe these and other precautions highlighted in the product manuals will expose the user to high voltages resulting in, serious injury or death. Qualified personnel are defined as individuals who are familiar with the installation, starting, operation and maintenance of Yaskawa products of the type described and have proper qualifications to perform the work.
Phone
If you have an urgent request, please call: 1-800-YASKAWA (927-5292) or 1-847-887-7000.Electronically
To contact us electronically, please select your type of request and complete the form.Yaskawa America, Inc. - Drives & Motion Division
2121 Norman Drive South
Waukegan, IL 60085