24HR Time in Compactlogix

Join Date
Jan 2013
Location
california
Posts
32
Hello all and Happy New Year... almost

I need to get the 24 hr time in a compactlogix PLC (Version 33). I am having a hard time with the data conversion of GSV and Wall Clock time. Here is what I have so far...

DTOS - Convert Hour (INT) to String
DTOS - Convert Minute (INT) to String
CONCAT- Concatenate Hour and Minute String
STOD - Convert from String to DINT

Seems to work however it is truncating the zeros, for example, 0702 = 72, 1001 = 101.

Does anyone have a better solution for this? Would this be easier in Structured Text?

LadderPic.png
 
as integers 10000 + (Hours * 100 + Minutes) then DTOS that value, then extract the last four characters


e.g.
ADD PLC_Clock[3] 100 temporary_int
MUL temporary_int 100 temporary_int
ADD temporary_int PLC_Clock[4] temporary_int
DTOS temporary_int hhmm_string
MID hhmm_string 4 2 hhmm_string

 
I guess I didn't read it carefully.


I don't know, but if I wanted a pump to run for x hours and x minutes, I would just use integers.


The only strings I like are associated with bikinis and cheese. LOL


Have a good one!
 
That mess I posted above was from 2019. I had to do 3 shifts of start of shift, 1st break, lunch break, 2nd break, end of shift's. Operator had to poke a few things on the Red Lion Graphite to track.


I can tell you that the PLC wall clock in a 5380 is more accurate than the Red Lion G15 clock.


I don't know if they ever did sync these to a master.
 
I would keep the hours/minutes as separate integers. Makes everything else easier, comparisons against the RTC etc.
Perhaps, but it is sometimes more intuitive for the operator to enter the time SP in that format.
For me, I prefer 24hr format in a single word. Just makes it easier for readability
 
Perhaps, but it is sometimes more intuitive for the operator to enter the time SP in that format.
For me, I prefer 24hr format in a single word. Just makes it easier for readability

If the number is in Hex/BCD maybe. In decimal clamping the value entered or incrementing/decrementing becomes more difficult. How do you prevent invalid numbers like 173 or 265 from being entered? Or do you have to enter the minutes and hours separately?
 

Similar Topics

Hello, I was needing some help with a task i have i will try to explain & be detailed I'm using Wonderware software in our SCADA system I have a...
Replies
33
Views
7,892
Is there 24hr clock in PLC 5-40 AB or I have to build one myself on timers for production statistics logic ?
Replies
3
Views
2,424
Unregistered
U
So basically i have 2 queries : 1. I have a program file of S7-300 PLC which i want to migrate in RSLogix500.In short i want to convert my simatic...
Replies
14
Views
137
Hi everyone, i have a compact logic 1769-L18 PLC and I'm using FTalk View ME for the display. I wanted to do some visualization on Grafana. At...
Replies
1
Views
99
Does anyone know what the data transfer rate for this series of CompactLogix PLC's? 1769-L24ER-QB1B to be exact. Cheers.
Replies
1
Views
100
Back
Top Bottom