The value of i is automatically incremented by the for next loop, so just remove the i=i+1.Originally Posted by Christos_K
This will give you the results you're looking for.
Array1 var byte[4] ' declare a 4-byte array
for i=0 to 3 ' index array elements 0 to 3 (4 total)
array[i]=i
next i
Array elements start at 0, and end at the declared size-1. I.E. Array VAR BYTE[4] gives you
4 byte sized elements in the Array that are indexed 0 to 3.
If you do this;
Array1 var byte[3]
for i=0 to 3
array[i]=i
next i
You'll end up placing the 3 in a RAM location outside your 3-byte array.
Bookmarks