I have some logic that I have written within a 5380 series controller that tracks the time an event is started, while the event is running an RTO is accumulating until completion which then triggers logic to capture the time that the event stops. I use a GSV instruction that is executed from a one shot to capture the started and finished date and time from the PLC's RTC. I then take the timers .ACC value and divide that by 1000 so that I can display the duration of the event in seconds. What I am running into is the fact that it seems regardless of what the .ACC value is from the timer, when dividing by 1000 it rounds down. For example 22999 rounds down to 22 and the tag that I am using as the DEST for the DIV instruction that I just mentioned is a DINT data type.
My question is in regards to the PLC's RTC and the GSV instruction. When the GSV is triggered and the seconds are read from the PLC's RTC, is the seconds value rounded as well? I assume the seconds value is based on the microseconds value from the RTC for the rounding. There are times where the GSV shows the correct elapsed time from the Start and Finished triggers, but when I do the math on the .ACC from the timer, its off by one second. Which makes sense based on the rounding of the timers .ACC DINT value.
My question is in regards to the PLC's RTC and the GSV instruction. When the GSV is triggered and the seconds are read from the PLC's RTC, is the seconds value rounded as well? I assume the seconds value is based on the microseconds value from the RTC for the rounding. There are times where the GSV shows the correct elapsed time from the Start and Finished triggers, but when I do the math on the .ACC from the timer, its off by one second. Which makes sense based on the rounding of the timers .ACC DINT value.