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

Why can't i blink with a LED inside a loop?

Volvo742
2016-06-09
2016-06-10
  • Volvo742 - 2016-06-09

    Hello.

    When i try to blink with a LED inside a while/for- loop it just don't works.

    I can see om my computer screen that GPIO17 goes from True to FALSE and back again. But the LED in reality are contstant ON or contstant OFF. Depending which start value that GPIO17 start with.

    But if a make a simple program and sign True to GPIO17 and then the program is finished, the LED is ON.

    Why???

     
  • eschwellinger

    eschwellinger - 2016-06-09

    hi,
    this is one of the basics of I guess all plc's

    1. read Inputs
    2. run iec code
    3. write Outputs

    BR
    Edwin

     
  • Volvo742 - 2016-06-09

    Edwin Schwellinger hat geschrieben:
    hi,
    this is one of the basics of I guess all plc's
    1. read Inputs
    2. run iec code
    3. write Outputs
    BR
    Edwin

    That is what im trying to do.

    Create a while loop who blink a LED and you see that it won't works.

     
  • yannickasselin1 - 2016-06-10

    Just like Edwin said,

    if you make the LED blink inside the while loop, the output will not be refreshed untill the loop is done.
    So only the last state will be applied to the output. The output will always be ON or OFF.

     
  • Volvo742 - 2016-06-10

    yannickasselin1 hat geschrieben:
    Just like Edwin said,
    if you make the LED blink inside the while loop, the output will not be refreshed untill the loop is done.
    So only the last state will be applied to the output. The output will always be ON or OFF.

    Okej. I understand now that program need to be finished until all values can be set to the output.

     

Log in to post a comment.