how can you use time/clock in pac machine edition/rx3i?

Andor

Member
Join Date
Nov 2021
Location
Amsterdam
Posts
77
Hello everyone,

I am not a programmer, but I can do some simple programming. So now I want the time to be recorded every time a pump turns on. I know how to do this with the shftword and move block. But how do you get the time? I know it can be done with the src_req 7. So I don't know exactly how to do that. does anyone have an example pdf? I read the manual about how to do it, but I still found it a bit too difficult.


What value can I use for time?
 
Last edited:
Yes it does appear that once you have read the date/time you need to convert it into integers, not having a system I cannot help you any further, if you have data returned then you need to convert it to either integers or perhaps ASCII chars whichever you need.
 
Yes it does appear that once you have read the date/time you need to convert it into integers, not having a system I cannot help you any further, if you have data returned then you need to convert it to either integers or perhaps ASCII chars whichever you need.

oke thank you.


I don't understand what that 16#ff means( in the manual) at IN2 at and_word. maybe someone can help me make a simple setup/example.
 
Last edited:
16#ff is hex for FF in other words 8 bits all "1"
8 4 2 1 8 4 2 1
1 1 1 1 1 1 1 1 (FF Hex)
or 15,15 decimal
But you are not going to write to the clock only read from it so you do not need the 3rd or 4th rung.
 
Here is a sample.
The "16#" prefix denotes a hex number. As you can see in the example, for the hex 81 format code you enter "16#81".
If you open a reference view table to look at the data returned in the registers starting at %R00004, be sure to change the display format to hex. Otherwise, the numeric data you see won't make any sense.
 
Here is a sample.
The "16#" prefix denotes a hex number. As you can see in the example, for the hex 81 format code you enter "16#81".
If you open a reference view table to look at the data returned in the registers starting at %R00004, be sure to change the display format to hex. Otherwise, the numeric data you see won't make any sense.

As soon as you enter rung 8 16#81, things don't work properly. I did it like the photo below, then it works fine. Only for the values, r5102 shows the month/year, r5103 hours/day and r5104 minutes/seconds and R5105 shows 7. Is it because I have a value of r5100, a convenience cat and created an array of 6? how do i get this right?

A53970F3-7FE9-4085-8248-5F38CC34289C.jpeg D87AD101-4B5B-4FD9-A4A1-094A39BB4987.jpeg 243DCC9D-9BAB-4664-9C7C-70DC4FBE6FB6.jpeg
 
Here is a sample.
The "16#" prefix denotes a hex number. As you can see in the example, for the hex 81 format code you enter "16#81".
If you open a reference view table to look at the data returned in the registers starting at %R00004, be sure to change the display format to hex. Otherwise, the numeric data you see won't make any sense.

I have try that but still 0

743525F8-703F-4814-8D99-98354C051433.jpeg 1251FF61-D936-403E-9164-8FEC9121B26F.jpeg E6AB56C9-2713-4FCA-B8B8-3531AC7BFBE9.jpeg
 
What CPU are you using? The 16#81 format code is only valid for RX3i and VersaMax CPUs per the help files.

Based on your screen captures in post #8, you selected format code 1 (2-digit year). That returns data per the following format:
First returned word; high byte = month; low byte - 2-digit year
Second returned word: high byte = hour; low byte = day of month
Third returned word: high byte = seconds; low byte = minutes
Fourth returned word: high byte = null; low byte = day of week

The example I sent was for an Rx3i using four-digit year which returns data as:
First returned word; high byte = century; low byte - 2-digit year
Second returned word: high byte = day of month; low byte = month
Third returned word: high byte = minute; low byte = hour
Fourth returned word: high byte = day of week; low byte = second
 
What CPU are you using? The 16#81 format code is only valid for RX3i and VersaMax CPUs per the help files.

Based on your screen captures in post #8, you selected format code 1 (2-digit year). That returns data per the following format:
First returned word; high byte = month; low byte - 2-digit year
Second returned word: high byte = hour; low byte = day of month
Third returned word: high byte = seconds; low byte = minutes
Fourth returned word: high byte = null; low byte = day of week

The example I sent was for an Rx3i using four-digit year which returns data as:
First returned word; high byte = century; low byte - 2-digit year
Second returned word: high byte = day of month; low byte = month
Third returned word: high byte = minute; low byte = hour
Fourth returned word: high byte = day of week; low byte = second


ah okay, I was first testing it on a 90-30 so that I can immediately program it in the rx3i that is in operation. I have a screenshot of the values ​​below. the month and hours are 4 digits. once I get all this. For example, how can I log this time and then use it? Do these values ​​all have to be read at the same time? Or do I have to merge these first? I want to show the time on an HMI. I will do this by logging the time every time the pump is turned on and showing it every other time on the HMI. This way I can see the time of the last 10 times the pump was turned on.
 
Do these values ​​all have to be read at the same time?
Every time you execute the SVC_REQ you get an update of all the returned data. If you execute the SVC_REQ every scan, the returned data will continuously change. To capture the pump start time, trigger an execution of the SVC_REQ by the rising edge of the pump run command.
To log the last ten start times you could use a shift register function (SHFR_WORD). If hour and minute is sufficiently accurate you could combine those two values into a single word and display it on the HMI. If you need to display hh:mm:ss you could use three SHFR instructions, one with the hour, one with the minute, and one with the second.
 
What HMI are you using? It may be easier to grab date and time there, instead of putting it together from RX3i logic.
 
Every time you execute the SVC_REQ you get an update of all the returned data. If you execute the SVC_REQ every scan, the returned data will continuously change. To capture the pump start time, trigger an execution of the SVC_REQ by the rising edge of the pump run command.
To log the last ten start times you could use a shift register function (SHFR_WORD). If hour and minute is sufficiently accurate you could combine those two values into a single word and display it on the HMI. If you need to display hh:mm:ss you could use three SHFR instructions, one with the hour, one with the minute, and one with the second.

I can do the shfr_word. I just don't understand how to make those two values ​​1 without changing them? which function is best to use for this?
 
In the example I sent you, rung 14 shows you how to mask off the minute from the high byte of %R1704 leaving the hour in the low byte of %R1706.
Rung 16 shows how to mask off the hour from the low byte of %R1704 and then shift the result (minute) to the low byte of %R1707.

Use the AND function with the appropriate mask to isolate the hour and minute data. Then, if you need to shift from low byte to high byte, multiply by 256. If you need to shift fro high byte to low byte, divide by 256. Once you have the data you want in the high and low bytes of two separate words. with zero in the opposite byte of each word, use the OR function to combine them into a single word.
 

Similar Topics

We recently purchased a IC693CPU352 module and it appears the internal time clock is static. I can set the time and date but once set it does not...
Replies
5
Views
174
Hello. I cannot change the SendClock settings for a PROFINET IO device. I need to slow down the CODESYS PROFINET IO controller. What am I doing...
Replies
0
Views
204
Hello, I am trying to create an AOI that will retrive the clock datetime bits from a master plc through a generic message read instruction and...
Replies
2
Views
501
I was online a SLC5/04 yesterday and one thing I did was go to processor properties and set the date and time to get the PLC clock current. It...
Replies
4
Views
724
At the moment on my application (S7-1212C), the PLC/HMI are showing the correct time, i.e. the displayed time matches the time of the clock on the...
Replies
10
Views
920
Back
Top Bottom