7/1/2024 7:12 AM | |
Joined: 8/21/2020 Last visit: 7/27/2024 Posts: 9 Rating: (0) |
Hello, I have some trouble reading the value of address in DB by using Pointers in indirect addressing. please find below code. OPN "Coordinate_Data_1" L P#4.0 T #Pos_Offset L DBD [ #Pos_Offset] T #Coordinate_value in Above code i can able to load value of offset P#4.0 in output(Coordinate value), But my requirement is to load that offset(P#4.0) dynamically , i want to pass offset in one of the variable and then pointer points the value of that offset and this will load in output. e.g ( OPN "Coordinate_Data_1" L P#4.0-- replace by some other variable T #Pos_Offset L DBD [ #Pos_Offset] T #Coordinate_value thanks ------------------------------------------------------------------------------------------ |
Last edited by: The Helping Hand at: 07/01/2024 13:34:41New subject after splitting |
|
7/7/2024 6:05 PM | |
Joined: 1/27/2009 Last visit: 10/22/2024 Posts: 172 Rating: (8) |
Hello Amolng,
You could try something like that: Declare the type of DINT variable in the FB static declaration. Name to something like Pnt
On the other hand, you do not need #Pnt variable if you do not plan to use this somewhere else in the block, so the code would looks like that:
I am not sure what type is your tag #Pos_Offset, but if the program compiles, it means you are using the correct type. So your code could look like that:
|
Last edited by: @rturas at: 07/07/2024 19:03:30Last edited by: @rturas at: 07/07/2024 19:05:12The only thing necessary for the triumph of evil is for good men to do nothing |
|
Follow us on