Announcement
Collapse
No announcement yet.
Did we loose Pointer?
Collapse
X

I was able to get all figured out, much simpler than I was making it! able to log hourly number into a new location every hour then on request (Will change to specified time) store to CSVfile and at the end of the day go back to the original location
Last edited by Lucas.Allen; 08012018, 10:58 AM.

Originally posted by pbw View PostCould you elaborate?
Let's take a 2 dimension array. Let's say each row consists of 10 columns, and there are 10 rows. Allocate a single block of 100 items and call it ARRAY.
In languages that support multiple dimensions, you would access row 3/column 5 like this: ARRAY[3][5], but all you are really doing is accessing linear memory with some simple math...ARRAY[Row*RowSize + Col]...or ARRAY[3*10 + 5].
Since Domore allows complex expressions for both the right and left side of a MATH box, it is easy to build and access n dimension arrays. I'm showing 2 dimensions, but this can easily be extended to 3 or more dimensions.
So let's say you wanted to fill our example ARRAY with values:
FOR Row = 0 to 9
FOR Col = 0 to 9
MATH ARRAY[Row*10+Col] = My source data
NEXT
NEXT
Here it is in code. I created Symbolic Constants for the dimension values so the code is more readable. It also makes it easy to change the size later. Row and Col are just D locations.
 3 likes
Leave a comment:

I guess I need to play with this one to figure it out, thank you !
Leave a comment:

Originally posted by BobO View PostNo, we improved on it.
All memory blocks are indirectly addressable via array indexing...Block[Index], where Index is the address of Block. If V13 were equal to 100, D[V13] would return the value of D100. Incrementing V13 (to 101) would then return D101.
This works for all blocks, even structures, like T[V5].Acc.
In normal ladder code, only V can be an array index. Within MATH boxes, array indices can be full expressions like C[D5 + sqrt(N2/PI())]. In the MATH box the output value can also be a full array expression. Very handy for doing multidimensional arrays, D[XIdx + YIdx*RowSize] = Expression.
Leave a comment:

No, we improved on it.
All memory blocks are indirectly addressable via array indexing...Block[Index], where Index is the address of Block. If V13 were equal to 100, D[V13] would return the value of D100. Incrementing V13 (to 101) would then return D101.
This works for all blocks, even structures, like T[V5].Acc.
In normal ladder code, only V can be an array index. Within MATH boxes, array indices can be full expressions like C[D5 + sqrt(N2/PI())]. In the MATH box the output value can also be a full array expression. Very handy for doing multidimensional arrays, D[XIdx + YIdx*RowSize] = Expression.
 1 like
Leave a comment:

Did we loose Pointer?
Hello,
Trying to set a table to store parts count every hour in an increment series of memory locations without needing to write a new line for each hour of the day, I believe in DirectSoft you could do this with a pointer using INCB instruction ( I never set up But played around with it and got working) But I am at a loss with DoMore Any suggestions?
Leave a comment: