how to extract the name of an FB to a variable

jbarrio
2018-10-09
2024-10-01
  • jbarrio - 2018-10-09

    hello:

    There is some way to extract the name of a function block (from it) to a variable in the same FB.

    I do not know if I explained myself very well

    Best regards

     
  • josepmariarams - 2018-10-10

    Try

    {Attribute 'parameterstringof'}

    Sent from my Moto G (5S) Plus using Tapatalk

     
  • jbarrio - 2018-10-10

    hello:

    Thanks for request, you can write a example to show me some example of the use of that attribute, I do not find any example or help on how to use it.

    Best Regards,

     
  • josepmariarams - 2018-10-10

    Example:

    IMG: parameterstringof.png

     
  • josepmariarams - 2018-10-10

    The attribute is instance-path and noInit not parameterstringof aI am sorry.

    Is mandatory add both attributes: noInit and instance-path

    Salut!

     
  • jbarrio - 2018-10-10

    very thanks,

    I have created a function block to see how it works with the following code.
    FUNCTION_BLOCK POU_1
    VAR_INPUT
    in1: BOOL;
    in2: BOOL;
    END_VAR
    VAR_OUTPUT
    out1: BOOL;
    END_VAR
    VAR
    {attribute 'symbol' := 'none'}
    {attribute 'hide'}
    {attribute 'instance-path'}
    {attribute 'noinit'}
    FbName : STRING(255);
    END_VAR

    if I run that FB in a plc the variable FB_name nor see it.

    BR

     
  • josepmariarams - 2018-10-10

    You need another attribute, reflection

    https://help.codesys.com/webapp/_cds_pr ... n=3.5.13.0

    Sent from my Moto G (5S) Plus using Tapatalk

     
    • andrebrandt - 2024-09-27

      Hi mr.
      Do you have the script? Cause the link is down.

       

      Last edit: andrebrandt 2024-09-27
  • jbarrio - 2018-10-11

    very thanks

     
    • andrebrandt - 2024-09-27

      Hi mr.
      Do you have the script? Cause the link is down.

       
    • andrebrandt - 2024-09-27

      Hi mr.
      Do you have the script? Cause the link is down.

       

Log in to post a comment.