3 ) programming example – Yaskawa MP900 Series Ladder Programming Manual User Manual

Page 118

Advertising
background image

5.3 Numeric Operation Instructions

5.3.14 Spend Time (SPEND)

5-49

Instructions

5

Time data B is formatted as shown below.

Time data A is formatted as shown below.

If the operation result exceeds any of the data ranges given above, time data A is not updated, the seconds data is set to
9,999, and the status bit is set to 1 (ON).
If the operation result is within the ranges, the status bit is set to 0 (OFF).

A year is calculated as 365 days. Leap years are not supported.

The number of months is not calculated. Only the number of days is calculated.

( 3 ) Programming Example

The following table gives typical conditions for creating ladder programming that uses the SPEND instruction.
(The elapsed time between November 20, 2010, 02:10:50 and October 10, 2009, 00:50:20 is found.)

Offset

Contents

Data Range (BCD)

I/O

0

Year (BCD)

0000 to 0099

IN

1

Month/day (BCD)

Upper byte (month): 01 to 12
Lower byte (day): 01 to 31

IN

2

Hour/minutes (BCD)

Upper byte (hour): 00 to 23
Lower byte (minutes): 00 to 59

IN

3

Seconds (BCD)

0000 to 0059

IN

Offset

Contents

Data Range (BCD)

I/O

0

Year (BCD)

0000 to 0099

IN/OUT

1

Month/day (BCD)

Upper byte (month): 01 to 12
Lower byte (day): 01 to 31

IN/OUT

2

Hour/minutes (BCD)

Upper byte (hour): 00 to 23
Lower byte (minutes): 00 to 59

IN/OUT

3

Seconds (BCD)

0000 to 0059

IN/OUT

4

Total number of seconds

Operation result of years, months, days,
hours, minutes, and seconds converted
into seconds (double-length integer)

IN/OUT

5

INFO

Time A before Execution of Instruction

Time B

Year

MW00000 = 0010 hex

(2010)

MW00006 = 0009 hex

(2009)

Month/day

MW00001 = 1120 hex

(November 20)

MW00007 = 1010 hex

(October 10)

Hour/minutes

MW0002 = 0210 hex

(2:10)

MW00008 = 0050 hex

(0:50)

Seconds

MW00003 = 0050 hex

(50 seconds)

MW00009 = 0020 hex

(20 seconds)

Advertising
This manual is related to the following products: