PLCDontUQuitOnMe
Member
Say I want to reverse the bit order of an int in Controllogix...how do I go about this, other than making 16 rungs to individually check each bit and move it into the opposite bit?
I can't seem to use indirect addressing like I did with the SLCs. I was thinking 2 counters in a loop, one a CTU and one a CTD, using the ACC values of each and a move instruction addressed like so...
Mov
Forwards.(CountUP.ACC)
Reverse.(CountDownACC)
However that doesn't work.
SWPB doesn't work as it swapes bytes, but I need the actual bits swapped...IE:
1101 0000 0100 1010 to
0101 0010 0000 1011
Is there an easy way to do this because I would think there would be? Or do I just have to bite the bullet and check each bit one at a time?
For the curious, I'm trying to move a counter's ACC value into a 16 point output module. To make a visual representation of a binary counter. However the outputs module's outputs are arranged left to right ascending IE: 0 1 2 3 4..... and the integer i'm moving into it is the opposite, 15 14 13 12....
I can't seem to use indirect addressing like I did with the SLCs. I was thinking 2 counters in a loop, one a CTU and one a CTD, using the ACC values of each and a move instruction addressed like so...
Mov
Forwards.(CountUP.ACC)
Reverse.(CountDownACC)
However that doesn't work.
SWPB doesn't work as it swapes bytes, but I need the actual bits swapped...IE:
1101 0000 0100 1010 to
0101 0010 0000 1011
Is there an easy way to do this because I would think there would be? Or do I just have to bite the bullet and check each bit one at a time?
For the curious, I'm trying to move a counter's ACC value into a 16 point output module. To make a visual representation of a binary counter. However the outputs module's outputs are arranged left to right ascending IE: 0 1 2 3 4..... and the integer i'm moving into it is the opposite, 15 14 13 12....