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?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
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; https://forge.codesys.com/drv/mcp7941x/home/Home/
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
have no ladder examples, sorry
but a good starting point is to check this example here (Date and Time): https://forge.codesys.com/prj/codesys-example/date-and-time/home/Home/
(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)
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?
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.:
https://raspberrypi.stackexchange.com/questions/104127/how-to-check-if-installed-rtc-is-working-or-not
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;
https://forge.codesys.com/drv/mcp7941x/home/Home/
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.
Hi,
have no ladder examples, sorry
but a good starting point is to check this example here (Date and Time):
https://forge.codesys.com/prj/codesys-example/date-and-time/home/Home/
(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