Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Real time clock with ladder logic and ComFilePi

  • twist-throttle - 2021-02-24

    I am using Codesys 3.5 SP 16 Patch 3 to program a Rapsberry Pi based PLC/HMI from Comfile Technologies. I cannot figure out how to access the real time clock with ladder logic. I've tried solutions posted on here and other forums with no success. It is likely something to do with accessing this particular units RTC which does exist.

    What I would like to do is trigger an event based on the RTC everyday at 5:30PM. Has anyone had success doing something like this?

  • aliazzz

    aliazzz - 2021-02-25

    I think you have some things to consider;

    Read the manual from the supplier and get to know what type of RTC chip is installed.
    RTC clocks are not standard onboard of raspberry Pi hardware as yet. Check if the proper linux driver installed and working. In your case this means checking the checking the manual and software image shipped with the board by the supplier of the HMI solution.

    You could ask Linux via commandline or google e.g.:

    Also, my mcp7941x driver for RTC with SRAM project gives you general hints on checking i2c Devices in general allthough specificly written for the MCP7941x RTC/SRAM chip;

    The RTC time itself can be accessed via several "of the shelve" libraries in CODESYS. Obtaining current date and time is demonstrated in the provided example within the package with help of such an "of the shelve" library.

  • eschwellinger

    eschwellinger - 2021-02-25

    have no ladder examples, sorry
    but a good starting point is to check this example here (Date and Time):
    (for date and time handling)
    to set daily events either use:
    'TimerSwitch' FB from Util.library or even a good approach is to use
    Timer_2 from Oscat Basic and Oscat Bulding library ( from CODESYS Store).
    For this I'll add an example project. (this already exists in this forum under old examples but is now updated and it starts 5:30 -> xOutHeatPump:
    More detailed documentation for oscat is in the library (embedded as pdf)


    Last edit: eschwellinger 2021-02-25

Log in to post a comment.