Help with function blocks



  • Hi there,

    I was wondering if could get some help with choosing the correct block/s for the below process?

    1. Use a boolean input to capture/get/display a point in time. i.e. pressing a pushbutton, captures/displays the the time “17:30:02”.

    2. Use a different boolean to reset the above time to “00:00:00”.

    I was thinking about using the “DATETIME” block but there doesn’t appear to be a method of resetting it to zero/nothing?

    Many thanks,
    Phil



  • Hi Phil,
    sure you can. Can you please describe in more detail what is the end goal? What problem are you trying to solve? Some kind of stop watch? Or maybe run-hours counter?

    The DATETIME block is very likely way too complicated for your needs.

    Best regards,
    Jaroslav



  • Hi Jaroslav,

    I'm hoping to use this function to record/capture what time a pushbutton has been pressed - I'd also like the ability to reset the captured time?

    Thanks,

    P


  • administrators

    Hi Phil,

    for measuring time of pressed pushbutton I would go for integrator (INTE function block) with ti=1.

    What is reason for measuring pushbutton pressed time? I'm asking because my proposed solution doesn't have to be the best for your end goal. Let us know.

    Cheers, Tomas



  • Hi Tomas,

    Thanks for your help with this subject - very much appreciated.

    In terms of setting up the block, I have a few small questions:

    1. Input: What inputs do I provide to the block? A "CNI =1" to the "ti" input? Are any other inputs required?
    2. Output (a time that I can display on RexHMI): Output "Y" - is that correct?
    3. Reset: The block can be reset with a "Bool = 1" to the "R1" input?

    The reason for measuring the pushbutton pressed time is to provided a centralised display for an access control system 🙂

    Thanks,

    P


  • administrators

    Hi Phil,

    let me answer your questions:

    ad 1) Yes, in order to count time connect CNI=1 to "ti" input as you proposed.
    ad 2) Correct, "Y" should contain time.
    ad 3) Exactly.

    It also assumes that your boolean signal from pushbutton is connected to input "u".

    For more details about the INTE function block see docs: https://www.rexygen.com/doc/ENGLISH/MANUALS/BRef/INTE.html#x81-800005

    Cheers, Tomas