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.:
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.
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)
Log in to post a comment.