blazindave
Member
Longtime lurker, first time poster... I'm no expert when it comes to PLC programming, I tend to just kind of fumble along until I come up with something that works, but this has been stumping me:
I'm using Turck hardware (programmable BL-20) which uses Codesys programming environment.
I need to build a function block that has the following inputs/outputs:
Inputs:
Overview:
I'm building a system to track the time it takes to build various assemblies - the worker will scan a barcode, which will feed the allotted number of minutes into this FB (this will always be a whole number, no seconds associated with it). Worker hits start and the clock starts counting down. (e.g. if they have 200 minutes allotted, as soon as they hit start, it begins counting down from 200:00, 199:59, 199:58, etc). When it hits 0:00, it then starts counting up: 0:01, 0:02, 0:03, etc.
I need to have a pause function in there so if they take a break or run out of parts, etc, it holds the time until they resume work.
I am having a lot of trouble with the pause function, as I don't seem to have a retentive timer available to me - I've seen using a TON with an EN and that almost works, except that even when the EN input is turned off, it still keeps timing -- when I re-enable it, the time has still continued to increase. I need it to hold the value and stop increasing during that "pause" time.
I want to display the "clock" for the operator to see, so he can know if he is on pace with what's allocated, or working fast or slow. Ultimately, when TimingOn ends, I will take the values from the output Words and store them, as well as the status of the Counting Up bit (so I know if he had 10 minutes remaining or took 10 minutes too long, for example).
This seems like something that someone's probably already done at least most of, or maybe has some suggestions, ideas, etc... Any advice or libraries or FBs that are already written are greatly greatly appreciated.
Thanks, I look forward to the responses!
I'm using Turck hardware (programmable BL-20) which uses Codesys programming environment.
I need to build a function block that has the following inputs/outputs:
Inputs:
- MinutesIn - this can be either a WORD or a TIME variable (I can give it either)
- TimingOn bit - this will be a maintained signal, but I could make it momentary if necessary
- Pause bit - this one will be maintained
- Minutes (WORD)
- Seconds (WORD)
- Counting Up bit (see below for description)
Overview:
I'm building a system to track the time it takes to build various assemblies - the worker will scan a barcode, which will feed the allotted number of minutes into this FB (this will always be a whole number, no seconds associated with it). Worker hits start and the clock starts counting down. (e.g. if they have 200 minutes allotted, as soon as they hit start, it begins counting down from 200:00, 199:59, 199:58, etc). When it hits 0:00, it then starts counting up: 0:01, 0:02, 0:03, etc.
I need to have a pause function in there so if they take a break or run out of parts, etc, it holds the time until they resume work.
I am having a lot of trouble with the pause function, as I don't seem to have a retentive timer available to me - I've seen using a TON with an EN and that almost works, except that even when the EN input is turned off, it still keeps timing -- when I re-enable it, the time has still continued to increase. I need it to hold the value and stop increasing during that "pause" time.
I want to display the "clock" for the operator to see, so he can know if he is on pace with what's allocated, or working fast or slow. Ultimately, when TimingOn ends, I will take the values from the output Words and store them, as well as the status of the Counting Up bit (so I know if he had 10 minutes remaining or took 10 minutes too long, for example).
This seems like something that someone's probably already done at least most of, or maybe has some suggestions, ideas, etc... Any advice or libraries or FBs that are already written are greatly greatly appreciated.
Thanks, I look forward to the responses!