Reference in FB is not possible

Why is it not possible to see the value of a variable via a reference inside a FB?

A reference in a task will show the value of the variable it is pointed to.

A reference in a FB will show the address of the variable it is pointed to.

Any suggestions?

Hello,

In this case you have 2 options.

  1. Use the Variable in the Watch, which is target of the pointer. If it is a call by Reference in a Functionblock, this is often a fix Variable and does not change.

  2. Use a Debbuging helper Variable to dereference the Pointer in the Functionblock.

I am not aware of more options. But in many years i had not issue with this, but i know that this was asked before. Maybe other Community Members have more ideas.

Greetings
Michael

2 Likes

Hi Michael,

Thanks for speedy reply.

Yes, watching the variable that is pointed to works obviously.

My issue with this, is that my program consists of an array of FB that each have about 10 inputs that points to an index of a data structure.

So for me to watch a certain FB I need to have all 10 data structures in the watch as well, to fully see the values inside the FB.

Basically I think I’m confused about why it is like that :smiley:

Thanks for your reply. Much appreciated.

Hi @Jesper_Boje_Jensen ,

So for me to watch a certain FB I need to have all 10 data structures in the watch as well, to fully see the values inside the FB.

I totally understand your frustration; you can temporarily define your new debug structured variable with all items you need for troubleshooting, where you copy all variables you need.
I like the pointers but sometimes the time we invest to find the issue with that approach is too much…hehe

Ciao
Valerio

1 Like

Hi @Jesper_Boje_Jensen , I marked your reply as a “solution“ = answer on your question.