12hr clock

There's a very nice 24-hour clock built into the Status file of the SLC-500 controllers.

What exactly do you need to do ?
 
  1. Ken Roach,I need to devise a SLC 5/03 program that will implement a 12 hour clock. The hours should be consistent with a real clock in that they go from 1 - 12. Also use output o:2/00 as an AM/PM indicator. Address 0:4.0 is the address of the digital display. Display the time according to the following arrangement:​

Input Pressed Display
1:1/07 Hours
1:1/10 Minutes
Both or neither Seconds
of the above​
 
The hours should be consistent with a real clock in that they go from 1-12.

Whoever set this as project work should know that a 12-hour clock goes from 00:00 to 11:59, so the hours don't go from 1-12, but from 0-11

Take a look at the Real-Time clock data in the Status file as Ken has pointed you to. In there you will find the data that you can now write code to manipulate, according to the problem presented to you.

What have you done so far? Can you post what you have done?
 
Okay, sounds like a neat little project.

First, the AM/PM indicator.

The actual Hours value is in the Status register S:40 and goes from 0 to 23. Since you know the hours 0 through 11 are AM and the hours 12 through 23 are PM, you can use a Limit (LIM) instruction or a pair of Greater Than or Equal To (GEQ) and Less Than or Equal To (LEQ) instructions to set the "PM" indicator.

Next, the "Hour" value. Because of the way we express hours in civilian 12-hour parlance, you're going to need to subtract 12 from the PM hours, and add an exception for the hour between midnight and 1 AM.

If you can think it through and express it, then Forum members can help you put it into SLC-500 instructions.
 
Also your digital display at address O:4.0 just might be a BCD display - your data will need conversion
 
...
The actual Hours value is in the Status register S:40 and goes from 0 to 23. Since you know the hours 0 through 11 are AM and the hours 12 through 23 are PM, you can use a Limit (LIM) instruction or a pair of Greater Than or Equal To (GEQ) and Less Than or Equal To (LEQ) instructions to set the "PM" indicator.

And "PM" stands for "Post Meridian", so you only need a single "Greater Than" (GRT) Instruction to test for PM
 
Also, watch out for the "gotcha"....

"Both or neither of the above - Seconds"

If you don't code the rung conditions properly, then the "last one wins" rule may get you.
 
I really thank you you people for your in put. I up graded to a years membership. But don,t know my way around. Could someone lead me through the programming rungs. I,ve not been doing programming for all that long
 
I could post you a whole program, but you would learn little.

Are you aware of the SLC Status data-file?

And welcome to the forum !!
 
Last edited:
I don,t want the answer given to me. But my teacher in collage doesn,t explain it good enough for me to grasp it. there are three trainers in this class. And eight students. I just want some one to explaine it so i can grasp how to know what to put were.
 
woodys1 said:
Input Pressed Display
1:1/07 Hours
1:1/10 Minutes
Both or neither Seconds
of the above

This is pretty close to a program.

1) You need to get a copy of the clock hours (S:40), and when GRT-er than 12, SUB-tract 12.
2) When Input I:1/07 is on (assuming a N.O. pushbutton) MOV your internal N register for hours to O:4.0
3) When normally open PB I:1/10 is on, MOV the s register (S:41) to the destination O:4.0

4) When [I:1/07 AND (series XIC instructions) I:1/10]<-one branch are both on OR (other branch) they are both off (XIO instructions), MOV S:42 to O:4.0

Now, you have 90% of a program.
 
3 trainers, 8 students !!!! omg

OK, I'll try to make it easy....


a> S:40 contains the HOURS in 24-hour format, 0-23
You will need to MOV this to an internal register, eg. N7:0.
then check the internal register to see if it is greater than 11, and subtract (SUB) 12 if it is. Branch round the SUB to OTE the bit used to indicate "PM"

b> you don't need to move the minutes from S:41, or the seconds from S:42

c> now set up some rungs to MOV the data you now have to the output O:4.0

If "minutes" button pressed - MOV the minutes data, S:41
If "seconds" button pressed - MOV the seconds data, S:42
If neither pressed - MOV the adjusted hour, N7:0
 

Similar Topics

I,m Just starting in plc class. an i,m not sure how to set up a program about a 12hr clock on a plc slc 500.I ask for some help which I recived...
Replies
9
Views
2,914
plc:AB SLC 504 anyone have any ideas on using the plc clock as a password for the oit's. I was converting 0-23 to 1-12 then * 60 then add...
Replies
0
Views
2,248
I need to calculate the running 12hr total for a belt scale. The belt scale running hour total is done in a Compactlogix PLC but not a 12hr total...
Replies
22
Views
4,227
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
170
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
199
Back
Top Bottom