News:

  • August 23, 2026, 05:06:09 PM

Login with username, password and session length

Author Topic: Using Indexed Variables in a SWAPB Instruction  (Read 8158 times)

Bolt

  • Hero Member
  • *****
  • Posts: 598
Using Indexed Variables in a SWAPB Instruction
« on: August 20, 2019, 07:22:59 PM »
I think this is a minor glitch in DmD, I can't use sequential or close indexes in this scenario.  See attached example.  Changing the destination to V318 for example works fine.  It'd be nice if you could fix this?

brucek

  • Sr. Member
  • ****
  • Posts: 61
Re: Using Indexed Variables in a SWAPB Instruction
« Reply #1 on: August 21, 2019, 06:53:39 AM »
looks like in the instruction you have 4 elements selected and it should be 2. N is a word I think.

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3843
    • Host Engineering
Re: Using Indexed Variables in a SWAPB Instruction
« Reply #2 on: August 21, 2019, 09:47:13 AM »
I think this is a minor glitch in DmD, I can't use sequential or close indexes in this scenario.  See attached example.  Changing the destination to V318 for example works fine.  It'd be nice if you could fix this?

Good catch.  Fixed.

Basically, if both elements are arrays to the same block (e.g. N), then the PLC logic is responsible to ensure that the two array index/element count ranges do NOT overlap.  (If they are identical, e.g. Source and Dest are both N[V42], then it will flag THAT as "overlapped" since they are the same array index to the same block.)

Caveat Emptor.

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3843
    • Host Engineering
Re: Using Indexed Variables in a SWAPB Instruction
« Reply #3 on: March 25, 2020, 10:08:52 AM »
Fixed in Designer 2.7.  The range validation was incorrectly interpreting the V array index as a normal block index.