Posted 3 Nov 2016 Hello All! I am having difficulties mapping register values. In the TURCK register there are 24 unique register bytes corresponding to different value registers (8bit x 24). These 24(8bit) bytes were mapped into RSLOGIX 5000 as 12(16bit) INT words ....INT[12] .. This means there are 2 bytes (2 unique register values) inside each INT word. WHAT I NEED TO ACHIEVE: 1. (BLUE outline in drawing) Write/Map a value of "32" into byte 7 of the TURCK register so effectively starting at INT[5].8 in RSLOGIX Drawing1-Model.pdf This will enable the value of CNT1 (encoder count) to be registered in bytes 8-11... 2. (PINK outline in drawing) READ/MAP the values registered in bytes8,9,10 and 11(4x8bits) into a SINGLE 32bit INT value which will tell me the CNT1 value of my encoder. I am having problems when ever I try to COP a value of 32 (no matter what kind of array it's sourced from) into INT[5].8 & I haven't tried to map/read the values of bytes 8-11 CAN SOMEONE PLEASE HELP EXPLAIN HOW TO ACHIEVE THIS?! Thanks for your input EVERYONE! :D Drawing1-Model.pdf Share this post Link to post Share on other sites
Posted 3 Nov 2016 Which PLC processor do you have? COP, as you are having trouble with, Source and Destination must be same type (INT). You want to copy/move part of a source into a destination word...Masked Move (MVM) may be your best bet, allowing you to move part of source to destination. http://literature.rockwellautomation.com/idc/groups/literature/documents/rm/1756-rm003_-en-p.pdf The other issue you are going to have is you want to move "32" into bit 7. Data move instructions are byte-for-byte; "32" => 0010 0000 (bit 6 is high). But you want to move "32" into bit 7 => 0100 0000, which is actually "64". Share this post Link to post Share on other sites
Posted 4 Nov 2016 (edited) Part of your trouble is "INT[5].8" is a bit address, not a byte. Try using OTE or OTL to set the required bits. For the count: Contrary to "expert advice", source & destination in COP do not have to be the same type. The number of bytes copied is determined by the size of the destination and the length parameter. So simply COP INT[8] into a DINT tag with length 1. If there is an issue with byte order (big-endian vs little-endian) you can correct with the SWPB swap bytes instruction. Edited 4 Nov 2016 by Gerry Share this post Link to post Share on other sites