Can I change a variable link to another symbol over ADS?

106 views Asked by At

Using TwinCAT 3. I'm using a function block like MC_Home. I would like to set/change the link/pointer/something else clever to where MC_Home should read its input bCalibrationCam from. I would like to set this from my other application over ADS when the PLC is running. I will do it before starting actual execution of the MC_Home.

Example: This execution I would like that MC_Home uses a symbol called bHome1. Next execution maybe the symbol to be used by MC_Home could be bSomeVeryDifferentSensor39.

One thing I have tried is using a pointer. Setting the adress of the pointer over ADS and then dereferencing it in MC_Home. This works great, but I have one problem. I'm unable from the ADS side to know the PLC adress of my symbols. I manually used the supplied function block ADR, read out the PLC memory adress of my symbol and entered that for the pointer. However, I'm unable to find the PLC memory adress of symbols over ADS. I can of course find the index group and index offset of my symbols using ADS, but this seems to not correlate to the PLC memory adress that the FB ADR supplies in a way that I can understand.

Another thing that would work is this: I could create a function block that accepted a symbol name (string?) as input and ran ADR on that variable and gave me the resulting adresss back, but I'm not sure if it is possible to create such a function block.

0

There are 0 answers