Difference between A.M & P.M

dbh6

Lifetime Supporting Member
Join Date
Jan 2013
Location
Central, NJ
Posts
552
Hello guys,

Something got me thinking, now we all know that most PLC's have their own internal time clock for Hr, Min, sec, and some even micro seconds.

My questions is say you want to write logic to fire at certain times during the day, how will the PLC tell if its AM or PM

For example say you want the PLC to turn off an output say at 12:00pm during lunch , if you program that in your logic you can have an EQU instruction for when the Hr, and Min are equal to 12 and 00 respectively and when it equals that have it turn off a certain output, but when the time equals 12:00AM in the morning the PLC will still turn of that output because all the plc is doing is looking for the numbers 12 and 00, so how can you program in a way that the plc will tell the difference?
 
First convert the entry to a 24 hour clock equivalent. Then the comparisons are easier.

Conversion algorithm:

If hour = 12 AND AM_PM = AM then hour = 0
If AM_PM = PM then hour = hour +12

Or just force the operators to use a 24 hour clock.
 
First convert the entry to a 24 hour clock equivalent. Then the comparisons are easier.

Conversion algorithm:

If hour = 12 AND AM_PM = AM then hour = 0
If AM_PM = PM then hour = hour +12

Or just force the operators to use a 24 hour clock.

+1

There is a reason the military (and PLCs) use the 24-hour clock. When precision matters, don't add an element of ambiguity to the system, and extra programming, just to cater to the guy who can't add 12 to X:XX pm to get military time.

That's my "you can't fix stupid" thought of the day, anyway.

@dbh6

In your example, with any PLC that I'm familiar with, then there is no issue to beware of. If you want to kill an output at 12:00 pm exactly, then just do (Logix5000 example):

Code:
EQU Sys_Time[3] 12 EQU Sys_Time[4] 0 ONS My_Output_Reset_ONS OTU My_Output

You would not have to worry about the OTU re-executing at 12:00am, as that would be 00:00 in PLC time, so Sys_Time[3] would =0.

This example assumes "Sys_Time" is a DINT[7] array that has the PLC WallClockTime DateTime GSV'd to it. In a PLC-5 or SLC-500, you would have to use the "S" registers for the system time.
 
Last edited:
If you want to kill an output at 12:00 pm exactly, then just do (Logix5000 example):

Code:
EQU Sys_Time[3] 12 [COLOR=Red]EQU Sys_Time[4] 0[/COLOR] ONS My_Output_Reset_ONS OTU My_Output

EQU Sys_Time[3] 12 ONS My_Output_Reset_ONS OTU My_Output

No need to look at Minutes=0 at all, it can only be Hour=12 once a day, the ONS will do for the hour what it did for the minute.
 
The ONS tests of time are easy but what if the system was powered off through the critical time and comes back on within or after that test time? The one-shot won't fire.
 
Bernie - On pre-scan, the ONS storage bit is set to prevent a false trigger when the rung is scanned true.

If the rung is scanned true on the first logic scan, nothing happens.

If the rung is scanned false on the first logic scan, the ONS storage bit is reset.

The only problem you will have is if the processor is turned off before the event, and turned on after the event, in which case much more logic is needed to say "we should have done this at mid-day, but couldn't, so need to do it now (if applicable)". Depends what is needed.
 
Last edited:

Similar Topics

Hello, I have a problem with AO- and AA-Tags. When I use for example the tag AO_Test with the address 200 and type the value 1,2 in, the AA-Tag...
Replies
7
Views
1,410
As per the title. This might seem like a basic question to many, but I'm unclear about the difference between a coil ( ) and an application...
Replies
28
Views
4,031
Good Morning , I have 2 Frequency Drive panels to build and commission . It is for 2 pump systems . Just wondering , what is the...
Replies
4
Views
1,969
Hi Experts, Good day! What are the differences between PCS7 SIMATIC Batch and PM Control? Do you have any manual like "Getting Started "...
Replies
0
Views
809
I have a Automation Direct Click Plus that you can buy option CPU slot modules for input/outputs. The slot modules have the options of sinking...
Replies
9
Views
2,816
Back
Top Bottom