I'd do the following: 1) Build an MCIN block to decode a) Set IOMOPT to 0 b) Connect the integer to the II01 parameter c) Set the block in automatic The decoded bits are in CIN_1 through CIN_16. 2) Build an MCOUT block to rearrange the bits a) Set the IOMOPT to 0 b) Connect the CIN_x parameters from the MCIN to the IN_x parameters of the MCOUT block c) Set the block in automatic The rearranged bits are in the PAKCRB parameter of the MCOUT block No CALC programming required. Remember my rules for implementation: There are a few rules that one should follow when designing a control system: * Do it in regulatory control blocks. most efficient; least prone to problems) * If the regulatory control blocks can't do it, use a CALC block. efficient, but must deal with BAD and coding errors; debugging is a pain * If the CALC block can't do it, use a Sequence Block Pretty inefficient, but in the CP so its FT. Code/compilation relatively complex. Debugging is a pain. * If you can't do it in a sequence block, reconsider if you need to do it. * If you must do it, see if you can do it in a shell (sh, ksh, csh, perl, etc.) script Easier to debug, easy to schedule, remember to use omgetimp and omsetimp to avoid broadcasts, remember to use show_params to check the IMPORT table * If you can't do it in a script, reconsider doing it. * If you must do it, see if there is a 3rd party or Foxboro package that will do it. (Ask on the mailing list.) * If you must do it and can't find a package, write a program. Regards, Alex Johnson Invensys Process Systems 10900 Equity Drive Houston, TX 77041 713 329 8472 (desk) 713 329 1600 (operator) 713 329 1944 (SSC Fax) 713 329 1700 (Central Fax) alex.johnson@xxxxxxxxxxxxxxxx -----Original Message----- From: foxboro-bounce@xxxxxxxxxxxxx [mailto:foxboro-bounce@xxxxxxxxxxxxx] On Behalf Of Airhart, Chad M. Sent: Friday, November 14, 2008 4:59 PM To: foxboro@xxxxxxxxxxxxx Subject: [foxboro] Interger bit order inversion Anyone have a calc block program for inverting the order of the bits in a 16 bit integer? Example 0000010011000001 to 1000001100100000. Chad M. Airhart Principal Engineer Instrument, Electrical and Control Systems LyondellBasell Industries Equistar Chemicals P.O. Box 513 Old Bloomington Hwy Victoria, TX 77901 Tel. +1 361.572.2568 Fax. +1 361.572.2541 Mobile: +1 361.935.3230 chad.airhart@xxxxxxxxxxxxxxxxxx www.lyondellbasell.com <http://www.lyondellbasell.com/> _______________________________________________________________________ This mailing list is neither sponsored nor endorsed by Invensys Process Systems (formerly The Foxboro Company). Use the info you obtain here at your own risks. Read http://www.thecassandraproject.org/disclaimer.html foxboro mailing list: //www.freelists.org/list/foxboro to subscribe: mailto:foxboro-request@xxxxxxxxxxxxx?subject=join to unsubscribe: mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave * Confidentiality Notice: This e-mail and any associated files are intended solely for the individual or entity to whom they are addressed. Please do not copy it or use it for any purposes, or disclose its contents to any other person. Further, this e-mail and any associated files may be confidential and further may be legally privileged. This email is from the Invensys Process Systems business unit of Invensys plc which is a company registered in England and Wales with its registered office at Portland House, Bressenden Place, London, SW1E 5BF (Registered number 166023). For a list of European legal entities within the Invensys Process Systems business group, please click here http://www.invensys.com/legal/default.asp?top_nav_id=77&nav_id=80&prev_id=77. If you have received this e-mail in error, you are on notice of its status. Please notify us immediately by reply e-mail and then delete this message from your system. Thank you for your co-operation. You may contact our Helpdesk on +44 (0)20 7821 3859 / 2105 or email inet.hqhelpdesk@xxxxxxxxxxxxx This e-mail and any attachments thereto may be subject to the terms of any agreements between Invensys (and/or its subsidiaries and affiliates) and the recipient (and/or its subsidiaries and affiliates). _______________________________________________________________________ This mailing list is neither sponsored nor endorsed by Invensys Process Systems (formerly The Foxboro Company). Use the info you obtain here at your own risks. Read http://www.thecassandraproject.org/disclaimer.html foxboro mailing list: //www.freelists.org/list/foxboro to subscribe: mailto:foxboro-request@xxxxxxxxxxxxx?subject=join to unsubscribe: mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave