Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Move with R_TRIG problem

River
2016-01-20
2016-01-22
  • River - 2016-01-20

    Hello,

    I think, I'm having trouble using Move function inside a function block.
    I've designed a function block that concats two strings depending on bTrigger. The function is working good but now I want to overwrite the STRING output under another part of the program.

    The problem is reset variable tries to write an empty string on StrResult but when Reset comes false the old value return again, no matter if inside the function there is conditional move with F_TRIG.

    For sure I'm doing something wrong but I can't see where is the problem, I'd like to add all the mods inside the function block.
    Thanks in advance and excuse my English

    I'm attaching the project file too.

    Regards!

    IMG: FB.PNG

    IMG: POU.PNG

    TestFB.project [144.84 KiB]

     
  • Anonymous - 2016-01-22

    Originally created by: scott_cunningham

    The CONCAT block in your CHANGE code block always assigns its output to strResult even if not enabled (enable will calculate a new CONCAT output). So your RESET code writes to StResult, but I. The next PLC scan, the CONCAT output assigns to StResult.

    You need a different technique....maybe have your CHANGE should always run, but only enable the MOVEs to the output. ST code maybe an easier solution (IF xxx THEN strResult := 'lorum'). In this case, string assignment ONLY happens when xxx is true.

     

Log in to post a comment.