Hi!
As a project, I created an SFC with 4+1 Init step, where each makes a LED light.
Step C should make the LED blink. I used a BLINK box to do so, the output of the BLINK has been passed to the LED's coil. However, if the output of the BLINK is false, the LED still won't turn off, although the wire leading to the LED's coil is off. What can be the reason?
Also, when the application starts, it doesn't start by the Init step, but immediately at step C.
I can't figure out what the problem is.
I attached the project so that you can have a look on it yourselves.
Thanks in advance!
I opened your source, here is some small feedback:
1) There are implicit timers available in SFC (see help!) you should try to use those first instead of programming timers yourself. Only when the implicit timers will not help you you can program one of your own. This helps keep your code clean (and less programming means less bugs)
Use an UNSIGNED INTEGER (myCurrentStep : UINT := 0;) to keep track of the steps in which you are. Using booleans is only going to make it more convoluted.
Rename Step A, Step B, to Step 1, Step 2, etc, which is more flexible and easy.
Every step has an Entry and and exit (See help), you can use this to initialise every step, like timers/counters etc and set myCurrentStep := x; depending on your step.
Always write your code as if you are writing it for somebody else.
PS you are free to choose any language for the step code, however Ladder would not be my first choice, maybe try Structured Text?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi!
As a project, I created an SFC with 4+1 Init step, where each makes a LED light.
Step C should make the LED blink. I used a BLINK box to do so, the output of the BLINK has been passed to the LED's coil. However, if the output of the BLINK is false, the LED still won't turn off, although the wire leading to the LED's coil is off. What can be the reason?
Also, when the application starts, it doesn't start by the Init step, but immediately at step C.
I can't figure out what the problem is.
I attached the project so that you can have a look on it yourselves.
Thanks in advance!
I opened your source, here is some small feedback:
1) There are implicit timers available in SFC (see help!) you should try to use those first instead of programming timers yourself. Only when the implicit timers will not help you you can program one of your own. This helps keep your code clean (and less programming means less bugs)
Use an UNSIGNED INTEGER (myCurrentStep : UINT := 0;) to keep track of the steps in which you are. Using booleans is only going to make it more convoluted.
Rename Step A, Step B, to Step 1, Step 2, etc, which is more flexible and easy.
Every step has an Entry and and exit (See help), you can use this to initialise every step, like timers/counters etc and set myCurrentStep := x; depending on your step.
Always write your code as if you are writing it for somebody else.
PS you are free to choose any language for the step code, however Ladder would not be my first choice, maybe try Structured Text?