Vai al contenuto

Simple hours counter, with a value return on string

Home Forum Controllori SlimLine e Netsyst (LogicLab) Simple hours counter, with a value return on string

Stai visualizzando 2 post - dal 1 a 2 (di 2 totali)
  • Autore
    Post
  • #35192
    Bart
    Partecipante

    I have to realize a hour counter for several devices, I need to count the working time of each device. For this I thought to realize a function block, so it can be reused for each device.

    I plan to save the values ​​to a log file, so it would be helpful if the function block returns the value of working hours on a string, in the format hhhhhhhh:mm:ss; so it can be saved to a file in CSV format and then imported into Excel.

    Could I have an example program of this ?

    #37191
    Sergio Bertana
    Amministratore del forum

    I’ve developed the HourCounter FB, this FB calculates the work time of a device. The device start signal must be passed to the FB, since the hours counter has to be RETAIN and is not possible to define RETAIN variables in a FB, so the hours counter variable must be a RETAIN variable the address of which must be passed to the FB. 

    The FB returns also a string that reports the working time expressed as: hhhhhhhhhh:mm:ss;

    The example program I made use the logic input %IX0.0 as a device start signal and it’s possible to see the results by debugging the program. Here the print out of the program and the source code.

Stai visualizzando 2 post - dal 1 a 2 (di 2 totali)
  • Devi essere connesso per rispondere a questo topic.