Hi guys,
Disappeared few weeks for writing code, I'm back with a problem.
There is a repeating work for different group of signals, so I decide to go with FC (I don't need IDB), and the signals in different DB but as the same UDT. so it's like
DB1.G1.f1
DB1.G1.f2
...
DB1.G1.f5
...
DB1.G5.f1
...
DB1.G5.f5
.
.
.
DB10.G5.f1
...
DB10.G5.f5
G is the name of UDT, and f is the elements of the UDT (Boolean).
Because it is too much parameters, I want to use a pointer to the start address, so within the FC I can add shift and get the right element. So the input is an "any" data type which is a pointer should including the DB name and the Address info. and inside the FC it's like
[AR1,p#0.0] for elements 1
[AR1,p#0.1] for elements 2
[AR1,p#0.2] for elements 3
[AR1,p#0.3] for elements 4
[AR1,p#0.4] for elements 5
When it's running, it seems the pointer pass some other values and the logic doesn't work. I simplyfied the logic to test it like
A [AR1,p#0.0]
= DB100.DBX0.0
A [AR1,p#0.1]
= DB100.DBX0.1
...
A [AR1,p#0.5]
= DB100.DBX0.5
Then I turned the bits on outside of the FC,But all the bits in DB100.DBB0 is always off.
Did i do wrong with the indirect addressing or something else?
Thanks for help.
Disappeared few weeks for writing code, I'm back with a problem.
There is a repeating work for different group of signals, so I decide to go with FC (I don't need IDB), and the signals in different DB but as the same UDT. so it's like
DB1.G1.f1
DB1.G1.f2
...
DB1.G1.f5
...
DB1.G5.f1
...
DB1.G5.f5
.
.
.
DB10.G5.f1
...
DB10.G5.f5
G is the name of UDT, and f is the elements of the UDT (Boolean).
Because it is too much parameters, I want to use a pointer to the start address, so within the FC I can add shift and get the right element. So the input is an "any" data type which is a pointer should including the DB name and the Address info. and inside the FC it's like
[AR1,p#0.0] for elements 1
[AR1,p#0.1] for elements 2
[AR1,p#0.2] for elements 3
[AR1,p#0.3] for elements 4
[AR1,p#0.4] for elements 5
When it's running, it seems the pointer pass some other values and the logic doesn't work. I simplyfied the logic to test it like
A [AR1,p#0.0]
= DB100.DBX0.0
A [AR1,p#0.1]
= DB100.DBX0.1
...
A [AR1,p#0.5]
= DB100.DBX0.5
Then I turned the bits on outside of the FC,But all the bits in DB100.DBB0 is always off.
Did i do wrong with the indirect addressing or something else?
Thanks for help.