A few things need to be clearfied
when you say an array of bits
is it a bit array
an INT tag and aDINT tag are both arrays of bits
and for that matter a string tag is stores as anarray od bits
but the easisest way is to use for next loop
in a ladder program use the lable function to form the loop
one line of code
I have to disagree ....
SINT, INT, and DINT tags are not arrays of bits, and neither is a STRING tag.
To address a single bit within an integer tag, you just use the "dot delimiter", and not the [nnnn] array element specification. And you are limited to the number of bits you can address within each data-type by the physical size of the tag data, i.e. 8 for SINT, 16 for INT, and 32 for a DINT. To increase the number of bits available, you could use Arrays of the integer tags, but will then have to calculate the "word" address (i.e. the array pointer), and the bit offset into the target array element.
A STRING tag is a structured tag consisting of two elements, a LENgth DINT, and a SINT[82] array, so its use as bit storage will become very messy indeed.
Take notice that I have used the words "bit" and "bits" above, so as not to confuse with the BOOL data-type. A BOOL is not a single bit of data, but is in fact a tag that is allocated a 32-bit memory space for its data, where only bit 0 is used. A BOOL[nn] array, due to background optimisation by the compiler, will use as many 32-bit memory spaces as needed to store the number of bits you request in the array, e.g. if you create a BOOL[100] array, you will be given a BOOL[128] array, which is 4 x 32-bit words of data. This in itself may lead to complications since you may inadvertantly indirectly address one of the "unused" bits, 100 to 127, so error checking and careful programming may be required.
In summary, if you want to use a BOOL array, then go ahead and use one, but to make it usable by many instructions, parcel it up in a UDT as described. Clearing all of the bits in the BOOL array tag is then a simple case of using a single FLL instruction. However, while FLL will work, you MUST NOT put any other members to the UDT other than the BOOL array. Read the Help on FLL for an explanation why. In fact the help suggests that to intialise a structured tag you should use COP (or CPS) instead, which means you need an identical UDT tag that has the required data stored in it.
For the reasons given in FLL Help, I always use a SINT constant tag as the FLL Source specification, with No External Access, and initialised to 0 on first scan. Then I know that I am keeping everything "in bounds" and tidy.
In the attached code, "MyData" is a UDT tag of data-type "MyData", which contains a single BOOL array of 2048 bits. ZeroByte is the constant SINT tag, and the Length of the FLL is set to 1 (1 x number of bytes of the destination data-type, which is 256 bytes). Execution time of the FLL is sub 180 uSecs (the second GSV is around 20 uSecs, so I suspect about 160 uSecs.
No looping, no FOR instruction calling another routine 2048 times, no lumping backwards, just 1 instruction.