How to Modify System Clock Settings on M340 PLC with Unity Pro

Question:

Hello everyone, I am looking to manipulate the system clock on a M340 PLC using Unity Pro software. The current Date & Time format is not meeting my requirements. I am specifically looking to access and modify seconds, minutes, hours, day, week, and month individually. For example, I am able to access hours/minutes using %SW51, but I am unable to modify them separately. If anyone has any suggestions on how to achieve this or if it is even possible, please share your thoughts. Thank you for your help.

Top Replies

To update the time on the system, utilize bit %S50 and words %SW49-%SW53. To change the time, first activate bit %S50, then input the new time into system words %SW49-%SW53 (remember to convert to BCD). Afterwards, reset bit %S50 to "0" to update the time to RTC. For separating hours and minutes, consider using Rotate right and left instructions. Although not the most straightforward method, it is indeed achievable. When retrieving the time from the system words, convert from BCD to integer first before employing rotate left/right instructions.

Much appreciation, Lare, for your assistance with utilizing the Rotate Right and Left instructions. I found them straightforward to use once I familiarized myself with them. Thank you once more for your help!

You have our gratitude.

After successfully addressing the read clock issue, I encountered another problem while trying to write the desired values in my system. I attempted to convert separate integer values into combined BCD values and write each value in the corresponding system word (%50 for Seconds, %51 for HourMinute, etc.). Despite following the instructions provided in a previous post and utilizing the system bit %S50, I was unable to write the values successfully. The system clock continued to run with the same value even after setting %S50. I have also attempted using the WRTC_DT function, but the issue still persists. Is there an alternative method to write these values effectively? Thank you.

To properly update the clock, you must first set the %S50 bit and then transfer the new values to system words in BCD format. %SW50 corresponds to seconds, %SW51 represents hours and minutes, %SW52 indicates month and day, and %SW53 specifies the year. Additionally, %SW49 denotes the day of the week (with Monday being 1). The clock is synchronized with the falling edge of the system bit %S50. Remember to reset the bit after transferring the time values to the system words. If the clock's time is incorrect, such as showing 63 seconds, the time will not be updated, and the old time will revert back to the RTC. There may be an issue the first time you update the clock. If the initial clock time is incorrect, changing the time via system words will not function properly, which is a common occurrence with new CPUs. In such cases, you can correct the clock time by accessing the online crack view, double-clicking on the CPU, selecting animation, and selecting the real-time clock. Update the computer time to match the RTC if needed. After this adjustment, the time should be adjustable using the system words.

Hey there, you can indeed modify the sections of the system time individually on an M340 PLC using Unity Pro. You can access the system time using %SW50 (for the date) and %SW51 (for the time), and you'll need to use the WRITE_RTC function block to modify them. Do note that for time, the format is HHMMSS (hours, minutes, seconds), and for date, it's YYMMDD (year, month, day). To modify them separately, you'll have to split the value you're given into individual components, modify what you need, then reassemble them. However, you also need to be careful to avoid issues with time sync -- not sure what your precise requirements are, so it's hard to offer specifics. Hope this helps!

Hey, you're in luck! You can definitely manipulate the system clock individually on a M340 PLC using Unity Pro. To access and modify them, you should utilize system words %SW50 to %SW59. Each system word is responsible for a different part of the date and time (e.g., %SW52 for seconds, %SW53 for minutes, and so on). Just remember that the PLC needs to be in stop mode to adjust the clock. I hope this helps!

Hi, from my experience with Unity Pro, I believe you're on the right track with %SW51 for hours and minutes. The system words for the M340 PLC are structured in such a way that %SW50 provides seconds and %SW52 gives you the day and month. However, as far as I know, there's not a simple way to modify them separately due to the way the PLC system words are organized. I recommend splitting your adjustment operations into two parts, if practical, one for the time components (hours, minutes, seconds) and another for the date components (day, week, month). Alternatively, you might want to look into developing a custom function block to deal with each component individually. Hope this helps!

More Replies →

Streamline Your Asset Management
See How Oxmaint Works!!

✅   Work Order Management

✅   Asset Tracking

✅   Preventive Maintenance

✅   Inspection Report

We have received your information. We will share Schedule Demo details on your Mail Id.

To add a comment, please sign in or register if you haven't already..   

Frequently Asked Questions (FAQ)

FAQ: FAQs:

Answer: 1. How can I modify the system clock settings on a M340 PLC using Unity Pro software? - To modify the system clock settings on a M340 PLC using Unity Pro software, you can access and manipulate the individual components such as seconds, minutes, hours, day, week, and month separately. For example, you can access hours/minutes using %SW51 but might need additional steps to modify them individually.

FAQ: 2. Is it possible to modify the seconds, minutes, and hours separately on a M340 PLC system clock?

Answer: - Yes, it is possible to modify the seconds, minutes, and hours separately on a M340 PLC system clock by manipulating the relevant memory addresses or registers within the PLC using Unity Pro software.

FAQ: 3. How can I access and modify the date and time components individually on a M340 PLC?

Answer: - To access and modify date and time components individually on a M340 PLC, you may need to work with specific memory locations or registers that correspond to seconds, minutes, hours, day, week, and month within the PLC programming environment in Unity Pro.

FAQ: 4. Are there any specific functions or methods in Unity Pro that facilitate modifying the system clock settings on a M340 PLC?

Answer: - While Unity Pro provides a platform for programming the M340 PLC, modifying the system clock settings may require custom programming logic to handle individual components such as seconds, minutes, hours, etc. You may need to refer to the PLC documentation or seek advice from experienced programmers for specific

Ready to Simplify Maintenance?

Join hundreds of satisfied customers who have transformed their maintenance processes.
Sign up today and start optimizing your workflow.

Request Demo  â†’