Q&A Community

How to Display Date and Time on CTI 2500 PLC LED Sign with Simatic 505 Command

Question:

I am new to CTI PLCs and currently working with a CTI 2500 PLC connected to an LED Display/Marquee. The PLC uses a specific command, SF, to display text on the sign. The code for displaying the time and date message is K201 % 2 STW141 :TIME " " STW141 :DATE K202 % 2. Currently, the date is displayed in the default format YY/MM/DD (e.g. 24/05/30). Is there a way to change this to dd/mm/yy format? Unfortunately, the CTI Programming Reference Manual does not provide information on date formatting. Despite claims from colleagues that it used to display in DD/MM/YY format, my attempts to manually format the date using variables (K201 % 2 STW141 :TIME " " V2125 V2126%2 V2127 V2128%2 V2129 K202 % 2) have been unsuccessful. Instead of the expected "12:00:00 D/MM/YY", the output shows "30 /24 /5" with no time displayed.

Top Replies

Hello Ekztal, According to the CTI manual, the TIME DATE print statement displays the date in the format YY/MM/DD, which may appear different to others. I have not personally used these statements and am unsure if they only function with status words. However, as the date and time are stored in STW141-STW144, you could attempt using Vmemory instead of the STWs. You can fill the first Vmemory with DD/MM, the second Vmemory with YY/HH, the third Vmemory with MM/SS (similar to STW143), and the fourth Vmemory with ms/weekday (similar to STW144). Please refer to the screenshot for further guidance. If this method does not work, you may need to create a date time message as you have already attempted. Please note that you are unable to merge parts of these two instructions. Kind regards, Henny

I am unclear about the new CTI instruction set. Can you explain the significance of the % 2 in the first two bytes?

2. To start with, print out the two characters stored in K201 from the example.

Ken Moore asks about the new CTI instruction set and the significance of the % 2 indication in the first two bytes. In my Programmable Logic Controller (PLC), the addresses K201 and K202 store the ASCII characters STX and EOT. These messages are transmitted to the LED sign via the RS-232 serial port, with each message starting and ending with STX and EOT.

Henny mentioned that the TIME DATE print statement in the CTI manual displays the date in YY/MM/DD format, which may appear differently to other users. If the standard STW addresses are not working for you, consider using Vmemory addresses instead. You can try filling the Vmemory addresses with the following combinations: DD/MM for the first, YY/HH for the second, MM/SS for the third (similar to STW143), and ms/weekday for the fourth (similar to STW144). If this method doesn't work, you may need to create a date time message using a different approach. For example, combining V addresses like K201 % 2 STW141 : TIME " " V2125 V2126%2 V2127 V2128%2 V2129 K202 % 2. However, be mindful that each address may contain blank spaces when displayed. If you're looking to extract only the last two characters from an address like V2125, consider exploring other coding options.

More Replies

Hey everyone, I successfully displayed the Time and Date in the preferred MM/DD/YY format by utilizing the Time of Day SF and converting address values to binary values for 2 ASCII characters representing the month, day, or year. For example, if V2125 equals 1, then I set V2125 as 00110000 00110001, which corresponds to the ASCII characters for 01. This can be added to the print message string for the month. In the code snippet below, the program "DDMMYY" is set to continue on error with a normal program type and an enabled status. It compiles successfully. It seems that CTI PLC's only support dates up to the year 2036, suggesting that it might be time for my company to start transitioning them out by then.

Hello Ekztal, you have the option to use the code shown in the images as an alternative to your case statements. If V2125, V2127, and V2129 are solely for displaying messages, this code may be a more concise solution. It's great that you have already successfully implemented it. Regards, Henny.

Henny suggested an alternative method for implementing code based on the screenshots provided. Assuming that only the variables V2125, V2127, and V2129 are utilized to display messages, this approach is more concise. It's great that you have already achieved success with it. Looking forward to trying it out tomorrow. Could you please clarify the functions of MOD 10 and 0H3030? Thanks once again for your assistance.

Greetings Ekztal! The process involves extracting the tens digit from an integer and shifting it 8 places to the left, corresponding to the tens character's position. The decimal numbers 1-9 are equivalent to their hexadecimal counterparts. For example, 30 in hexadecimal is represented as ASCII 0, 3030 is ASCII 00, 3031 is ASCII 01, 3132 is ASCII 12, and 3230 is ASCII 20. For a more in-depth explanation of how the MOD function (Modulo) operates, you can refer to the Wikipedia page on Modulo. I trust that this clarifies how I arrived at the solution. Best regards, Henny

Frequently Asked Questions (FAQ)

FAQ: 1. How can I change the date format displayed on the CTI 2500 PLC LED sign from YY/MM/DD to dd/mm/yy?

Answer: - Unfortunately, the CTI Programming Reference Manual does not provide information on date formatting. Some attempts to manually format the date using variables have been unsuccessful.

FAQ: 2. Why is the date not displaying correctly when trying to format it manually on the CTI PLC connected to the LED Display/Marquee?

Answer: - The provided code for formatting the date and time message might not be correct. It seems like the output is not as expected and does not display the time correctly.

FAQ: 3. Is there a specific command or syntax to correctly format the date and time message on the CTI 2500 PLC using the SF command?

Answer: - It appears that the current code (K201 % 2 STW141 :TIME " " V2125 V2126%2 V2127 V2128%2 V2129 K202 % 2) for formatting the date and time might need adjustments to display the desired format of "12:00:00 D/MM/YY".

You must be a registered user to add a comment. If you've already registered,
sign in. Otherwise, register and sign in.