Hi Joe and Flex!
Thanks a lot for sharing some of your knowledge!
I want the machine to do 3 operations, i thought of doing something like: if input 1, call subroutine A; if input 2, call subroutine B, etc etc.
In college we did something just like that, if HMI button 1 pressed, call this routine; if HMI button 2 pressed, call other subroutine... i thought it was a good way of keeping things organized
it didn't worked though, i wrote on my final report i needed more time to debug and the teacher let me go with that
So that's a bad idea then?
So now i am thinking maybe subroutines should be used to make repetitive tasks easier to program, then?
Now regarding Joe's reply:
"a bit or a timer must be scanned one more time with a Logical FALSE statement in front if it in order to turn it back off"
and:
"If the the subroutine is not being called, everything in it is frozen in the state it was in when you left. Which means bits are left on and timers are not reset. "
I am failing to see why my timer does not resets when the input toggles.
Once the subroutine is called, the program is scanned inside the subroutine only, right? Then it will do a scan with my input active and timer decreasing, then a scan with my input inactive and stop decreasing the timer, then a scan again with the input active again; isn't this enough to reset it?
Actually this is not really relevant to my application since i won't have timer conditions shifting so quickly, its just curiosity ?
Is there any good books, or something like it, where i can learn all this tricks without disturbing the most experienced ones? I had PLC classes both in high school and in college and these kind of stuff never was told me before...
thanks a lot again!
Regards,