Hey,
I am trying to implement a FIFO as a sort of memory option when I am trying to log the last 30 values of a variable.
Due to the lack of FIFO or Memory option on CCW (as far as I am aware) I tried using the COP function as follows:
Source: Test_1
SRC_OFFSET: 0
Dest: Test_1
DEST_OFFSET: 1
Length: 29
SWAP: 0
Where Test_1 is an array of dimension 30.
The way i reasoned this out is to grab the first 29 [0 - 29] values of the array and copy them onto the [1 - 30] positions of the same array.
The issue I encountered is that the COP function seems to perform the copy in a step-by-step manner, copying only one element at a time. This therefore caused the first element in the array to be copied throughout the array.
This diagram might explain it better. From what I've concluded it function like this:
Grab [0] and copy to [1] ==== Value 1 is copied to [1]
Grab [1] and copy to [2] ==== Value 1 is copied to [2]
[0]1 ----> [0] 1 ----> [0] 1
[1]2 ----> [1] 1 ----> [1] 1
[2]3 ----> [2] 3 ----> [2] 1
[3]4 ----> [3] 4 ----> [3] 4
[4]5 ----> [4] 5 ----> [4] 5
[5]6 ----> [5] 6 ----> [5] 6
[6]7 ----> [6] 7 ----> [6] 7
[7]8 ----> [7] 8 ----> [7] 8
[8]9 ----> [8] 9 ----> [8] 9
Were this to happen simultaneously or inversely (starting from the bottom) I wouldn't have this issue.
Maybe someone out there smarter than me has a better idea?
I am trying to implement a FIFO as a sort of memory option when I am trying to log the last 30 values of a variable.
Due to the lack of FIFO or Memory option on CCW (as far as I am aware) I tried using the COP function as follows:
Source: Test_1
SRC_OFFSET: 0
Dest: Test_1
DEST_OFFSET: 1
Length: 29
SWAP: 0
Where Test_1 is an array of dimension 30.
The way i reasoned this out is to grab the first 29 [0 - 29] values of the array and copy them onto the [1 - 30] positions of the same array.
The issue I encountered is that the COP function seems to perform the copy in a step-by-step manner, copying only one element at a time. This therefore caused the first element in the array to be copied throughout the array.
This diagram might explain it better. From what I've concluded it function like this:
Grab [0] and copy to [1] ==== Value 1 is copied to [1]
Grab [1] and copy to [2] ==== Value 1 is copied to [2]
[0]1 ----> [0] 1 ----> [0] 1
[1]2 ----> [1] 1 ----> [1] 1
[2]3 ----> [2] 3 ----> [2] 1
[3]4 ----> [3] 4 ----> [3] 4
[4]5 ----> [4] 5 ----> [4] 5
[5]6 ----> [5] 6 ----> [5] 6
[6]7 ----> [6] 7 ----> [6] 7
[7]8 ----> [7] 8 ----> [7] 8
[8]9 ----> [8] 9 ----> [8] 9
Were this to happen simultaneously or inversely (starting from the bottom) I wouldn't have this issue.
Maybe someone out there smarter than me has a better idea?