Was thinking a little bit of this what you have said.
For DI,DO, AI and AO I don't need ANY POINTER since data types are already known for me, bools and INTs. They are fixed. USer on HMI will not choice data type of the variable, he will choice its value only by choosing address of DI,DO, AI, AO. So user structures POINTER and on that way he chooses value for my variable. This code does that. A little bit different since here I assign value from variable inside DB not from DI,DO,AI or AO, but it should very similar.
Code:
L #DI_S.Address_P1
T #tmpAddress
L #DI_S.Address_P2
T #tmpDBNum
OPN DB [#tmpDBNum]
A DBX [#tmpAddress]
= #DI_S.Val
Code:
DI_S:UDT looks like this
EN : BOOL;
Val : BOOL;
Address_P1 : DWORD;
Address_P2 : WORD;
Even though JesperMP hates how does it looks like (I have to say I hate this topic name)
It does what I need it for, I don't know what is ****ty there but it assigns value to the variable from location where POINTER actually points.
Dahnuguy gave me a couple of examples how to reduce "work under the hub"
Now I need something else and it is related with this what L D[AR2,P#0.0] said.
This before works for lets say normal data types.
Let's say I have 5 variables MOTOR1,MOTOR2,MOTOR3,MOTOR4,MOTOR5, of data type FB_MOTOR.
Values of these variables (MOTOR1,MOTOR2,MOTOR3,MOTOR4,MOTOR5)
are stored in DB10("MOTORS_DATA" symbolic name) for an example. (Motor_Data1,Motor_Data2,Motor_Data3,Motor_Data4,Motor_Data5). Every single variable "Motor_DataX" is variable of data type DT_MOTOR, also every single variable "Motor_DataX" has got different values from other since Motors are not the same let's say( I wanna say that values inside Motor_Data1 and Motor_Data3 re not the same for an example). Since it is not possible to create inside DB variable of data type FB_MOTOR, FB_MOTOR contains IN_OUT variable of data type DT_MOTOR.
It is not necessary that Motor_Data1 corresponds to the MOTOR1 (MOTOR1 : FB_MOTOR), let it be chosen on HMI, maybe Motor_Data3 is better option.
My question is whether is ANY_POINTER answer for this question?
How to make USER on HMI to choice appropriate "Motor_DataX" for any of these variables (MOTOR1,MOTOR2,MOTOR3,MOTOR4,MOTOR5).
How user can for an example assign values from "Motor_Data3" to the MOTOR1 FB_MOTOR IN_OUT variable?
I'm not asking you guys to give me code for this, just tell me is this possible via ANY_POINTER. I will try to struggle about it and its applications, maybe later you can assist if it is necessary.
I keep reading this bit it has less and less sence, something is missing and idk what