Fill an array of unknown size

Filling an array of unknown size is a bit tricky since the Fill function is limited to filling 32 registers of an array. Here is one method. This example is limited to arrays of length 128. To increase the max size, simply duplicate the last 4 lines in the expression as many times as necessary.

Caution: It is possible to exceed the allotted execution time for the step. However, the Verify will catch this and alert you and prevent the download to the RMC. If you do exceed the loop time, you will need to spread the code over several steps, in which case the variable i needs to be defined in the Variable Table, not locally in the step.

You can also download the attached user program FillArray.rmcprog and import it into your project.


FillArray.rmcprog (1.83 KB)