No announcement yet.

turn on output at 10pm and turn off at 5am

  • Filter
  • Time
  • Show
Clear All
new posts

  • turn on output at 10pm and turn off at 5am


    I am trying to write a program to turn on each output of my PLC each day. For example,

    Y1 is turned on, on Jan 1st,
    Y2 on Jan 2nd
    Y3 on Jan 3rd
    Y4 on Jan 5th
    Y5 on Jan 6th
    Y6 on Jan 7th

    and the cycle repeats itself for the whole month and similarly for the whole year from Jan to Dec.

    I have made my ladder logic program for the case when I have to turn on and off the output on the same day, for example turn on at 8am and turn off at 4pm.
    But now I am struggling to turn on the output at 11pm at night on (lets say Jan 1) and turn it off at 2am (Jan 2).

    I am not sure on how to include the condition to change the day.

    The on and off times are to be input from the user. So the user can choose any time, for example on_time = 8 , off_time=12 (my code works fine for this) or on_time = 22 , off_time=2.

    In my code , when the RTC conditions are satisfied, C1 is on, which turns on the timer. Timer T1 turns on Y1.

    Thank you

    Attached Files