Description of the function

The SCHEDULE function is used to control actions at pre-defined or calculated times and dates.

It sets the OUT output to 1 if the date provided by the PLC clock at the time the function is called falls within the period programmed in the input parameters.

The additional parameters EN and ENO can be configured.

FBD representation

Representation:

LD representation

Representation:

IL representation

Representation:

LD DBEG
SCHEDULE DEND, WEEK, HBEG, HEND, Date_OK

ST representation

Representation:

SCHEDULE(DBEG, DEND, WEEK, HBEG, HEND, Date_OK);

Description of the parameters

The following table describes the input parameters:

Parameter

Type

Comment

DBEG

INT

Integer coding the start date of the period (month-day) in BCD (threshold values: 01-01 to 12-31).

DEND

INT

Integer coding the end date of the period (month-day) in BCD (threshold values: 01-01 to 12-31).

WEEK

INT

Integer coding the day(s) of the week taken into account in the period defined by the DBEG and DEND parameters.

The 7 least significant bits represent the 7 days of the week: bit 6 = Monday, bit 5 = Tuesday, etc., bit 0 = Sunday.

HBEG

DINT

Double integer coding the start time of the period in the day (hours-minutes-seconds) in BCD day time format. Threshold values: 00:00:00, 23:59:59.

HEND

DINT

Double integer coding the end time of the period in the day (hours-minutes-seconds) in BCD day time format. Threshold values : 00:00:00, 23:59:59.

The following table describes the output parameters:

Parameter

Type

Comment

Date_OK

EBOOL

The Date_OK output is set to 1 if the date provided by the PLC clock at the time the function is called falls within the period programmed in the input parameters.

NOTE:
  • The two parameters DBEG and DEND define a range of days in the year. This period may extend over two calendar years. Example : from October 10 to April 7. February 29 may be used in this period, and will be ignored in non-leap years.

  • The two parameters HBEG and HEND define a range of time in the day. This range may extend over two days. Example : from 22:00 to 06:10:20.

  • If one of the DBEG and DEND dates, or one of the HBEG and HEND times is incorrect, (i.e. does not correspond to a real date or time) the Date_OK output will be 0 and the %S18 bit will be set to 1.

  • It is possible to lighten the load on the PLC processor when the requirement for precision is low by pacing calls to the SCHEDULE function via the %S6 or %S7 system bits.

Examples

Programming two non-continuous time ranges:

SCHEDULE

(16#0501,

16#1031,

2#0000000001111100,

16#08300000,

16#12000000,

Date1_OK

);

(*start date: 1st May*)

(*end date: October 31*)

(*Monday to Friday*)

(*start time: 08:30*)

(*end time: 12:00*)

(*result in Date1_OK*)

SCHEDULE

(16#0501,

16#1031,

2#0000000001111100,

16#14000000,

16#18000000,

Date2_OK

);

(*start date: 1st May*)

(*end date: October 31*)

(*Monday to Friday*)

(*start time: 14:00*)

(*end time: 18:00*)

(*result in Date2_OK*)

%Q0.0

:=Date1_OK OR Date2_OK;

(*assignment of the output to Date1_OK or Date2_OK*)