Hi,
I need to bit-shift a block of words in an Omron PLC by a certain amount. Is SFTR the only way to do this? I've tried NSFR/NSFL but from testing it, it seems those instructions are only restricted to a single word.
SFTR seems to do what I want but it looks like it works off a pulse input, which is a bit annoying as I want to run it on consecutive scans within a FOR loop to do my bit-shifting. The help file for this instruction seems to be quite contradictory:
So...am I meant to be pulsing bit 14 or just leaving it on all the time? I've tried both but haven't gotten any bit-shifting to occur, perhaps I'm doing the pulsing incorrectly...
I need to bit-shift a block of words in an Omron PLC by a certain amount. Is SFTR the only way to do this? I've tried NSFR/NSFL but from testing it, it seems those instructions are only restricted to a single word.
SFTR seems to do what I want but it looks like it works off a pulse input, which is a bit annoying as I want to run it on consecutive scans within a FOR loop to do my bit-shifting. The help file for this instruction seems to be quite contradictory:
When the execution condition of the shift input bit (bit 14 of C) changes to ON, all the data from ST to E is moved in the designated shift direction (designated by bit 12 of C) by 1 bit, and the ON/OFF status of the data input is placed in the rightmost or leftmost bit. The bit data shifted out of the shift register is placed in the Carry Flag (CY).
The data in the shift register will be shifted one bit in the direction indicated by bit 12, shifting one bit out to CY and the status of bit 13 into the other end whenever SFTR(084) is executed with an ON execution condition as long as the reset bit is OFF and as long as bit 14 is ON. If SFTR(084) is executed with an OFF execution condition or if SFTR(084) is executed with bit 14 OFF, the shift register will remain unchanged. If SFTR(084) is executed with an ON execution condition and the reset bit (bit 15) is OFF, the entire shift register and CY will be set to zero.
So...am I meant to be pulsing bit 14 or just leaving it on all the time? I've tried both but haven't gotten any bit-shifting to occur, perhaps I'm doing the pulsing incorrectly...