9: boolean computation instructions...11 1 s1 + s2 d1 when input is on, 16- or 32-bit data assigned...

98
SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 9-1 9: BOOLEAN COMPUTATION INSTRUCTIONS Introduction Boolean computations use the AND, OR, and exclusive OR statements as carried out by the ANDW, ORW, and XORW instructions in the word or double-word data, respectively. ANDW (AND Word) ORW (OR Word) XORW (Exclusive OR Word) Applicable SmartAXIS S1 · S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ANDed, bit by bit. The result is set to destination device D1. S1 = 1 1 1 0 0 1 S2 = 1 0 1 1 0 0 D1 = 1 0 1 0 0 0 REP ** S1(R) ***** D1(R) ***** ANDW(*) S2(R) ***** S1 S2 D1 0 0 0 0 1 0 1 0 0 1 1 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination device D1. S1 = 1 1 1 0 0 1 S2 = 1 0 1 1 0 0 D1 = 1 1 1 1 0 1 REP ** S1(R) ***** D1(R) ***** ORW(*) S2(R) ***** S1 S2 D1 0 0 0 0 1 1 1 0 1 1 1 1 FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-Touch X X X X X S1 S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are exclusive ORed, bit by bit. The result is set to destination device D1. S1 = 1 1 1 0 0 1 S2 = 1 0 1 1 0 0 D1 = 0 1 0 1 0 1 REP ** S1(R) ***** D1(R) ***** XORW(*) S2(R) ***** S1 S2 D1 0 0 0 0 1 1 1 0 1 1 1 1

Upload: others

Post on 21-Feb-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 9-1

9: BOOLEAN COMPUTATION INSTRUCTIONS

IntroductionBoolean computations use the AND, OR, and exclusive OR statements as carried out by the ANDW, ORW, and XORW instructions in the word or double-word data, respectively.

ANDW (AND Word)

ORW (OR Word)

XORW (Exclusive OR Word)

Applicable SmartAXIS

S1 · S2 D1

When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ANDed, bit by bit. The result is set to destination device D1.

S1 = 1 1 1001

S2 = 1 0 1100

D1 = 1 0 1000

REP**

S1(R)*****

D1(R)*****

ANDW(*) S2(R)*****

S1 S2 D10 0 0

0 1 0

1 0 0

1 1 1

S1 + S2 D1

When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination device D1.

S1 = 1 1 1001

S2 = 1 0 1100

D1 = 1 1 1101

REP**

S1(R)*****

D1(R)*****

ORW(*) S2(R)*****

S1 S2 D10 0 0

0 1 1

1 0 1

1 1 1

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-TouchX X X X X

S1 S2 D1

When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are exclusive ORed, bit by bit. The result is set to destination device D1.

S1 = 1 1 1001

S2 = 1 0 1100

D1 = 0 1 0101

REP**

S1(R)*****

D1(R)*****

XORW(*) S2(R)*****

S1 S2 D10 0 0

0 1 1

1 0 1

1 1 1

Page 2: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

9: BOOLEAN COMPUTATION INSTRUCTIONS

9-2 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Valid Devices

For valid device address ranges, see "Device Addresses" on page 3-1.

Internal relays M0 through M1277 can be assigned as D1. Special internal relays cannot be assigned as D1.

When T (timer) or C (counter) is used as S1 or S2, the timer/counter current value (TC or CC) is displayed. When T (timer) or C (counter) is used as D1, the data is written in as a preset value (TP or CP) which can be 0 through 65535.

Since the Boolean computation instructions are executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction should be used.

Valid Data Types

Example: XORW

To convert optional output status among a series of 10 output points, use the XORW instruction in combination with 10 internal relay points.

Device Function I Q M R T C D Constant RepeatS1 (Source 1) Data for computation X X X X X X X X 1-99

S2 (Source 2) Data for computation X X X X X X X X 1-99

D1 (Destination 1) Destination to store results — X X X X X — 1-99

W (word) X When a bit device such as I (input), Q (output), M (internal relay), or R (shift register) is assigned as the source or destination, 16 points (word data) or 32 points (double-word data) are used. When repeat is assigned for a bit device, the quantity of device bits increases in 16- or 32-point increments.

When a word device such as T (timer), C (counter), or D (data register) is assigned as the source or destination, 1 point (word data) or 2 points (double-word data) are used. When repeat is assigned for a word device, the quantity of device words increases in 1- or 2-point increments.

I (integer) —

D (double word) X

L (long) —

F (float) —

0 0 00 0 0 1 10 0 1 0 1 0 1 0

Q0Q7Q10Q11

10 points

M0M7M10M17

This program will invert the status of the shaded outputs on the left from on to off, and those not shaded from off to on.

M8120

REPS1 –M0

S2 –Q0

D1 –Q0

SOTUI1

XORW(W)

M0S

M2S

M4S

M6S

M10S

Ten outputs Q0 through Q11 are assigned to 10 internal relays M0 through M11.

Five internal relays M0, M2, M4, M6, and M10 are set by initialize pulse special internal relay M8120.

When input I1 is turned on, the XORW instruction is executed to invert the status of outputs Q0, Q2, Q4, Q6, and Q10.

Page 3: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 9-3

9: BOOLEAN COMPUTATION INSTRUCTIONS

Repeat Operation in the ANDW, ORW, and XORW Instructions

Source devices S1 and S2 and destination device D1 can be assigned to repeat individually or in combination. When destination device D1 is not designated set to repeat, the final result is set to destination device D1. When repeat is assigned, consecutive devices as many as the repeat cycles starting with the designated device are used. Since the repeat operation works similarly on the ANDW (AND word), ORW (OR word), and XORW (exclusive OR word) instructions, the following examples use the ANDW instruction.

Repeat One Source Device Data Type: Word

When only S1 (source) is assigned to repeat, the final result is set to destination device D1.

Data Type: Double Word

When only S1 (source) is assigned to repeat, the final result is set to destination device D1·D1+1.

Repeat Destination Device Only Data Type: Word

When only D1 (destination) is assigned to repeat, the same result is set to 3 devices starting with D1.

Data Type: Double Word

When only D1 (destination) is assigned to repeat, the same result is set to 3 devices starting with D1·D1+1.

Repeat Two Source Devices Data Type: Word

When S1 and S2 (source) are assigned to repeat, the final result is set to destination device D1.

Data Type: Double Word

When S1 and S2 (source) are assigned to repeat, the final result is set to destination device D1·D1+1.

I1 D10

S1 (Repeat = 3) D1 (Repeat = 0)S2 (Repeat = 0)

· (D30)D20

D11

D12

·

·

D20

D20

(D30)

D30

SOTU REP3

S1 RD10

D1 –D30

S2 –D20

ANDW(W)

D12·D13

D10·D11

D14·D15

S1 (Repeat = 3) D1 (Repeat = 0)S2 (Repeat = 0)

·

·

·

(D30·D31)

(D30·D31)

D30·D31

D20·D21

D20·D21

D20·D21

I1SOTU REP

3S1 RD10

D1 –D30

S2 –D20

ANDW(D)

I1REP3

S1 –D10

D1 RD30

S2 –D20

SOTU ANDW(W)D10

S1 (Repeat = 0) D1 (Repeat = 3)S2 (Repeat = 0)

· D30D20

D10

D10

·

·

D20

D20

D31

D32

I1REP3

S1 –D10

D1 RD30

D10·D11

D10·D11

D10·D11

S1 (Repeat = 0) D1 (Repeat = 3)S2 –D20

S2 (Repeat = 0)

·

·

·

D32·D33

D30·D31

D34·D35

D20·D21

D20·D21

D20·D21

SOTU ANDW(D)

I1REP3

D1 –D30

S2 RD20

SOTUD10

S1 (Repeat = 3) D1 (Repeat = 0)S2 (Repeat = 3)

· (D30)D20

D11

D12

·

·

D21

D22

(D30)

D30

S1 RD10

ANDW(W)

I1REP3

D1 –D30

D12·D13

D10·D11

D14·D15

S1 (Repeat = 3) D1 (Repeat = 0)S2 RD20

S2 (Repeat = 3)

·

·

·

(D30·D31)

(D30·D31)

D30·D31

D22·D23

D20·D21

D24·D25

SOTU S1 RD10

ANDW(D)

Page 4: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

9: BOOLEAN COMPUTATION INSTRUCTIONS

9-4 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Repeat Source and Destination Devices Data Type: Word

When S1 (source) and D1 (destination) are assigned to repeat, different results are set to 3 devices starting with D1.

Data Type: Double Word

When S1 (source) and D1 (destination) are assigned to repeat, different results are set to 3 devices starting with D1·D1+1.

Repeat All Source and Destination Devices Data Type: Word

When all devices are assigned to repeat, different results are set to 3 devices starting with D1.

Data Type: Double Word

When all devices are assigned to repeat, different results are set to 3 devices starting with D1·D1+1.

Note: When a user program error occurs in any repeat operation, special internal relay M8004 (user program execution error) and the ERROR LED are turned on and maintained while operations for other instructions continues. For an advanced instruction that has caused a user program execution error due to an error in the source devices, results are not set to any destination.

I1REP3

S1 RD10

D1 RD30

S2 –D20

SOTU ANDW(W) D10

S1 (Repeat = 3) D1 (Repeat = 3)S2 (Repeat = 0)

· D30D20

D11

D12

·

·

D20

D20

D31

D32

I1REP3

S1 RD10

D1 RD30

D12·D13

D10·D11

D14·D15

S1 (Repeat = 3) D1 (Repeat = 3)S2 –D20

S2 (Repeat = 0)

·

·

·

D32·D33

D30·D31

D34·D35

D20·D21

D20·D21

D20·D21

SOTU ANDW(D)

I1REP3

D1 RD30

S2 RD20

SOTUD10

S1 (Repeat = 3) D1 (Repeat = 3)S2 (Repeat = 3)

· D30D20

D11

D12

·

·

D21

D22

D31

D32

S1 RD10

ANDW(W)

I1REP3

D1 RD30

D12·D13

D10·D11

D14·D15

S1 (Repeat = 3) D1 (Repeat = 3)S2 RD20

S2 (Repeat = 3)

·

·

·

D32·D33

D30·D31

D34·D35

D22·D23

D20·D21

D24·D25

SOTU S1 RD10

ANDW(D)

Page 5: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 10-1

10:SHIFT / ROTATE INSTRUCTIONS

IntroductionBit shift instructions are used to shift the data string starting with source device S1 to the left or right by 1 to 15 bits as designated. The data string can be 1 to 65535 bits. The result is set to the source device S1 and special internal relay M8003 (carry or borrow). The LSB or MSB is filled with 0 or 1 as designated.

Bit shift and rotate instructions are used to shift the 16- or 32-bit data string in the designated source device S1 to the left or right by the quantity of bits designated. The result is set to the source device S1 and special internal relay M8003 (carry or borrow).

The BCD left shift instruction shifts the BCD digits in two consecutive data registers to the left.

The word shift instruction is used to move 16-bit data to a destination data register and shifts down the data of subsequent data registers as many as designated.

SFTL (Shift Left)

Applicable SmartAXIS

Valid Devices

For valid device address ranges, see Chapter 5 "Special Functions" - "Device Addresses" in the SmartAXIS Touch User's Manual.

Internal relays M0 through M1277 can be designated as S1. Special internal relays cannot be designated as S1.

Since the SFTL instruction is executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction should be used.

CY S1

When input is on, N_B-bit data string starting with source device S1 is shifted to the left by the quantity of bits assigned by device Bits.

The result is set to source device S1, and the last bit status shifted out is set to special internal relay M8003 (carry or borrow). Zero or 1 assigned by source device S2 is set to the LSB.

S1*****

Bits**

SFTL S2*****

N_B*****

0Before shift: 1 0 1010 1 0 1 1 1101 0 0CY

M8003

MSB LSBS1

1After shift: 00 1010 1 0 1 1 1101 0 0CY

M8003

MSB LSBS1

Shift to the left

S2 = 0, N_B = 16, Bits = 1S2

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-TouchX X X X X

Device Function I Q M R T C D Constant RepeatS1 (Source 1) First data for bit shift — X X — — X — —

S2 (Source 2) Data to shift into the LSB X X X X — — — 0 or 1 —

N_B Number of bits in the data string — — — — — — X 1-65535 —

Bits Quantity of bits to shift — — — — — — X 1-15 —

Page 6: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

10: SHIFT / ROTATE INSTRUCTIONS

10-2 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Examples: SFTL N_B = 16 bits

N_B = 32 bits

M8120 is the initialize pulse special internal relay.

When the CPU starts operation, the MOV (move) instruction sets 43690 to data register D10.

Each time input I0 is turned on, 16-bit data of data register D10 is shifted to the left by 1 bit as assigned by device Bits. The last bit status shifted out is set to special internal relay M8003 (carry or borrow). Zeros are set to the LSB.

M8120REP

SOTUI0

S1 –43690

D1 –D10

S1D10

Bits1

SFTL

MOV(W)

S20

N_B16

0Before shift: D10 = 43690 1 1 1000 1 0 1 1 1000 1 0CY

M8003

MSB LSBD10

1After first shift: D10 = 21844 01 1000 1 0 1 1 1000 1 0CY

M8003

MSB LSBD10

Bits to shift = 1

0

00 0111 0 1 0 0 0111 0 00After second shift: D10 = 43688CY

M8003

MSB LSBD10

Shift to the left

S2

M8120 is the initialize pulse special internal relay.

When the CPU starts operation, the MOV (move) instructions set 0 and 65535 to data registers D10 and D11, respectively.

Each time input I0 is turned on, 32-bit data of data registers D10 and D11 is shifted to the left by 2 bits as assigned by device Bits. D10 is the low word, and D11 is the high word.

The last bit status shifted out is set to a carry (special internal relay M8003). Ones are set to the LSBs.

M8120REP

SOTUI0

S1 –0

D1 –D10

S1D10

Bits2

SFTL

MOV(W)

S21

N_B32

REPS1 –65535

D1 –D11

MOV(W)

Bits to shift = 2

1

Before shift:

0 0 0000 0 0 0 0 0000 0 0CY

M8003

MSB LSBD11

1

After shift:

10 0000 0 0 0 0 0000 0 1CY

M8003

MSB LSBD10

Shift to the left

01 1111 1 1 1 1 1111 1 0

1 1 1111 1 1 1 1 1111 1 1

D10 S2

D11

Page 7: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 10-3

10: SHIFT / ROTATE INSTRUCTIONS

SFTR (Shift Right)

Applicable SmartAXIS

Valid Devices

For valid device address ranges, see Chapter 5 "Special Functions" - "Device Addresses" in the SmartAXIS Touch User's Manual.

Since the SFTR instruction is executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction should be used.

S1 CY

When input is on, N_B-bit data string starting with source device S1 is shifted to the right by the quantity of bits assigned by device Bits.

The result is set to source device S1, and the last bit status shifted out is set to a carry (special internal relay M8003). Zero or 1 assigned by source device S2 is set to the MSB.

S1*****

Bits**

SFTR S2*****

N_B*****

0Before shift: 1 0 1010 1 0 1 1 1101 0 0CY

M8003

MSB LSBS1

0After shift: 11 1100 0 0 1 1 0010 1 1CY

M8003

MSB LSBS1

Shift to the right

S2 = 0, N_B = 16, Bits = 1S2

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-TouchX X X X X

Device Function I Q M R T C D Constant RepeatS1 (Source 1) First data for bit shift — X X — — X — —

S2 (Source 2) Data to shift into the MSB X X X X — — — 0 or 1 —

N_B Number of bits in the data string — — — — — — X 1-65535 —

Bits Quantity of bits to shift — — — — — — X 1-15 —

Page 8: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

10: SHIFT / ROTATE INSTRUCTIONS

10-4 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Example: SFTR Data Type: Word

Data Type: Double Word

M8120 is the initialize pulse special internal relay.

When the CPU starts operation, the MOV (move) instruction sets 29 to data register D10.

Each time input I0 is turned on, 16-bit data of data register D10 is shifted to the right by 2 bits as assigned by device Bits. The last bit status shifted out is set to special internal relay M8003 (carry or borrow). Zeros are set to the MSB.

M8120REP

SOTUI0

S1 –29

D1 –D10

S1D10

Bits2

SFTR

MOV(W)

S20

N_B16

0Before shift: D10 = 29 0 0 0000 0 0 0 0 0110 1 1CY

M8003

MSB LSBD10

0After first shift: D10 = 7 10 0000 0 0 0 0 1000 0 1CY

M8003

MSB LSBD10

Bits to shift = 2

0

10 0000 0 0 0 0 0000 0 0After second shift: D10 = 1CY

M8003

MSB LSBD10

1

0

0

Shift to the right

M8120 is the initialize pulse special internal relay.

When the CPU starts operation, the MOV (move) instructions set 65535 and 0 to data registers D10 and D11, respectively.

Each time input I0 is turned on, 32-bit data of data registers D10 and D11 is shifted to the right by 1 bit as assigned by device Bit. D10 is the low word, and D11 is the high word.

The last bit status shifted out is set to special internal relay M8003 (carry or borrow). Ones are set to the MSB.

M8120REP

SOTUI0

S1 –65535

D1 –D10

S1D10

Bits1

SFTR

MOV(W)

S21

N_B32

REPS1 –0

D1 –D11

MOV(W)

Bits to shift = 1

1

Before shift:

1 1 1111 1 1 1 1 1111 1 1CY

M8003

MSB LSBD10

1

After shift:

11 1110 1 1 1 1 1111 1 1CY

M8003

MSB LSBD10·D11

Shift to the right

00 0001 0 0 0 0 0000 0 0

0 0 0000 0 0 0 0 0000 0 0

D11

D11 D10

S2

Page 9: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 10-5

10: SHIFT / ROTATE INSTRUCTIONS

BCDLS (BCD Left Shift)

Applicable SmartAXIS

Valid Devices

For valid device address ranges, see "Device Addresses" on page 3-1.

When T (timer) or C (counter) is used as S2, the timer/counter current value (TC or CC) is displayed.

The number of digits that can be shifted as S2 are 1 through 7.

Make sure that the source data determined by S1 and S1+1 is between 0 and 9999 for each data register. If either source data is over 9999, a user program execution error will result, turning on special internal relay M8004 and the ERR LED on the SmartAXIS. When S2 is higher than 7, a user program execution error will also result.

When a user program execution error occurs, the execution of the instruction is canceled. The data in S1 and S1+1 is left unchanged and the next instruction is executed. For user program execution errors, see "User Program Execution Errors" on page 4-13.

Valid Data Types

When input is on, the 32-bit binary data assigned by S1 is converted into 8 BCD digits, shifted to the left by the quantity of digits assigned by S2, and converted back to 32-bit binary data.

Valid values for each of S1 and S1+1 are 0 through 9999.

The number of digits that can be shifted is 1 through 7.

Zero is set to the lowest digit after each shift.

BCDLS S1*****

S2*

Before shift:

After shift:

0 2 31

MSD

S1 S1+1

Shift to the left

LSD

4 6 75 0

1 3 42 5 7 060

When S2 = 1 (digits to shift)

0

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-TouchX X X X X

Device Function I Q M R T C D Constant RepeatS1 (Source 1) Data for BCD shift — — — — — — X — —

S2 (Source 2) Quantity of digits to shift X X X X X X X 1-7 —

W (word) — When a word device such as D (data register) is assigned as source S1, 2 points (double-word data) are used.

When a bit device such as I (input), Q (output), M (internal relay), or R (shift register) is assigned as source S2, 16 points are used.

When a word device such as T (timer), C (counter), or D (data register) is assigned as source S2, 1 point is used.

I (integer) —

D (double word) X

L (long) —

F (float) —

Page 10: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

10: SHIFT / ROTATE INSTRUCTIONS

10-6 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Example: BCDLS

M8120 is the initialize pulse special internal relay.

When the CPU starts operation, the MOV (move) instructions set 123 and 4567 to data registers D10 and D11, respectively.

Each time input I0 is turned on, the 32-bit binary data of data registers D10 and D11 assigned by S1 is converted into 8 BCD digits, shifted to the left by 1 digit as assigned by device S2, and converted back to 32-bit binary data.

Zero is set to the lowest digit after each shift.

REP

SOTUI0

S1 –4567

D1 –D11

S1D10

S21

BCDLS

MOV(W)

M8120REPS1 –

123D1 –D10

MOV(W)

Before shift:

After first shift:

0 2 31

D10 D11

Shift to the left

4 6 75 0

1 3 42 5 7 060

After second shift:MSD LSD

2 4 53 6 0 071

0

When S2 = 1 (digits to shift)

Page 11: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 10-7

10: SHIFT / ROTATE INSTRUCTIONS

WSFT (Word Shift)

Applicable SmartAXIS

Valid Devices

For valid device address ranges, see "Device Addresses" on page 3-1.

When T (timer) or C (counter) is used as S1 or S2, the timer/counter current value (TC or CC) is displayed.

Valid Data Types

Special Internal Relay M8024: BMOV/WSFT Executing Flag

While the BMOV or WSFT is executed, M8024 turns on. When completed, M8024 turns off. If the CPU is powered down while executing BMOV or WSFT, M8024 remains on when the CPU is powered up again.

Example: WSFT

When input is on, N blocks of 16-bit word data, starting with device assigned by D1, are shifted up to the next 16-bit positions. At the same time, the data assigned by device S1 is moved to the device assigned by D1. S2 specifies the quantity of blocks to move.

WSFT S1*****

D1*****

S2*****

When S2 = 3 (quantity of blocks to shift)

First 16-bit dataD1+0

Second 16-bit dataD1+1

Third 16-bit dataD1+2

Fifth 16-bit dataD1+4

Fourth 16-bit dataD1+3

S1 dataD1+0

First 16-bit dataD1+1

Second 16-bit dataD1+2

Fifth 16-bit dataD1+4

Third 16-bit dataD1+33 blocks (S2)

16-bit dataS1 16-bit dataS1

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-TouchX X X X X

Device Function I Q M R T C D Constant RepeatS1 (Source 1) Source data for word shift X X X X X X X X —

S2 (Source 2) Quantity of blocks to shift X X X X X X X X —

D1 (Destination 1) First device address to shift — — — — — — X — —

W (word) X When a bit device such as I (input), Q (output), M (internal relay), or R (shift register) is assigned as source S1 or S2, 16 points are used.

When a word device such as T (timer), C (counter), or D (data register) is assigned as source S1 or S2, 1 point is used.

I (integer) —

D (double word) —

L (long) —

F (float) —

D100 through D102 D101 through D103

D10 D100

When input I0 is turned on, data of 3 data registers, starting with D100 assigned by destination device D1, is shifted to the next data registers. Data of data register D10, assigned by source device S1, is moved to D100 assigned by destination device D1.

SOTUI0

S1D10

D1D100

WSFT S23

2222D101

1111D100

3333D102

4444D103

5555D104

1111D101

12345D100

2222D102

3333D103

5555D104

12345D10 12345D10

Before shift: After first shift:

Page 12: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

10: SHIFT / ROTATE INSTRUCTIONS

10-8 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

ROTL (Rotate Left)

Applicable SmartAXIS

Valid Devices

For valid device address ranges, see "Device Addresses" on page 3-1.

Internal relays M0 through M1277 can be designated as S1. Special internal relays cannot be designated as S1.

The quantity of bits to rotate can be 1 through 15 for word data, or 1 through 31 for double-word data.

Since the ROTL instruction is executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction should be used.

Valid Data Types

When input is on, 16- or 32-bit data of the assigned source device S1 is rotated to the left by the quantity of bits assigned by device bits.

The result is set to the source device S1, and the last bit status rotated out is set to a carry (special internal relay M8003).

S1*****

bits**

ROTL(*)

Before rotation: 1 0 1010 1 0 1 1 1101 0 0CY

M8003

MSB LSBS1

1After rotation: 0 1010 1 0 1 1 1101 0 0CY

M8003

MSB LSBS1

1

Rotate to the left

Before rotation:

1 0 1010 1 0 1 1 1101 0 0CY

M8003

MSB LSBS1

1

After rotation:

10 1010 1 0 1 1 1101 0 0CY

M8003

MSB LSBS1

Rotate to the left

10 1010 1 0 1 1 1101 0 0

1 0 1010 1 0 1 1 1101 0 0

Data Type: Double Word (bits to rotate = 1)

Data Type: Word (bits to rotate = 1)

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-TouchX X X X X

Device Function I Q M R T C D Constant RepeatS1 (Source 1) Data for bit rotation — X X — — X — —

bits Quantity of bits to rotate — — — — — — — 1-15, 1-31 —

W (word) X When a bit device such as Q (output), M (internal relay), or R (shift register) is assigned as the source, 16 points (word data) or 32 points (double-word data) are used.

When a word device such as D (data register) is assigned as the source, 1 point (word data) or 2 points (double-word data) are used.

I (integer) —

D (double word) X

L (long) —

F (float) —

Page 13: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 10-9

10: SHIFT / ROTATE INSTRUCTIONS

Example: ROTL Data Type: Word

Data Type: Double Word

M8120 is the initialize pulse special internal relay.

When the CPU starts operation, the MOV (move) instruction sets 40966 to data register D10.

Each time input I0 is turned on, 16-bit data of data register D10 is rotated to the left by 1 bit as assigned by device bits.

The status of the MSB is set to special internal relay M8003 (carry or borrow).

M8120REP

SOTUI0

S1 –40966

D1 –D10

S1D10

bits1

ROTL(W)

MOV(W)

Before rotation: D10 = 40966 1 1 0000 0 0 0 0 1100 0 0CY

M8003

MSB LSBD10

After first rotation: D10 = 16397

Bits to rotate = 1

After second rotation: D10 = 32794

1 0 0 0001 0 0 0 0 0100 1 1CY

M8003

MSB LSBD10

0 1 0 0000 0 0 0 0 1010 1 0CY

M8003

MSB LSBD10

Each time input I1 is turned on, 32-bit data of data registers D10 and D11 is rotated to the left by 1 bit as assigned by device bits.

The status of the MSB is set to special internal relay M8003 (carry or borrow).

SOTUI1

S1D10

bits1

ROTL(D)

Bits to rotate = 1

Before rotation: D10·D11 = 2,684,788,742

After rotation: D10·D11 = 1,074,610,189

1 1 0000 0 0 0 0 1100 0 0CY

M8003

MSB LSBD10·D11

1 11 0000 0 0 0 0 1100 0 0CY

M8003

MSB LSBD10·D11

Rotate to the left

11 0000 0 0 0 0 1100 0 0

1 1 0000 0 0 0 0 1100 0 0

Page 14: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

10: SHIFT / ROTATE INSTRUCTIONS

10-10 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

ROTR (Rotate Right)

Applicable SmartAXIS

Valid Devices

For valid device address ranges, see "Device Addresses" on page 3-1.

Internal relays M0 through M1277 can be designated as S1. Special internal relays cannot be designated as S1.

The number of bits that can be rotated is 1 through 15 for word data, or 1 through 31 for double-word data.

Since the ROTR instruction is executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction should be used.

Valid Data Types

When input is on, 16- or 32-bit data of the assigned source device S1 is rotated to the right by the quantity of bits assigned by device bits.

The result is set to the source device S1, and the last bit status rotated out is set to special internal relay M8003 (carry or borrow).

S1*****

bits**

ROTR(*)

Before rotation: 1 0 1010 1 0 1 1 1101 0 0CY

M8003

MSB LSBS1

0After rotation: 1 1100 0 0 1 1 0010 1 1CY

M8003

MSB LSBS1

1

Rotate to the right

Data Type: Word (bits to rotate = 1)

Before rotation:

1 0 1010 1 0 1 1 1101 0 0CY

M8003

MSB LSBS1

0

After rotation:CY

M8003

MSB LSBS1

Rotate to the right1 0 1010 1 0 1 1 1101 0 0

Data Type: Double Word (bits to rotate = 1)

1 1100 0 0 1 1 0010 1 1 1 1 1100 0 0 1 1 0010 1 1 1

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-TouchX X X X X

Device Function I Q M R T C D Constant RepeatS1 (Source 1) Data for bit rotation — X X — — X — —

bits Quantity of bits to rotate — — — — — — —1-15, 1-31

W (word) X When a bit device such as Q (output), M (internal relay), or R (shift register) is assigned as the source, 16 points (word data) or 32 points (double-word data) are used.

When a word device such as D (data register) is assigned as the source, 1 point (word data) or 2 points (double-word data) are used.

I (integer) —

D (double word) X

L (long) —

F (float) —

Page 15: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 10-11

10: SHIFT / ROTATE INSTRUCTIONS

Example: ROTR Data Type: Word

Data Type: Double Word

M8120 is the initialize pulse special internal relay.

When the CPU starts operation, the MOV (move) instruction sets 13 to data register D20.

Each time input I1 is turned on, 16-bit data of data register D20 is rotated to the right by 2 bits as assigned by device bits.

The last bit status rotated out is set to special internal relay M8003 (carry or borrow).

M8120REP

SOTUI1

S1 –13

D1 –D20

S1D20

bits2

ROTR(W)

MOV(W)

Before rotation: D20 = 13 0 0 0000 0 0 0 0 0100 1 1CY

M8003

MSB LSBD20

After first rotation: D20 = 16387

Bits to rotate = 2

After second rotation: D20 = 53248

00 0 0001 0 0 0 0 1000 0 1CY

M8003

MSB LSBD20

11 0 0011 0 0 0 0 0000 0 0CY

M8003

MSB LSBD20

Each time input I1 is turned on, 32-bit data of data registers D20 and D21 is rotated to the right by 1 bit as assigned by device bits.

The last bit status rotated out is set to special internal relay M8003 (carry or borrow).

SOTUI1

S1D20

bits1

ROTR(D)

Bits to rotate = 1

Before rotation: D20·D21 = 851,981

After rotation: D20·D21 = 2,147,909,638

0 0 0000 0 0 0 0 0100 1 1CY

M8003

MSB LSBD20·D21

1CY

M8003

MSB LSBD20·D21

Rotate to the right0 0 0000 0 0 0 0 0100 1 1

0 0001 0 0 0 0 1000 0 1 0 0 0001 0 0 0 0 1000 0 1 0

Page 16: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

10: SHIFT / ROTATE INSTRUCTIONS

10-12 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Page 17: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 11-1

11:DATA CONVERSION INSTRUCTIONS

IntroductionData conversion instructions convert data to binary, BCD, and ASCII format.

The ENCO (encode), DECO (decode), and BCNT (bit count) instructions processes bit device data.

The ALT (alternate output) instruction turns an output on and off each time an input button is pressed.

The CVDT (convert data) instruction converts data types among W (word), I (integer), D (double word), L (long), and F (float).

The DTDV and DTCB instructions convert data between two one-byte data and one word data. The SWAP exchanges upper and lower byte- or word-data for word- or double-word-data respectively.

HTOB (Hex to BCD)

Applicable SmartAXIS

Valid Devices

For valid device address ranges, see "Device Addresses" on page 3-1.

Internal relays M0 through M1277 can be designated as D1. Special internal relays cannot be designated as D1.

When T (timer) or C (counter) is used as S1, the timer/counter current value (TC or CC) is displayed. When T (timer) or C (counter) is used as D1, the data is written in as a preset value (TP or CP) which can be 0 through 65535.

Valid values for the source device are 0 through 9999 (270Fh) for word data, and 0 through 9999 9999 (5F5 E0FFh) for double-word data. Make sure that the source designated by S1 is within the valid value range. If the source data exceeds the valid range, a user program execution error will result, turning on special internal relay M8004 and the ERR LED on the SmartAXIS.

When a user program execution error occurs, the execution of the instruction is canceled. The value of D1 is left unchanged and the next instruction is executed. For user program execution errors, see "User Program Execution Errors" on page 4-13.

Since the HTOB instruction is executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction should be used.

Valid Data Types

S1 D1

When input is on, the 16- or 32-bit data assigned by S1 is converted into BCD and stored to the destination assigned by device D1.

Valid values for the source device are 0 through 9999 for word data, and 0 through 9999 9999 for double-word data.

HTOB(*) S1*****

D1*****

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-TouchX X X X X

Device Function I Q M R T C D Constant RepeatS1 (Source 1) Binary data to convert X X X X X X X X —

D1 (Destination 1) Destination to store conversion results — X X X X X — —

W (word) X When a bit device such as I (input), Q (output), M (internal relay), or R (shift register) is assigned as the source, 16 points (word data) or 32 points (double-word data) are used.

When a word device such as T (timer), C (counter), or D (data register) is assigned as the source, 1 point (word data) or 2 points (double-word data) are used.

I (integer) —

D (double word) X

L (long) —

F (float) —

Page 18: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

11: DATA CONVERSION INSTRUCTIONS

11-2 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Examples: HTOB Data Type: Word

Data Type: Double Word

D1D20

S1D10I1

HTOB(W)Binary

SOTU 0D10 (0000h)

BCD

0D20 (0000h)

1234D10 (04D2h)4660D20 (1234h)

9999D10 (270Fh)

39321D20 (9999h)

D1D20

S1D10I2

HTOB(D)SOTU 0D10 (0000h)

0D11 (0000h)

0D20 (0000h)

0D21 (0000h)

Binary BCD

188D10 (00BCh)24910

D11 (614Eh)

4660D20 (1234h)22136

D21 (5678h)

1525D10 (05F5h)57599D11 (E0FFh)

39321D20 (9999h)39321D21 (9999h)

Page 19: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 11-3

11: DATA CONVERSION INSTRUCTIONS

BTOH (BCD to Hex)

Applicable SmartAXIS

Valid Devices

For valid device address ranges, see "Device Addresses" on page 3-1.

Internal relays M0 through M1277 can be designated as D1. Special internal relays cannot be designated as D1.

When T (timer) or C (counter) is used as S1, the timer/counter current value (TC or CC) is displayed. When T (timer) or C (counter) is used as D1, the data is written in as a preset value (TP or CP) which can be 0 through 65535.

Valid values for the source device are 0 through 9999 (BCD) for word data, and 0 through 9999 9999 (BCD) for double-word data. Make sure that each digit of the source designated by S1 is 0 through 9. If the source data exceeds the valid range, a user program execution error will result, turning on special internal relay M8004 and the ERR LED on the SmartAXIS.

When a user program execution error occurs, the execution of the instruction is canceled. The value of D1 is left unchanged and the next instruction is executed. For user program execution errors, see "User Program Execution Errors" on page 4-13.

Since the BTOH instruction is executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction should be used.

Valid Data Types

S1 D1

When input is on, the BCD data assigned by S1 is converted into 16- or 32-bit binary data and stored to the destination assigned by device D1.

Valid values for the source device are 0 through 9999 (BCD) for word data, and 0 through 9999 9999 (BCD) for double-word data.

BTOH(*) S1*****

D1*****

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-TouchX X X X X

Device Function I Q M R T C D Constant RepeatS1 (Source 1) BCD data to convert X X X X X X X X —

D1 (Destination 1) Destination to store conversion results — X X X X X — —

W (word) X When a bit device such as I (input), Q (output), M (internal relay), or R (shift register) is assigned as the source, 16 points (word data) or 32 points (double-word data) are used.

When a word device such as T (timer), C (counter), or D (data register) is assigned as the source, 1 point (word data) or 2 points (double-word data) are used.

I (integer) —

D (double word) X

L (long) —

F (float) —

Page 20: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

11: DATA CONVERSION INSTRUCTIONS

11-4 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Examples: BTOH Data Type: Word

Data Type: Double Word

D1D20

S1D10I1

BTOH(W)BCD

SOTU 0D10 (0000h)

Binary

0D20 (0000h)

4660D10 (1234h)1234D20 (04D2h)

39321D10 (9999h)9999D20 (270Fh)

D1D20

S1D10I2

BTOH(D)SOTU 0D10 (0000h)0D11 (0000h)

0D20 (0000h)0D21 (0000h)

BCD Binary

188D10 (00BCh)

24910D11 (614Eh)

4660D20(1234h)

22136 D21(5678h)

1525D10 (05F5h)57599D11 (E0FFh)

39321 D20(9999h)39321 D21(9999h)

Page 21: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 11-5

11: DATA CONVERSION INSTRUCTIONS

HTOA (Hex to ASCII)

Applicable SmartAXIS

Valid Devices

For valid device address ranges, see "Device Addresses" on page 3-1.

When T (timer) or C (counter) is used as S1 or S2, the timer/counter current value (TC or CC) is displayed.

The quantity of digits to convert can be 1 through 4. Make sure that the quantity of digits designated by S2 is within the valid range. If the S2 data exceeds the valid range, a user program execution error will result, turning on special internal relay M8004 and the ERR LED on the SmartAXIS.

When a user program execution error occurs, the execution of the instruction is canceled. The value of D1 is left unchanged and the next instruction is executed. For user program execution errors, see "User Program Execution Errors" on page 4-13.

Since the HTOA instruction is executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction should be used.

Valid Data Types

S1 D1, D1+1, D1+2, D1+3

When input is on, the 16-bit binary data assigned by S1 is read from the lowest digit as many times as the quantity of digits assigned by S2, converted into ASCII data, and stored to the destination starting with the device assigned by D1.

The quantity of digits to convert can be 1 through 4.

HTOA(W) S1*****

S2*****

D1*****

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-TouchX X X X X

Device Function I Q M R T C D Constant RepeatS1 (Source 1) Binary data to convert X X X X X X X X —

S2 (Source 2) Quantity of digits to convert X X X X X X X 1-4 —

D1 (Destination 1) Destination to store conversion results — — — — — — X — —

W (word) X When a bit device such as I (input), Q (output), M (internal relay), or R (shift register) is assigned as the source, 16 points (word data) are used.

When a word device such as T (timer), C (counter), or D (data register) is assigned as the source or destination, 1 point (word data) is used.

I (integer) —

D (double word) —

L (long) —

F (float) —

Page 22: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

11: DATA CONVERSION INSTRUCTIONS

11-6 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Examples: HTOA Quantity of Digits: 4

Quantity of Digits: 3

Quantity of Digits: 2

Quantity of Digits: 1

D1D20

S1D10I0

HTOA(W) S24

SOTU

Binary

4660D10 (1234h)

ASCII

49D20 (0031h)

50D21 (0032h)

51D22 (0033h)

52D23 (0034h)

D1D20

S1D10I1

HTOA(W) S23

SOTU

Binary

4660D10 (1234h)

ASCII

50D20 (0032h)

51D21 (0033h)

52D22 (0034h)

D1D20

S1D10I2

HTOA(W) S22

SOTU

Binary

4660D10 (1234h)

ASCII

51D20 (0033h)

52D21 (0034h)

D1D20

S1D10I3

HTOA(W) S21

SOTU

Binary

4660D10 (1234h)

ASCII

52D20 (0034h)

Page 23: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 11-7

11: DATA CONVERSION INSTRUCTIONS

ATOH (ASCII to Hex)

Applicable SmartAXIS

Valid Devices

For valid device address ranges, see "Device Addresses" on page 3-1.

Internal relays M0 through M1277 can be designated as D1. Special internal relays cannot be designated as D1.

When T (timer) or C (counter) is used as S2, the timer/counter current value (TC or CC) is displayed. When T (timer) or C (counter) is used as D1, the data is written in as a preset value (TP or CP) which can be 0 through 65535.

Valid values for source S1 data to convert are 30h to 39h and 41h to 46h. Make sure that the values for each source designated by S1 and the quantity of digits designated by S2 are within the valid range. If the S1 or S2 data exceeds the valid range, a user program execution error will result, turning on special internal relay M8004 and the ERR LED on the SmartAXIS.

When a user program execution error occurs, the execution of the instruction is canceled. The value of D1 is left unchanged and the next instruction is executed. For user program execution errors, see "User Program Execution Errors" on page 4-13.

Since the ATOH instruction is executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction should be used.

Valid Data Types

S1, S1+1, S1+2, S1+3 D1

When input is on, the ASCII data, assigned by S1, is converted into 16-bit binary data. The number of times is determined by the quantity of digits assigned by S2. The data is then stored to the destination assigned by device D1.

Valid values for source data to convert are 30h to 39h and 41h to 46h.

The quantity of digits to convert can be 1 through 4.

ATOH(W) S1*****

S2*****

D1*****

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-TouchX X X X X

Device Function I Q M R T C D Constant RepeatS1 (Source 1) ASCII data to convert — — — — — — X — —

S2 (Source 2) Quantity of digits to convert X X X X X X X 1-4 —

D1 (Destination 1) Destination to store conversion results — X X X X X — —

W (word) X When a bit device such as I (input), Q (output), M (internal relay), or R (shift register) is assigned as the source or destination, 16 points (word data) are used.

When a word device such as T (timer), C (counter), or D (data register) is assigned as the source or destination, 1 point (word data) is used.

I (integer) —

D (double word) —

L (long) —

F (float) —

Page 24: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

11: DATA CONVERSION INSTRUCTIONS

11-8 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Examples: ATOH Quantity of Digits: 4

Quantity of Digits: 3

Quantity of Digits: 2

Quantity of Digits: 1

D1D20

S1D10I0

ATOH(W) S24

SOTU

Binary

4660D20 (1234h)

ASCII

49D10 (0031h)

50D11 (0032h)

51D12 (0033h)

52D13 (0034h)

D1D20

S1D10I1

ATOH(W) S23

SOTU

Binary

291D20 (0123h)

ASCII

49D10 (0031h)

50D11 (0032h)

51D12 (0033h)

D1D20

S1D10I2

ATOH(W) S22

SOTU

Binary

18D20 (0012h)

ASCII

49D10 (0031h)

50D11 (0032h)

D1D20

S1D10I3

ATOH(W) S21

SOTU

Binary

1D20 (0001h)

ASCII

49D10 (0031h)

Page 25: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 11-9

11: DATA CONVERSION INSTRUCTIONS

BTOA (BCD to ASCII)

Applicable SmartAXIS

Valid Devices

For valid device address ranges, see "Device Addresses" on page 3-1.

When T (timer) or C (counter) is used as S1 or S2, the timer/counter current value (TC or CC) is displayed.

The number of digits that can be converted is 1 through 5 for word data, and 1 through 10 for double-word data. Make sure that the quantity of digits designated by S2 is within the valid range. If the S2 data exceeds the valid range, a user program execution error will result, turning on special internal relay M8004 and the ERR LED on the SmartAXIS.

Make sure that the last destination data determined by D1+S2-1 is within the valid device range. If the derived destination device exceeds the valid device range, a user program execution error will result, turning on special internal relay M8004 and ERROR LED on the SmartAXIS.

When a user program execution error occurs, the execution of the instruction is canceled. The value of D1 is left unchanged and the next instruction is executed. For user program execution errors, see "User Program Execution Errors" on page 4-13.

Since the BTOA instruction is executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction should be used.

Valid Data Types

Word data: S1 D1, D1+1, D1+2, D1+3, D1+4Double-word data: S1·S1+1 D1, D1+1, D1+2, ... , D1+9When input is on, the 16- or 32-bit binary data assigned by S1 is converted into BCD, and converted into ASCII data. The data is read from the lowest digit as many times as the quantity of digits assigned by S2. The result is stored to the destination starting with the device assigned by D1.

The number of digits that can be converted is 1 through 5 for word data, and 1 through 10 for double-word data.

BTOA(*)

S1*****

S2*****

D1*****

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-TouchX X X X X

Device Function I Q M R T C D Constant RepeatS1 (Source 1) Binary data to convert X X X X X X X X —

S2 (Source 2) Quantity of digits to convert X X X X X X X 1-5, 1-10 —

D1 (Destination 1) Destination to store conversion results — — — — — — X — —

W (word) X When a bit device such as I (input), Q (output), M (internal relay), or R (shift register) is assigned as the source, 16 points (word data) or 32 points (double-word data) are used.

When a word device such as T (timer), C (counter), or D (data register) is assigned as the source or destination, 1 point (word data) or 2 points (double-word data) are used.

I (integer) —

D (double word) X

L (long) —

F (float) —

Page 26: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

11: DATA CONVERSION INSTRUCTIONS

11-10 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Examples: BTOA(W) Quantity of Digits: 5

Quantity of Digits: 4

Quantity of Digits: 3

Quantity of Digits: 2

Quantity of Digits: 1

D1D20

S1D10I0

BTOA(W) S25

SOTU

BCD

12345D10 (3039h)

ASCII

49D20 (0031h)

50D21 (0032h)

51D22 (0033h)

52D23 (0034h)

Binary

53D24 (0035h)

D1D20

S1D10I1

BTOA(W) S24

SOTU12345D10 (3039h)

ASCII

50D20 (0032h)

51D21 (0033h)

52D22 (0034h)

53D23 (0035h)

BCDBinary

D1D20

S1D10I2

BTOA(W) S23

SOTU12345D10 (3039h)

ASCII

51D20 (0033h)

52D21 (0034h)

53D22 (0035h)

BCDBinary

D1D20

S1D10I3

BTOA(W) S22

SOTU12345D10 (3039h)

ASCII

52D20 (0034h)

53D21 (0035h)

BCDBinary

D1D20

S1D10I4

BTOA(W) S21

SOTU12345D10 (3039h)

ASCII

53D20 (0035h)

BCDBinary

Page 27: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 11-11

11: DATA CONVERSION INSTRUCTIONS

Examples: BTOA(D) Quantity of Digits: 10

Quantity of Digits: 6

Quantity of Digits: 3

D1D20

S1D10I0

BTOA(D)

S210

SOTU

BCD

1234567890(499602D2h)

ASCII

49D20 (0031h)

50D21 (0032h)

51D22 (0033h)

52D23 (0034h)

Binary

53D24 (0035h)

54D25 (0036h)

55D26 (0037h)

56D27 (0038h)

57D28 (0039h)

48D29 (0030h)

D10·D11

D1D20

S1D10I1

BTOA(D)

S26

SOTUASCII

53D20 (0035h)

54D21 (0036h)

55D22 (0037h)

56D23 (0038h)

57D24 (0039h)

48D25 (0030h)

BCDBinary

D10·D111234567890(499602D2h)

D1D20

S1D10I2

BTOA(D)

S23

SOTUASCII

56D20 (0038h)

57D21 (0039h)

48D22 (0030h)

D10·D111234567890(499602D2h)

BCDBinary

Page 28: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

11: DATA CONVERSION INSTRUCTIONS

11-12 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

ATOB (ASCII to BCD)

Applicable SmartAXIS

Valid Devices

For valid device address ranges, see "Device Addresses" on page 3-1.

Internal relays M0 through M1277 can be designated as D1.

When T (timer) or C (counter) is used as S2, the timer/counter current value (TC or CC) is displayed. When T (timer) or C (counter) is used as D1, the data is written in as a preset value (TP or CP).

Valid values for source S1 data to convert are 30h through 39h. The number of digits that can be converted is be 1 through 5 for word data, and 1 through 10 for double-word data. Make sure that the values for each source designated by S1 and the quantity of digits designated by S2 are within the valid range. If the S1 or S2 data exceeds the valid range, a user program execution error will result, turning on special internal relay M8004 and the ERR LED on the SmartAXIS.

Make sure that the last source data determined by S1+S2-1 is within the valid device range. If the derived source device exceeds the valid device range, a user program execution error will result, turning on special internal relay M8004 and ERROR LED on the SmartAXIS.

When a user program execution error occurs, the execution of the instruction is canceled. The value of D1 is left unchanged and the next instruction is executed. For user program execution errors, see "User Program Execution Errors" on page 4-13.

Since the ATOB instruction is executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction should be used.

Valid Data Types

Word data: S1, S1+1, S1+2, S1+3, S1+4 D1Double-word data: S1, S1+1, S1+2, ... , S1+9 D1·D1+1

When input is on, the ASCII data assigned by S1 as many times as the quantity of digits assigned by S2 is converted into BCD, and converted into 16- or 32-bit binary data. The result is stored to the destination assigned by device D1.

Valid values for source data to convert are 30h through 39h.

The number of digits that can be converted is through 5 for word data, and 1 through 10 for double-word data.

ATOB(*)

S1*****

S2*****

D1*****

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-TouchX X X X X

Device Function I Q M R T C D Constant RepeatS1 (Source 1) ASCII data to convert — — — — — — X — —

S2 (Source 2) Quantity of digits to convert X X X X X X X 1-5, 1-10 —

D1 (Destination 1) Destination to store conversion results — X X X X X — —

W (word) X When a bit device such as I (input), Q (output), M (internal relay), or R (shift register) is assigned as the source or destination, 16 points (word data) or 32 points (double-word data) are used.

When a word device such as T (timer), C (counter), or D (data register) is assigned as the source or destination, 1 point (word data) or 2 points (double-word data) are used.

I (integer) —

D (double word) X

L (long) —

F (float) —

Page 29: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 11-13

11: DATA CONVERSION INSTRUCTIONS

Examples: ATOB(W) Quantity of Digits: 5

Quantity of Digits: 4

Quantity of Digits: 3

Quantity of Digits: 2

Quantity of Digits: 1

D1D20

S1D10I0

ATOB(W) S25

SOTU

BCD

12345D20 (3039h)

ASCII

49D10 (0031h)

50D11 (0032h)

51D12 (0033h)

52D13 (0034h)

Binary

53D14 (0035h)

D1D20

S1D10I1

ATOB(W) S24

SOTU

BCD

1234D20 (04D2h)

ASCII

49D10 (0031h)

50D11 (0032h)

51D12 (0033h)

52D13 (0034h)

Binary

D1D20

S1D10I2

ATOB(W) S23

SOTU

BCD

123D20 (007Bh)

ASCII

49D10 (0031h)

50D11 (0032h)

51D12 (0033h)

Binary

D1D20

S1D10I3

ATOB(W) S22

SOTU

BCD

12D20 (0018h)

ASCII

49D10 (0031h)

50D11 (0032h)

Binary

D1D20

S1D10I4

ATOB(W) S21

SOTU

BCD

1D20 (0001h)

ASCII

49D10 (0031h)

Binary

Page 30: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

11: DATA CONVERSION INSTRUCTIONS

11-14 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Examples: ATOB(D) Quantity of Digits: 10

Quantity of Digits: 6

Quantity of Digits: 3

D1D20

S1D10I0

ATOB(D)

S210

SOTUASCII

49D10 (0031h)

50D11 (0032h)

51D12 (0033h)

52D13 (0034h)

53D14 (0035h)

54D15 (0036h)

55D16 (0037h)

56D17 (0038h)

57D18 (0039h)

48D19 (0030h)

BCD

1234567890(499602D2h)

Binary

D20·D21

D1D20

S1D10I1

ATOB(D)

S26

SOTU123456

(0001E240h)

ASCII

49D10 (0031h)

50D11 (0032h)

51D12 (0033h)

52D13 (0034h)

53D14 (0035h)

54D15 (0036h)

D20·D21

BCDBinary

D1D20

S1D10I2

ATOB(D)

S23

SOTU123

(0000007Bh)

ASCII

49D10 (0031h)

50D11 (0032h)

51D12 (0033h)

D20·D21

BCDBinary

Page 31: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 11-15

11: DATA CONVERSION INSTRUCTIONS

ENCO (Encode)

Applicable SmartAXIS

Valid Devices

For valid device address ranges, see "Device Addresses" on page 3-1.

Internal relays M0 through M1277 can be designated as D1. Special internal relays cannot be designated as D1.

Valid values for Bits to designate the quantity of bits searched are 1 through 256. Make sure that the search area designated by S1 plus Bits is within the valid value range. If the source data exceeds the valid range, a user program execution error will result, turning on special internal relay M8004 and the ERR LED on the SmartAXIS.

When a user program execution error occurs, the execution of the instruction is canceled. The value of D1 is left unchanged and the next instruction is executed. For user program execution errors, see "User Program Execution Errors" on page 4-13.

Since the ENCO instruction is executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction should be used.

Examples: ENCO

When input is on, a search begins for the first bit that is set to on. The search begins at S1 until the first set (on) point is located. The number of points from S1 to the first set point (offset) is stored to the destination assigned by device D1.

If no point is on in the searched area, 65535 is stored to D1.

ENCOBits

S1*****

D1*****

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-TouchX X X X X

Device Function I Q M R T C D Constant RepeatS1 (Source 1) First bit to start search X X X X — — X — —

D1 (Destination 1) Destination to store search results — X X — — X — —

Bits Quantity of bits searched — — — — — — — 1-256 —

When input I0 is on, a search begins for a bit that is set on in an array of 64 bits starting at internal relay M4 assigned by device S1.

Since internal relay M30 is the first point that is on, the offset from the first search point is 20, and 20 is stored to data register D100 assigned by device D1.

D1D100

S1M4I0

ENCO64

M17 M0

M37 M20

M57 M40

M77 M60 ON

M97 M80

M117 M100 Searched area

20D100

When input I1 is on, a search begins for a bit that is set on in an array of 64 bits starting at bit 0 of data register D10 assigned by device S1.

Since bit 8 of data register D11 is the first point that is on, the offset from the first search point is 24, and 24 is stored to data register D100 assigned by device D1.

D1D100

S1D10I1

ENCO64

Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

D10

D11

D12

D13 ON

D14

D15 Searched area

24D100

Page 32: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

11: DATA CONVERSION INSTRUCTIONS

11-16 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

DECO (Decode)

Applicable SmartAXIS

Valid Devices

For valid device address ranges, see "Device Addresses" on page 3-1.

Internal relays M0 through M1277 can be designated as D1. Special internal relays cannot be designated as D1.

Valid values for the offset designated by source device S1 are 0 through 255. Make sure that the offset designated by S1 and the last bit of destination data determined by the sum of S1 and D1 are within the valid value range. If the offset or destination data exceeds the valid range, a user program execution error will result, turning on special internal relay M8004 and the ERR LED on the SmartAXIS.

When a user program execution error occurs, the execution of the instruction is canceled. The value of D1 is left unchanged and the next instruction is executed. For user program execution errors, see "User Program Execution Errors" on page 4-13.

Since the DECO instruction is executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction should be used.

Examples: DECO

When input is on, the values contained in devices assigned by S1 and D1 are added together to determine the destination, and the bit is then turned on.DECO S1

*****D1

*****

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-TouchX X X X X

Device Function I Q M R T C D Constant RepeatS1 (Source 1) Offset X X X X — — X 0-255 —

D1 (Destination 1) First bit to count offset — X X — — X — —

When input I0 is on, the destination bit is determined by adding the value contained in data register D20 assigned by device S1 to internal relay M104 assigned by destination device D1.

Since the 19th bit from internal relay M104 is internal relay M127, the bit is then turned on.

D1M104

S1D20I0

DECO

M117 M100

M137 M120

M157 M140

First bit M177 M160

M197 M180

ON M217 M200

19D20

When input I1 is on, the destination bit is determined by adding the value contained in data register D10 assigned by device S1 to data register D30 assigned by destination device D1.

Since the 39th bit from data register D30 bit 0 is data register D32 bit 7, the bit is then turned on.

D1D30

S1D10I1

DECO

Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

D30

D31

D32

D33ON

D34

D35

39D10

Page 33: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 11-17

11: DATA CONVERSION INSTRUCTIONS

BCNT (Bit Count)

Applicable SmartAXIS

Valid Devices

For valid device address ranges, see "Device Addresses" on page 3-1.

Internal relays M0 through M1277 can be designated as D1. Special internal relays cannot be designated as D1.

When T (timer) or C (counter) is used as S2, the timer/counter current value (TC or CC) is displayed. When T (timer) or C (counter) is used as D1, the data is written in as a preset value (TP or CP) which can be 0 through 65535.

Valid values for S2 to designate as the number of bits that can be searched is 1 through 256. Make sure that the search area designated by S1 plus S2 is within the valid value range. If the source data exceeds the valid range, a user program execution error will result, turning on special internal relay M8004 and the ERR LED on the SmartAXIS.

When a user program execution error occurs, the execution of the instruction is canceled. The value of D1 is left unchanged and the next instruction is executed. For user program execution errors, see "User Program Execution Errors" on page 4-13.

Since the BCNT instruction is executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction should be used.

Examples: BCNT

When input is on, a search begins for the total number of bits that are on an array of consecutive bits starting at the point assigned by source device S1. Source device S2 assigns the quantity of bits searched. The quantity of bits which are on is stored to the destination assigned by device D1.

BCNT S1*****

D1*****

S2*****

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-TouchX X X X X

Device Function I Q M R T C D Constant RepeatS1 (Source 1) First bit to start search X X X X — — X — —

S2 (Source 2) Quantity of bits searched X X X X X X X 1-256 —

D1 (Destination 1) Destination to store quantity of ON bits — X X X X X — —

When input is on, a search begins for the total number of bits that are on in an array of 64 bits starting at internal relay M4 assigned by source device S1.

Since 3 bits are on in the searched area, the quantity is stored to data register D100 assigned by destination device D1.

D1D100

S1M4I0

BCNT S264

M17 M0

M37 M20

M57 M40

M77 M60 ON

M97 M80

M117 M100 Searched area

3D100

When input I0 is on, a search begins for the total number of bits that are on in an array of 60 bits starting at bit 0 of data register D10 assigned by device S1.

Since 2 bits are on among the 60 bits, 2 is stored to data register D100 assigned by device D1.

D1D100

S1D10I1

BNCT S260

Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

D10

D11

D12

D13 ON

D14

D15 Searched area

2D100

Page 34: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

11: DATA CONVERSION INSTRUCTIONS

11-18 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

ALT (Alternate Output)

Applicable SmartAXIS

Valid Devices

For valid device address ranges, see "Device Addresses" on page 3-1.

Since the ALT instruction is executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction must be used. For the SOTU instruction and the SOTD instruction, see "SOTU and SOTD (Single Output Up and Down)" on page 5-26.

Example: ALT

When input is turned on, output, internal relay, or shift register bit assigned by D1 is turned on and remains on after the input is turned off.

When input is turned on again, the assigned output, internal relay, or shift register bit is turned off.

The ALT instruction must be used with a SOTU or SOTD instruction, otherwise the assigned output, internal relay, or shift register bit repeats to turn on and off in each scan.

ALT D1*****

SOTU

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-TouchX X X X X

Device Function I Q M R T C D Constant RepeatD1 (Destination 1) Bit to turn on and off — X X X — — — — —

When input I0 is turned on, output Q0 assigned by device D1 is turned on and remains after input I0 is turned off.

When input I0 is turned on again, output Q0 is turned off.

D1Q0I0

ALTSOTU

Input I0

Output Q0

ON

OFF

ON

OFF

Page 35: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 11-19

11: DATA CONVERSION INSTRUCTIONS

CVDT (Convert Data Type)

Applicable SmartAXIS

Valid Devices

For valid device address ranges, see "Device Addresses" on page 3-1.

Internal relays M0 through M1277 can be designated as D1. Special internal relays cannot be designated as D1.

When T (timer) or C (counter) is used as S1, the timer/counter current value (TC or CC) is displayed. When T (timer) or C (counter) is used as D1, the data is written in as a preset value (TP or CP) which can be 0 through 65535.

When F (float) data is selected, only data register and constant can be designated as S1 and only data register can be designated as D1.

When F (float) data is selected and S1 or D1 does not comply with the normal floating-point format, a user program execution error will result, turning on special internal relay M8004 and ERR LED on the SmartAXIS.

When a user program execution error occurs, the execution of the instruction is canceled. The value of D1 is left unchanged and the next instruction is executed. For user program execution errors, see "User Program Execution Errors" on page 4-13.

Valid Data Types

S1 D1

When input is on, the data type of the 16- or 32-bit data assigned by S1 is converted and stored to the destination assigned by device D1.

Data types can be assigned for the source and destination, separately

Data Type W, I D, L, F

Source S1 S1·S1+1

Destination D1 D1·D1+1

When the same data type is assigned for both source and destination, the CVDT instruction has the same function as the MOV instruction.

Unless F (float) data is selected for both source and destination, only the integral number is moved, omitting the fraction.

When the source data exceeds the range of destination data, the destination stores a value closest to the source data within the destination data.

S1(R)*****

REP**

D1(R)*****

CVDT*TO*

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-TouchX X X X X

Device Function I Q M R T C D Constant RepeatS1 (Source 1) First device address to convert data type X X X X X X X X 1-99

D1 (Destination 1) First device address to store converted data — X X X X X — 1-99

W (word) X When a bit device such as I (input), Q (output), M (internal relay), or R (shift register) is assigned as the source or destination, 16 points (word or integer data) or 32 points (double-word, long, or float data) are used. When repeat is assigned for a bit device, the quantity of device bits increases in 16- or 32-point increments.

When a word device such as T (timer), C (counter), or D (data register) is assigned as the source or destination, 1 point (word or integer data) or 2 points (double-word, long, or float data) are used. When repeat is assigned for a word device, the quantity of device words increases in 1- or 2-point increments.

I (integer) X

D (double word) X

L (long) X

F (float) X

Page 36: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

11: DATA CONVERSION INSTRUCTIONS

11-20 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Examples: CVDT Data Type: Either S1 or D1 is not F (float)

Unless F (float) data is selected for both source and destination, only the integral number is moved, omitting the fraction.

Data Type: S1 has a larger data range than D1

When the source data exceeds the range of destination data type, the destination stores a value closest to the source data within the destination data type..

Device Data Type Value

Source F 3.141593

Destination W 3

When input I0 is turned on, 3 is stored to data register D2.

I0REPD1 –

D2SOTU S1 –

D0CVDTFTOW

3D2

D1S1

3.141593D0·D1

Device Data Type Value

Source D 4294967295

Destination W 65535

When input I0 is turned on, 65535 is stored to data register D2.

I0REPD1 –

D2SOTU S1 –

D0CVDTDTOW

65535D2

D1S1

42949672953D0·D1

Page 37: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 11-21

11: DATA CONVERSION INSTRUCTIONS

DTDV (Data Divide)

Applicable SmartAXIS

Valid Devices

For valid device address ranges, see "Device Addresses" on page 3-1.

When T (timer) or C (counter) is used as S1, the timer/counter current value (TC or CC) is displayed.

Destination device D1 uses 2 data registers starting with the device assigned by D1.

Since the DTDV instruction is executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction should be used.

Valid Data Types

Example: DTDV

S1 D1, D1+1

When input is on, the 16-bit binary data assigned by S1 is divided into upper and lower bytes. The upper byte data is stored to the destination assigned by device D1. The lower byte data is stored to the device next to D1.

DTDV(W)

S1*****

D1*****

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-TouchX X X X X

Device Function I Q M R T C D Constant RepeatS1 (Source 1) Binary data to divide X X X X X X X X —

D1 (Destination 1) Destination to store results — — — — — — X — —

W (word) X When a bit device such as I (input), Q (output), M (internal relay), or R (shift register) is assigned as the source, 16 points (word data) are used.

When a word device such as T (timer), C (counter), or D (data register) is assigned as the source or destination, 1 point (word data) is used.

I (integer) —

D (double word) —

L (long) —

F (float) —

D1D20

S1D10I1

DTDV(W)

SOTU48D20 (30h)

Before Execution

12345D10 (3039h)

After Execution

57D21 (39h)

Upper byte

Lower byte

Page 38: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

11: DATA CONVERSION INSTRUCTIONS

11-22 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

DTCB (Data Combine)

Applicable SmartAXIS

Valid Devices

For valid device address ranges, see "Device Addresses" on page 3-1.

Special internal relays cannot be designated as D1.

When T (timer) or C (counter) is used as D1, the data is written in as a preset value (TP or CP) which can be 0 through 65535.

Source device S1 uses 2 data registers starting with the device assigned by S1.

Since the DTCB instruction is executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction should be used.

Valid Data Types

Example: DTCB

S1, S1+1 D1

When input is on, the lower-byte data is displayed from 2 consecutive sources starting with device assigned by S1 and combined to make 16-bit data. The lower byte data from the first source device is moved to the upper byte of the destination assigned by device D1, and the lower byte data from the next source device is moved to the lower byte of the destination.

DTCB(W)

S1*****

D1*****

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-TouchX X X X X

Device Function I Q M R T C D Constant RepeatS1 (Source 1) Binary data to combine — — — — — — X — —

D1 (Destination 1) Destination to store results — X X X X X — —

W (word) X When a bit device such as I (input), Q (output), M (internal relay), or R (shift register) is assigned as the destination, 16 points (word data) are used.

When a word device such as T (timer), C (counter), or D (data register) is assigned as the source or destination, 1 point (word data) is used.

I (integer) —

D (double word) —

L (long) —

F (float) —

D1D20

S1D10I1

DTCB(W)

SOTU48D10 (0030h)

After Execution

12345D20 (3039h)

Before Execution

57D11 (0039h)

Upper byte

Lower byte

Page 39: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 11-23

11: DATA CONVERSION INSTRUCTIONS

SWAP (Data Swap)

Applicable SmartAXIS

Valid Devices

For valid device address ranges, see "Device Addresses" on page 3-1.

Since the SWAP instruction is executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction should be used.

Valid Data Types

Examples: SWAP Data Type: W (word)

When input I0 is turned on, upper- and lower-byte data of the 16-bit data in data register D10 assigned by source device S1 are exchanged, and the result is stored to data register D20 assigned by destination device D1.

Data Type: D (double-word)

When input I1 is turned on, upper- and lower-word data of the 32-bit data in data registers D10 and D11 assigned by source device S1 are exchanged, and the result is stored to data registers D20 and D21 assigned by destination device D1.

S1 D1When input is on, upper and lower byte- or word-data of a word- or double-word-data assigned by S1 are exchanged, and the result is stored to destination assigned by D1.

REP**

S1(R)*****

D1(R)*****

SWAP(*)

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-TouchX X X X X

Device Function I Q M R T C D Constant RepeatS1 (Source 1) Binary data to swap — — — — — — X — 1-99

D1 (Destination 1) Destination to store conversion result — — — — — — X — 1-99

W (word) X When a D (data register) is assigned as the source or destination, 1 point (word data) or 2 points (double-word data) are used. When repeat is assigned, the quantity of device words increases in 1- or 2-point increments.I (integer) —

D (double word) X

L (long) —

F (float) —

I0REPS1

D10D1D20

SWAP(W) 14640D20 (3930h)

Before Execution

12345D10 (3039h)

After Execution

I1REPS1

D10D1D20

SWAP(D)

200D11

100D10

Before Execution After Execution

100D21

200D20

Page 40: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

11: DATA CONVERSION INSTRUCTIONS

11-24 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Page 41: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 12-1

12:WEEK PROGRAMMER INSTRUCTIONS

IntroductionThe Week Programmer instructions turn output on or off at a specified interval.

WEEK (Weekly Timer)

For example, if the ON settings are Monday 13:00 and the OFF settings are Wednesday 18:00, output D1 turns on and off as follows.

Notes:

A maximum of 1 WEEK instruction can be used in a user program.

Normally the output is only updated when the current time and the time for the ON/OFF settings matches, but when the WEEK instruction input changes from off to on, the output state at the current time is determined according to the ON/OFF settings and the output is turned on or off.

When pulse output is enabled, output is turned on for one scan at the ON settings time. For pulse output, see "6. Pulse Output" on page 12-3 or "6. Pulse Output" on page 12-6.

When the ON time is set to a value larger than 2359, the OFF time is set to a value larger than 2400, or the lower 2 digits of ON/OFF time is set to a value larger than 59, a user program execution error will occur.

When the day of the week is not specified, a user program execution error will occur.

The WEEK instruction cannot be used in an interrupt program. If used, a user program execution error will result, turning on special internal relay M8004 and the ERR LED on the SmartAXIS. For details about the user program execution errors, see "User Program Execution Errors" on page 4-13.

Applicable SmartAXIS

Valid Devices

Special data registers cannot be designated as S1. Internal relays M0 through M1277 can be designated as D1. Special internal relays cannot be designated as D1.

The WEEK instruction compares the specified day of the week, ON time, and OFF time with the current time and outputs that result.

When the input is on, the output specified by D1 is turned on when the day of the week and the time specified by the ON settings match the current day of the week and time.

The output is also turned off when the day of the week and the time specified by the OFF settings match the current day of the week and time.

D1

*****

S2

*****

WEEK S1

*****

S3

*****

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-TouchX X X X X

Device Function I Q M R T C D Constant RepeatS1 (Source 1) Starting data register — — — — — — — —

S2 (Source 2) Initialization input — — X — — — — — —

S3 (Source 3) Number of parameter tabs — — — — — — — X —

D1 (Destination 1) Output port — X — — — — — —

Sunday Monday Tuesday Wednesday Thursday Friday Saturday

ON

OFF

Output D1

Day of the week

Time

ON settings Day of the week : Monday

Time : 13:00

OFF settings Day of the week : Wednesday

Time : 18:00

18:0013:00

Page 42: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

12: WEEK PROGRAMMER INSTRUCTIONS

12-2 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Settings

There are two methods to configure the day of the week and the time for the WEEK instruction. Specify the method on the Device tab with Data register settings.

Configuring the day of the week and the time as fixed settings The day of the week and the time for the ON/OFF settings are uniquely determined. The day of the week and the time for the ON/OFF settings cannot be changed while the SmartAXIS is running. For details, see "To configure the day of the week and the time as fixed settings" on page 12-2.

Configuring the day of the week and the time by specifying data registers

The day of the week and the time for the ON/OFF settings are configured according to the values stored in the specified data registers. The day of the week and the time for the ON/OFF settings can be changed while the SmartAXIS is running. For details, see "To configure the days of the week and the time by specifying data registers" on page 12-5.

To configure the day of the week and the time as fixed settingsThe day of the week and the time for the ON/OFF settings are uniquely determined. The day of the week and the time for the ON/OFF settings cannot be changed while the SmartAXIS is running.

Device tab

1. Data register settings

This setting determines whether to configure the day of the week and the time as fixed settings or to indirectly specify them with data registers.

To configure the day of the week and the time as fixed settings, clear this check box.

Unselected check box

The day of the week and the time are fixed settings. The day of the week and the time are configured on the parameter tabs. The day of the week and the time cannot be changed while the SmartAXIS is running. For the settings, see "Parameter tab" on page 12-3.

Note: When this check box is selected, the settings for the day of the week and the time are indirectly specified with data registers.Configure the day of the week and the time by using data registers. The day of the week and the time can be changed while the SmartAXIS is running. For directions specific to data registers, see "To configure the days of the week and the time by specifying data registers" on page 12-5.

2. S1 (source 1): Starting data register

This setting is not configured when configuring the day of the week and the time as fixed settings.

3. S2 (source 2): Initialization input

This setting is not configured when configuring the day of the week and the time as fixed settings.

3. 5.2.

1.

4.6.

Page 43: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 12-3

12: WEEK PROGRAMMER INSTRUCTIONS

4. S3 (source 3): Number of parameter tabs

This setting configures the number of parameter tabs. When this value is increased or decreased, the number of parameter tabs displayed on the dialog box increases or decreases. 6 bytes of the user program region are used for each parameter tab.For the settings, see "Parameter tab" on page 12-3.

5. D1 (destination 1): Output

This setting configures the output for the results when the configured day of the week and time and the current day of the week and time are compared.

6. Pulse Output

This setting configures the operation for D1 (output). This setting is applied to all parameter tabs.

Selected check box

When the day of the week and the time configured in the ON settings matches the current day of the week and the time, the output is turned on for only one scan.

Unselected check box

The output is turned on and off according to the ON settings and the OFF settings.

Parameter tab

This tab configures the ON/OFF settings for the output. A maximum of 20 parameter tabs can be configured for one WEEK instruction.

1. ON settings

This section configures the day of the week and the time to turn on the output. The output is turned on at the specified time for the specified day of the week.

Setting DescriptionTag Name Specifies the tag name or the device address for each device.

Device Address Shows the device address that corresponds to the tag name.

Comment Shows the comment for the device address. This item can be edited.

Setting Description RangeDay of the week Specifies the days of the week. —

ON time Used to enter the time. Set the time in a range from 00:00 to 23:59.Hour: 0 to 23

Minute: 0 to 59

1.

2.

Page 44: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

12: WEEK PROGRAMMER INSTRUCTIONS

12-4 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

2. OFF settings

This section configures the day of the week and the time to turn off the output. The output is turned off at the specified time for the specified day of the week.

Note: When the time is duplicated in the settings on other tabs, the settings on the tab with the larger tab number are valid.For example, if ON time is 8:00 and OFF time is 9:00 on the P 1 tab and ON time is 9:00 and OFF time is 10:00 on the P 2 tab, the 9:00 setting is duplicated on the two tabs and OFF time for the P 1 tab is disabled. In this situation, the output is on from 8:00 to 10:00.

If ON time is 9:00 and OFF time is 10:00 on the P 1 tab and ON time is 8:00 and OFF time is 9:00 on the P 2 tab, the 9:00 setting is duplicated on the two tabs and ON time for the P 1 tab is disabled. In this situation, the output is on from 8:00 to 9:00.

Preview

The preview shows the ON/OFF state for the output based on the settings configured on the parameter tabs as a time chart.The preview can be shown as a week or a day.

Setting Description RangeDay of the week Specifies the days of the week. —

OFF time Used to enter the time. Set the time in a range from 00:00 to 24:00.Hour: 0 to 24

Minute: 0 to 59

Setting Description

Week Select this radio button when showing the preview as a week.

Day Select this radio button when showing the preview as a day.

Time 8:007:00 10:009:00 11:00

P 1 tab settingsON

OFF

P 2 tab settingsON

OFF

Output D1ON

OFF

OFF timeON time

OFF timeON time

Page 45: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 12-5

12: WEEK PROGRAMMER INSTRUCTIONS

To configure the days of the week and the time by specifying data registersThe day of the week and the time for the ON/OFF settings are configured according to the values stored in the specified data registers. The day of the week and the time for the ON/OFF settings can be changed while the SmartAXIS is running.

When the day of the week or time in the ON/OFF settings is modified with the WEEK instruction input turned on, the modified data register values are reflected in the ladder program when the current date and time matches the day of the week or time in the ON/OFF settings.

Device tab

1. Data register settings

This setting selects whether to configure the day of the week and the time as fixed settings or to indirectly specify them with data registers. To configure the day of the week and the time by specifying data registers, select this check box.

Selected check box

The day of the week and the time settings are indirectly specified by data registers. Configure the day of the week and the time by using data registers. The day of the week and the time can be changed while the SmartAXIS is running. For allocating the data register region, see "Data Register Allocation" on page 12-7.

The data registers can be initialized with the days of the week and the times configured on the parameter tabs by turning on the initialization input. For initialization, see "3. S2 (source 2): Initialization input" on page 12-6.

Note: When this check box is not selected, the day of the week and the time are fixed settings. The day of the week and the time are configured on the parameter tabs. The day of the week and the time cannot be changed while the SmartAXIS is running. For fixed settings, see "To configure the day of the week and the time as fixed settings" on page 12-2.

2. S1 (source 1): Starting data register

This setting specifies the start of the data register region to store the days of the week and time settings for the WEEK instruction.

This setting is only used when indirectly specifying the settings for the WEEK instruction with data registers.

For allocating the data register region, see "Parameter tab" on page 12-6.

Setting Description

Tag Name Specifies the tag name or the device address for the device.

Device Address Shows the device address that corresponds to the tag name.

Used Data RegistersShows the range of data registers used to store the settings. This item changes when the device address or the number of parameter tabs changes.

Comment Shows the comment for the device address. This item can be edited.

1.

3. 5.

4.

2.

6.

7.

Page 46: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

12: WEEK PROGRAMMER INSTRUCTIONS

12-6 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

3. S2 (source 2): Initialization input

This setting specifies the device to initialize the days of the week and the times stored in the data register region that starts from S1 (source 1).

The values configured on the parameter tabs are stored in the data registers by turning on the initialization input.

This setting is only used when indirectly specifying the settings for the WEEK instruction with data registers.

4. S3 (source 3): Number of parameter tabs

This setting configures the number of parameter tabs.This setting is shared in common with "To configure the day of the week and the time as fixed settings". See "4. S3 (source 3): Number of parameter tabs" on page 12-3.

5. D1 (destination 1): Output

This setting configures the output for the results when the configured day of the week and time and the current day of the week and time are compared.This setting is shared in common with "To configure the day of the week and the time as fixed settings". See "5. D1 (destination 1): Output" on page 12-3.

6. Pulse Output

This setting configures the operation for D1 (output). This setting is applied to all parameter tabs and is shared in common with "To configure the day of the week and the time as fixed settings". See "6. Pulse Output" on page 12-3.

7. Data Register Allocation

Click this button to display the Data Register Allocation dialog box. As shown below, a table showing the data registers and their corresponding WEEK instruction settings is displayed on the dialog box (8). Click Allocate Comments (9) and you can configure the comments for the data registers that correspond to the names of the settings.This button is only used when indirectly specifying the settings for the WEEK instruction with data registers.

Data Register Allocation dialog box

Parameter tabThis tab configures the ON/OFF settings for the output. A maximum of 20 parameter tabs can be configured for 1 WEEK instruction.If indirectly specifying the settings for the WEEK instruction with data registers, the settings configured on the parameter tabs are stored in the data registers when the initialization input is turned on.

This setting is shared in common with "To configure the day of the week and the time as fixed settings". See "Parameter tab" on page 12-3.

PreviewThe preview shows the ON/OFF state for the output based on the settings configured on the parameter tabs as a time chart.This function is shared in common with "To configure the day of the week and the time as fixed settings". See "Preview" on page 12-4.

(8)

(9)

Page 47: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 12-7

12: WEEK PROGRAMMER INSTRUCTIONS

Data Register Allocation

If indirectly specifying the settings for the WEEK instruction with data registers, the settings are allocated to the data registers as follows.

Day of the week data register allocationThe day of the week for the ON settings and the day of the week for the OFF settings are allocated as bits in 1 data register as follows.

Example day of the week settings

[To configure the output to turn on Monday and to turn off Friday]

[To configure the output to turn on Monday and Thursday and to turn off Tuesday and Saturday]

The ON time and the OFF time are stored in the data register as follows.

Storage destination Data size (word) R (Read)/W (Write) SettingStart address+0 1 R/W

P 1 tab

Day of the week

Start address+1 1 R/W ON time

Start address+2 1 R/W OFF time

Start address+3 1 R/W

P 2 tab

Day of the week

Start address+4 1 R/W ON time

Start address+5 1 R/W OFF time

•••

•••

•••

•••

Start address+57 1 R/W

P 20 tab

Day of the week

Start address+58 1 R/W ON time

Start address+59 1 R/W OFF time

Monday is enabled in the ON settings, Friday is enabled in the OFF settings

Day of the week setting (ON): 0000010Day of the week setting (OFF): 0100000The value of the data register is 1000100000 (binary) = 544 (decimal).

Monday and Thursday are enabled in the ON settings, Tuesday and Saturday are enabled in the OFF settings

Day of the week setting (ON): 0010010Day of the week setting (OFF): 1000100The value of the data register is 1001001000100 (binary) = 4676 (decimal).

Bit15 14

Reserved Saturday

13

Friday

12

Thursday

11

Wednesday

10

Tuesday

9

Monday Sunday

Bit7 6

Reserved Saturday

5

Friday

4

Thursday

3

Wednesday

2

Tuesday

1

Monday

Bit0

Sunday

Bit8

ON settings day of the week OFF settings day of the week

Data register (1 word)0: Disabled (check box not selected)1: Enabled (check box selected)

Bit15 14

0

13

0

12

0

11

0

10

0

9

1 0

Bit7 6 5 4 3 2 1

Bit0

Bit8

ON settings OFF settings

Reserved Saturday Friday Thursday Wednesday Tuesday Monday Sunday Reserved Saturday Friday Thursday Wednesday Tuesday Monday Sunday

0 1 0 0 0 00

Bit15 14

0

13

0

12

1

11

0

10

0

9

1 0

Bit7 6 5 4 3 2 1

Bit0

Bit8

ON settings OFF settings

Reserved Saturday Friday Thursday Wednesday Tuesday Monday Sunday Reserved Saturday Friday Thursday Wednesday Tuesday Monday Sunday

1 0 0 0 1 00

12:34

1234 (Decimal)

23:45

2345 (Decimal)

Data register (1 word)Data register (1 word)

For 12:34 For 23:45

Page 48: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

12: WEEK PROGRAMMER INSTRUCTIONS

12-8 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Examples: WEEK

[To turn on output Q0 Monday to Friday each week from 8:30 to 17:15]

Parameter tab

Configure the tab as shown above and set D1 to Q0.

Ladder program

[To turn on output Q0 Tuesday, Wednesday, and Saturday each week from 20:30 to 1:15 the next day]

Parameter tab

Configure the tab as shown above and set D1 to Q0.

Ladder program

D1

Q0

S2WEEK S1 S3

1M8125

D1

Q0

S2WEEK S1 S3

1M8125

Page 49: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 12-9

12: WEEK PROGRAMMER INSTRUCTIONS

[To turn on output Q0 Monday, Wednesday, and Friday each week from 6:00 to 9:00, 15:00 to 18:00, and 22:00 to 0:00 the next day]

Parameter tab

Configure the settings using three tabs.

On P 1 tab, configure the output to turn on Monday, Wednesday, and Friday from 6:00 to 9:00.

On P 2 tab, configure the output to turn on Monday, Wednesday, and Friday from 15:00 to 18:00.

On P 3 tab, configure the output to turn on Monday, Wednesday, and Friday from 22:00 to 0:00 the next day.

Configure the tabs as shown above and set D1 to Q0.

Page 50: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

12: WEEK PROGRAMMER INSTRUCTIONS

12-10 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Ladder program

[To indirectly specify the settings with data registers]

This example describes turning on output Q0 Monday to Friday each week from 8:30 to 17:15 as an example.

Select the Data register settings check box and set S1 to D0 and S2 to M0.

Parameter tab

Data register allocationThe settings on the P 1 tab are allocated to data registers D0 to D2 as shown in the table below. The settings configured on the parameter tab are stored in D0 to D2 by turning on initialization input S2.

Ladder program

Data register Setting Initial settingD0

P 1 tab

Day of the week setting 15934 (Monday to Friday, both ON settings and OFF settings)

D1 ON time 830

D2 OFF time 1715

D1

Q0

S2WEEK S1 S3

3M8125

SOTU

M0

SOTUREPS1 -

900

MOV(W) D1 -

D1

M8120

REPS2 -

1700

D1 -

D2

M1

D1

M100

S2

M0

WEEK S1

D0

S3

1M8125

M10

MOV(W)

The initialization input (M1) turns on with the first scan and the initial settings configured on the P 1 tab are stored in D0 to D2.

The WEEK instruction starts operating according to the values of data registers D0 to D2.

When M10 turns on, the ON time (D1) changes to 9:00 and the OFF time (D2) changes to 17:00.

When M1 turns on, all of the WEEK instruction settings (D0 to D2) return to the initial settings.

Page 51: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 12-11

12: WEEK PROGRAMMER INSTRUCTIONS

YEAR (Yearly Timer)

Notes:

A maximum of 1 YEAR instruction can be used in a user program.

Normally the output is only updated when the current date and the date for the ON/OFF settings matches, but when the YEAR instruction input changes from off to on, the output state at the current date is determined according to the ON/OFF settings and the output is turned on or off.For details, see "Timing Chart when the Input Turns On during the Configured Interval" on page 12-20.

When pulse output is enabled, output is turned on for one scan at the instant (0:00) the date changes to the ON date.When the YEAR instruction input changes from off to on, the output state at the current date is judged according to the ON/OFF settings, and the output is turned on for 1 scan only.For pulse output, see "6. Pulse Output" on page 12-13 or "6. Pulse Output" on page 12-17.

When the year data is outside the range of 2000 to 2099, the month data is outside the range of 1 to 12, the day data is outside the range of 1 to 31, the week data is outside the range of 1 to 5, and the day of the week data is outside the range of 0 to 6, a user program execution error will occur.

The YEAR instruction cannot be used in an interrupt program.If used, a user program execution error will result, turning on special internal relay M8004 and the ERR LED on the SmartAXIS. For details about the user program execution errors, see "User Program Execution Errors" on page 4-13.

When the yearly setting or monthly setting is enabled and a date that does not exist according to the month or year is set for the ON setting or the OFF setting, the output turns on or off on the first day of the next month.

Applicable SmartAXIS

Valid Devices

Special data registers cannot be designated as S1. Internal relays M0 through M1277 can be designated as D1. Special internal relays cannot be designated as D1.

The YEAR instruction compares the specified date with the current date and outputs that result. With this instruction you can specify special dates within a one year period.

When the input is on, the output specified by D1 is turned on when the date specified by the ON settings matches the current date.

The output is turned off when the date specified by the OFF settings matches the current date.

When the ON settings are December 15, 2012 and the OFF settings are January 20, 2013, output D1 turns on and off as follows.

D1

*****

S2

*****

YEAR S1

*****

S3

*****

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-TouchX X X X X

Device Function I Q M R T C D Constant RepeatS1 (Source 1) Starting data register — — — — — — — —

S2 (Source 2) Initialization input — — X — — — — — —

S3 (Source 3) Number of parameter tabs — — — — — — — X —

D1 (Destination 1) Output port — X — — — — — —

11 12 1 2

ON

OFF

Output D1

Month

Day 20th15th

2012 2013Year

ON settings Month : December

Day : 15th

OFF settings Month : January

Day : 20th

Page 52: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

12: WEEK PROGRAMMER INSTRUCTIONS

12-12 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

SettingsThere are two methods to configure dates for the YEAR instruction. Specify the method on the Device tab with Data register settings.

Configure the dates as a fixed setting

The dates for the ON/OFF settings are uniquely determined. The dates for the ON/OFF settings cannot be changed while the SmartAXIS is running. For details, see "To configure the dates as a fixed setting" on page 12-12.

Configuring the dates by specifying data registers

The dates for the ON/OFF settings are configured according to the values stored in the specified data registers. The dates for the ON/OFF settings can be changed while the SmartAXIS is running. For details, see "To configure the dates by specifying data registers" on page 12-16.

To configure the dates as a fixed settingThe dates for the ON/OFF settings are uniquely determined. The dates for the ON/OFF settings cannot be changed while the SmartAXIS is running.

Device tab

1. Data register settings

This setting selects whether to configure YEAR instruction dates as fixed settings or to indirectly specify them with data registers.

To configure the dates as fixed settings, clear this check box.

Unselected check box

The dates are fixed settings.The dates are configured on the parameter tabs. The dates cannot be changed while the SmartAXIS is running. For the settings, see "Parameter tab" on page 12-3.

Note: When this check box is selected, the settings for dates are indirectly specified with data registers. Configure the dates by using data registers. The dates can be changed while the SmartAXIS is running. For indirection specification with data registers, see "To configure the dates by specifying data registers" on page 12-16.

2. S1 (source 1): Starting data register

This setting is not configured when configuring the dates as fixed settings.

3. S2 (source 2): Initialization input

This setting is not configured when configuring the dates as fixed settings.

1.

3. 5.

4.

2.

6.

Page 53: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 12-13

12: WEEK PROGRAMMER INSTRUCTIONS

4. S3 (source 3): Number of parameter tabs

This setting configures the number of parameter tabs. When this value is increased or decreased, the number of parameter tabs displayed on the dialog box increases or decreases. 10 bytes of the user program region are used for each parameter tab.For the settings, see "Parameter tab" on page 12-13.

5. D1 (destination 1): Output

This setting configures the output for the results when the configured dates and the current date are compared.

6. Pulse Output

This setting configures the operation for D1 (output). This setting is applied to all parameter tabs.

Selected check box

When the current date changes to the date in the ON settings, the output is turned on for only one scan.

Unselected check box

The output is turned on and off according to the ON settings and the OFF settings.

Parameter tab

This tab configures the settings for the output. A maximum of 20 parameter tabs can be configured for 1 YEAR instruction.

1. Yearly

When Yearly is selected, the Month and Day settings are valid every year.

At this time, you can configure whether or not to make the Month and Day settings valid yearly from a year until another year with Year.

2. Monthly

The settings for the selected tab are valid each month. At this time, Month is disabled.

Setting DescriptionTag Name Specifies the tag name or the device address for each device.

Device Address Shows the device address that corresponds to the tag name.

Comment Shows the comment for the device address. This item can be edited.

1. 2.

3.

4.

Page 54: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

12: WEEK PROGRAMMER INSTRUCTIONS

12-14 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

3. ON settings

This section configures the date to turn on the output. The output is turned on at 0:00 on the configured date.

4. OFF settings

This section configures the date to turn off the output. The output is turned off at 0:00 on the configured date.

Note: When the date is duplicated in the settings on other tabs, the settings on the tab with the larger tab number are valid.For example, if the ON date is the 8th of every month and the OFF date is the 16th of every month on the P 1 tab and the ON date is the 16th of every month and the OFF date is the 22nd of every month on the P 2 tab, the 16th of every month setting is duplicated on the two tabs and the ON settings for the P 2 tab are valid. In this situation, the output is on from the 8th to the 22nd of every month.

If the ON date is the 16th of every month and the OFF date is the 22nd of every month on the P 1 tab and the ON date is the 8th of every month and the OFF date is the 16th of every month on the P 2 tab, the 16th of every month setting is duplicated on the two tabs and the ON settings for the P 1 tab are disabled. In this situation, the output is on from the 8th to the 16th of every month.

Setting Description RangeYear Specifies the year to turn on the output. 2000 to 2099

Month and Daysetting

Month Specifies the month to turn on the output. 1 to 12

Day Specifies the day to turn on the output. 1 to 31

Day of the week

Specifies the day as the day of the week to turn on the output. Specify the week in the range of the 1st to the 5th (or the last) week and set the day of the week.

1 to 6

Setting Description RangeYear Specifies the year to turn off the output. 2000 to 2099

Month and Daysetting

Month Specifies the month to turn off the output. 1 to 12

Day Specifies the day to turn off the output. 1 to 31

Day of the week

Specifies the day as the day of the week to turn off the output. Select in the range of the 1st to the 5th (or the last) week and set the day of the week.

1 to 6

Specify ON duration

This item specifies whether or not to turn off the output after the number of specified days from when it was turned on.If this setting is enabled, the OFF settings are disabled. This setting can be set in a range from 1 day to 30 days.

1 to 30

ON date8th of every

month

OFF date16th of every month

Year

P 1 tab settingsON

OFF

P 2 tab settingsON

OFF

Output D1ON

OFF

9 10

ON date16th of

every month

OFF date22th of every month

Month 2012

Page 55: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 12-15

12: WEEK PROGRAMMER INSTRUCTIONS

Preview

The preview shows the ON/OFF state for the output based on the settings configured on the parameter tabs in a calendar.The dates that are set to ON are highlighted in orange. Three months are shown at one time.

Setting Description

Year Specifies the year to show in the preview.

Scrollbar You can change the month shown in the preview by moving the scrollbar.

Page 56: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

12: WEEK PROGRAMMER INSTRUCTIONS

12-16 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

To configure the dates by specifying data registersThe dates for the ON/OFF settings are configured according to the values stored in the specified data registers.The dates for the ON/OFF settings can be changed while the SmartAXIS is running.

When the date in the ON/OFF settings is modified with the YEAR instruction input turned on, the modified data register values are reflected in the ladder program when the current date and time matches 0:00 on the date in the ON/OFF settings.

Device tab

1. Data register settings

This setting selects whether to configure YEAR instruction dates as fixed settings or to indirectly specify them with data registers.

To configure the dates by specifying data registers, select this check box.

Selected check box

The date settings are indirectly specified by data registers. Configure the dates by using data registers. The dates can be changed while the SmartAXIS is running. For allocating the data register region, see "Data Register Allocation" on page 12-18.

The data registers can be initialized with the days of the week and the times configured on the parameter tabs by turning on the initialization input. For initialization, see "3. S2 (source 2): Initialization input" on page 12-16.

Note: When this check box is not selected, the dates are fixed settings. The dates are configured on the parameter tabs. The dates cannot be changed while the SmartAXIS is running. For fixed settings, see "To configure the dates as a fixed setting" on page 12-12.

2. S1 (source 1): Starting data register

This setting specifies the start of the data register region to store the dates for the YEAR instruction.

This setting is only used when indirectly specifying the dates with data registers.

For allocating the data register region, see "Data Register Allocation" on page 12-18.

3. S2 (source 2): Initialization input

This setting specifies the device to initialize the dates stored in the data register region that starts from S1 (source 1).

The values configured on the parameter tabs are stored in the data registers by turning on the initialization input.

This setting is only used when indirectly specifying the settings for the YEAR instruction with data registers.

Setting DescriptionTag Name Specifies the tag name or the device address for the device.

Device Address Shows the device address that corresponds to the tag name.

Used Data RegistersShows the range of data registers used to store the settings. This item changes when the device address or the number of parameter tabs changes.

Comment Shows the comment for the device address. This item can be edited.

1.

3. 5.

4.

2.

6.

7.

Page 57: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 12-17

12: WEEK PROGRAMMER INSTRUCTIONS

4. S3 (source 3): Number of parameter tabs

This setting configures the number of parameter tabs.This setting is shared in common with "To configure the dates as a fixed setting". See "4. S3 (source 3): Number of parameter tabs" on page 12-13.

5. D1 (destination 1): Output

This setting configures the output for the results when the configured dates and the current date are compared.This setting is shared in common with "To configure the dates as a fixed setting". See "5. D1 (destination 1): Output" on page 12-13.

6. Pulse Output

This setting configures the operation for D1 (output). This setting is applied to all parameter tabs.

This setting is shared in common with "To configure the dates as a fixed setting". See "6. Pulse Output" on page 12-13.

7. Data Register Allocation

Click this button to display the Data Register Allocation dialog box. As shown below, a table of the data registers and their corresponding YEAR instruction settings is displayed on the dialog box (8). Click Allocate Comments (9) and you can configure the comments for the data registers that correspond to the names of the settings.This button is only used when indirectly specifying the settings for the YEAR instruction with data registers.

Data Register Allocation dialog box

Parameter tabThis tab configures the settings for the output. A maximum of 20 parameter tabs can be configured for 1 YEAR instruction.If indirectly specifying the settings for the YEAR instruction with data registers, the settings configured on the parameter tabs are stored in the data registers when the initialization input is turned on.

This setting is shared in common with "To configure the dates as a fixed setting". See "Parameter tab" on page 12-13.

PreviewThe preview shows the ON/OFF state for the output based on the settings configured on the parameter tabs in a calendar.This function is shared in common with "To configure the dates as a fixed setting". See "Preview" on page 12-15.

(9)

(8)

Page 58: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

12: WEEK PROGRAMMER INSTRUCTIONS

12-18 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Data Register Allocation

The settings configured on the parameter tabs are allocated to the data registers as follows.

Month, Day or Day of the week data register allocation

The Month, Day or Day of the week are allocated as bits in 1 data register as follows.

Storage destination Data size (word) R (Read)/

W (Write) Setting

Start address+0 1 R/W

P 1 tab

ON settingYear

Start address+1 1 R/W Month, Day or Day of the week

Start address+2 1 R/WOFF setting

Year

Start address+3 1 R/WMonth, Day or Day of the week (number of days when specified to remain on)

Start address+4 1 R/W

P 2 tab

ON settingYear

Start address+5 1 R/W Month, Day or Day of the week

Start address+6 1 R/WOFF setting

Year

Start address+7 1 R/WMonth, Day or Day of the week (number of days when specified to remain on)

•••

•••

•••

•••

Start address+76 1 R/W

P 20 tab

ON settingYear

Start address+77 1 R/W Month, Day or Day of the week

Start address+78 1 R/WOFF setting

Year

Start address+79 1 R/WMonth, Day or Day of the week (number of days when specified to remain on)

Bit15 14 13 12 11 10 9 6 5 4 3 2 1

Reserved

Bit8

Bit7

Bit0

Month setting Reserved Day setting

Data register (1 word)

January to December 1st to 31st

Bit15 14 13 12 11 10 9 6 5 4 3 2 1

Reserved

Bit8

Bit7

Bit0

Month setting Reserved Week setting

Data register (1 word)

January to December 1st to 5th (or the last) Sunday to Saturday

(Binary) (Decimal)000001010011100101110

=======

0123456

: Sunday: Monday: Tuesday: Wednesday: Thursday: Friday: Saturday

Day of the week assignments

(Binary) (Decimal)001000010000011000100000101000 110000

======

81624324048

: 1st : 2nd : 3rd : 4th : 5th : Last

Week setting assignments

Day of the week setting

● Month, Day

● Month, Week, Day of the week

Page 59: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 12-19

12: WEEK PROGRAMMER INSTRUCTIONS

Example day of the week settings

[When configured to turn on the output on January 1st]

[When configured to turn on the output on December 31st]

[When configured to turn on the output on the 1st Monday of January]

[When configured to turn on the output on the 4th Thursday of June]

January 1st

Month setting: 0001 = 1

Day setting: 00001 = 1

The value of the data register is 100000001 (binary) = 257 (decimal).

December 31st

Month setting: 1100 = 12

Day setting: 11111 = 31

The value of the data register is 110000011111 (binary) = 3103 (decimal).

1st Monday of January

Month setting: 0001 = 1 (January)

Week setting: 001 = 1 (1st)

Day of the week setting: 001 = 1 (Monday)

The value of the data register is 100001001 (binary) = 265 (decimal).

4th Thursday of June

Month setting: 0110 = 6 (June)

Week setting: 100 = 4 (4th)

Day of the week setting: 100 = 4 (Thursday)

The value of the data register is 11000100100 (binary) = 1572 (decimal).

Bit15 14 13 12 11 10 9 6 5 4 3 2 1

Reserved

Bit8

Bit7

Bit0

Month setting Reserved Day setting

10 0 000 0 0 0 0 0 10 0 00

Bit15 14 13 12 11 10 9 6 5 4 3 2 1

Reserved

Bit8

Bit7

Bit0

Month setting Reserved Day setting

01 1 000 0 0 0 0 0 11 1 11

10 0 000 0 0 0 0 0 11 0 00

Bit15 14 13 12 11 10 9 6 5 4 3 2 1

Reserved

Bit8

Bit7

Bit0

Month setting Reserved Week setting Day of the week setting

00 1 100 0 0 0 0 1 00 1 00

Bit15 14 13 12 11 10 9 6 5 4 3 2 1

Reserved

Bit8

Bit7

Bit0

Month setting Reserved Week setting Day of the week setting

Page 60: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

12: WEEK PROGRAMMER INSTRUCTIONS

12-20 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Timing Chart when the Input Turns On during the Configured Interval

When the input turns on or off during the interval between the ON settings and the OFF settings, and when the input turns on or off after 0:00 on the date configured by the ON settings when pulse output is enabled, the timing chart is as follows.

When pulse output is disabledWhen the input is turned on, the current date and the ON and OFF settings are compared and the output turns on or off.

[When the input is on before the day specified by the ON settings]

On February 13, 2012, when the input is turned on, the result of the current date compared with the ON and OFF settings is not within the ON and OFF settings (February 15 to February 17, 2012). Therefore, the output remains off.

[When the input is turned on or off during the interval between the ON and OFF settings]

On February 15, 2012, when the input is turned on, the result of the current date compared with the ON and OFF settings is within the ON and OFF settings (February 15 to February 17, 2012). Therefore, the output turns on. The output turns off when the input is turned off.

On February 16, 2012, when the input is turned on, the result of the current date compared with the ON and OFF settings is that the output is turned on.

Settings Ladder program

ON settings February 15, 2012

OFF settings February 17, 2012

Output port Q0

D1

Q0

S2YEAR S1 S3

1M0

Input M0ON

OFF

Output Q0ON

OFF

13thFebruary 2012

Current date 14th 15th 16th 17th

Judgment ON settings OFF settings

Input M0ON

OFF

Output Q0ON

OFF

13thFebruary 2012

Current date 14th 15th 16th 17th

JudgmentON settings OFF settingsJudgment

Page 61: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 12-21

12: WEEK PROGRAMMER INSTRUCTIONS

When pulse output is enabledThe input is determined to be on or off at 0:00 on the date of the ON settings and the output is turned on. The current date is not compared with the ON settings when the input is turned on.

[When the input turns on before the day specified by the ON settings]

The result of the input being determined at 0:00 on July 2, 2012 is to turn on the output for one scan.

The result of the input being determined at 0:00 on July 4, 2012 is to turn on the output for one scan.

[When the input turns on exactly on the day specified by the ON settings]

When the input turns on at 0:00 on July 2, 2012, the output turns on for one scan.

When the input turns on after 0:00 on July 4, 2012, the output turns on for one scan.

Settings Ladder program

P 1 tab ON settings July 2, 2012

P 2 tab ON settings July 4, 2012

Output port Q0

D1

Q0

S2YEAR S1 S3

2M0

Input M0ON

OFF

Output Q0ON

OFF

1stJuly 2012

Current date 2st 3st 4st 5st

P 1 tab ON settings

P 2 tab ON settings

Input M0ON

OFF

Output Q0ON

OFF

1thJuly 2012

Current date 2th 3th 4th 5th

P 1 tab ON settings

P 2 tab ON settings

Output is not turned on

Page 62: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

12: WEEK PROGRAMMER INSTRUCTIONS

12-22 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Examples: YEAR

To configure the dates as fixed settings

[To turn on Q0 from 0:00 on September 1, 2011, to 0:00 on June 25, 2013]

Parameter tab

Configure the tab as shown above and set D1 to Q0.

Ladder program

ON

OFF

*** 2011 2012 2013 2014 ***

9/1 6/25

ON date : 2011/09/01

OFF date : 2013/06/25

Yearly : OFF

Monthly : OFF

D1

Q0

S2YEAR S1 S3

1M8125

Page 63: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 12-23

12: WEEK PROGRAMMER INSTRUCTIONS

[To turn on output Q0 from 0:00 on August 12 to 0:00 on August 15 every year]

Parameter tab

Configure the tab as shown above and set D1 to Q0.

Ladder program

ON

OFF

*** 2009 2010 2011 2012 ***

8/12 8/15 8/12 8/15 8/12 8/15 8/12 8/15

ON date : 2000/08/12

OFF date : 2099/08/15

Yearly : ON

Monthly : OFF

D1

Q0

S2YEAR S1 S3

1M8125

Page 64: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

12: WEEK PROGRAMMER INSTRUCTIONS

12-24 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

[To turn on output Q0 only on the 2nd Monday of each month from 2000 to 2099]

Parameter tab

Configure the tab as shown above and set D1 to Q0.

Ladder program

ON

OFF

*** January February March April ***

2ndMonday

2nd Monday

+ 1 day

2ndMonday

2nd Monday

+ 1 day

2ndMonday

2nd Monday

+ 1 day

2ndMonday

2nd Monday

+ 1 day

ON date : 2000/**/2nd Monday

OFF date : 2099/**/2nd Monday + 1 day

Yearly : OFF

Monthly : ON

D1

Q0

S2YEAR S1 S3

1M8125

Page 65: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 12-25

12: WEEK PROGRAMMER INSTRUCTIONS

To configure the dates by specifying data registers

[To turn on Q0 from 0:00 on September 1, 2011, to 0:00 on June 25, 2013]

Data register allocation

The settings on the P 1 tab are allocated to data registers D0 to D3 as shown in the table below. The settings configured on the P 1 tab are stored in D0 to D3 by turning on initialization input S2.

Ladder program

Data register Setting Initial settingD0

P 1 tab

ON settingsYear 2011

D1 Month, Day 2305 (September 1st)

D2OFF settings

Year 2013

D3 Month, Day 1561 (June 25th)

ON

OFF

*** 2011 2012 2013 2014 ***

9/1 6/25

ON date : 2011/09/01

OFF date : 2013/06/25

Yearly : OFF

Monthly : OFF

Device tab Parameter tab

SOTU

M0

SOTUREPS1 -

2013

MOV(W) D1 -

D0

M8120

REPS2 -

2020

D1 -

D2

M1

D1

M100

S2

M0

YEAR S1

D0

S3

1M8125

M10

MOV(W)

The initial settings configured on the P 1 tab are stored in D0 to D3 at the first scan.

The YEAR instruction starts operating according to the values of data registers D0 to D3.

When M10 turns on, the ON settings year changes to 2013 (D0) and the OFF settings year changes to 2020 (D2).

When M1 turns on, all of the YEAR instruction settings (D0 to D3) return to the initial settings.

Page 66: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

12: WEEK PROGRAMMER INSTRUCTIONS

12-26 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Page 67: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 13-1

13:DISPLAY INSTRUCTIONS

IntroductionThe display instructions display the specified data such as text and device values on the SmartAXIS LCD.

MSG (Message)This instruction displays the specified data on the SmartAXIS LCD.

When the input turns on, a message is displayed on the LCD according to the content configured in the MSG instruction dialog box.The following types of data can be displayed.

Device values can be displayed. Word device values can be displayed as numeric values according to the specified data type.

For details, see "Insert Word Device" on page 13-4. Word device values can be displayed as bar graphs.

For details, see "Insert Bar Graph" on page 13-7. Text can be displayed and switched according to the value of a bit device (input/output, internal relay, shift register, timer contact, or counter

contact).For details, see "Insert Bit Device" on page 13-5.

Arbitrary text can be displayed. The specified text can be displayed.

For details, see "Edit MSG (Message) dialog box" on page 13-2.

The text display effects can be configured. Text can be scrolled, blinked, or inverted.

For details, see "Insert Text with Effect" on page 13-6.

Date/time data can be displayed. The current date/time and the date/time when the input to the MSG instruction is turned on can be displayed on the LCD.

For details, see "7. Special Data" on page 13-3.

The language for displayed text can be selected from 9 languages. Text can be displayed in 9 languages using 4 types of character sets.

For details, see "MSG Instruction Common Settings" on page 13-8.

The text display settings can be configured. The scroll unit, scroll speed, and blinking speed can be configured.

For details, see "MSG Instruction Common Settings" on page 13-8.

Device values can be modified. Device values displayed with the MSG instruction can be modified on the SmartAXIS.

For details, see "Modifying Device Values on the SmartAXIS" on page 13-16.

Notes: A maximum of 50 MSG instructions can be entered in a user program. Only one MSG instruction message can be displayed on the LCD. S1 for

the MSG instruction stores the MSG instruction priority. When the display conditions for multiple MSG instructions are satisfied, the messages are displayed according to the priority set for the MSG instruction.For MSG instruction priority, see "10. Priority" on page 13-3.

The MSG instruction cannot be used during an interrupt program. If it is used during an interrupt program, a user program execution error occurs, the execution of the instruction is canceled, and the next instruction is executed.For user program execution errors, see "User Program Execution Errors" on page 4-13.

Applicable SmartAXIS

For Pro only (The display instructions cannot be used on Lite.)

Valid Devices

*1 Special internal relays cannot be used.

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-Touch—

Device Function I Q M R T C D Constant RepeatS1 (Source 1) Priority — — — — — — — X —

MSG S1

*****

Page 68: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

13: DISPLAY INSTRUCTIONS

13-2 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Settings

For the MSG instruction settings, there are settings for the individual MSG instruction and settings that are common to all the MSG instructions.

Note: Settings that are common to all the MSG instructions are modified in the Function Area Settings dialog box of WindLDR. For details, see "MSG Instruction Common Settings" on page 13-8.

■MSG Instruction Individual Settings

The settings for the individual MSG instruction, such as texts and devices to display and the priority, can be configured in the Edit MSG instruction dialog box.

Edit MSG (Message) dialog box

1. LCD Screen

The screen displayed on the SmartAXIS LCD when the MSG instruction is executed can be configured in this area. Enter characters at the cursor position using the keyboard. The character input method (insert/overwrite) is changed by clicking Insert (9).

Note: Text entered on the LCD Screen (1) with the keyboard cannot be set to scroll, blink, or invert. To scroll, blink, or invert the text, enter the text with Text with Effects (5) and configure the display options. For details on inserting text with effects, see "Insert Text with Effect" on page 13-6.

2. Work Area

This area is used when editing the LCD screen. This area is for temporarily relocating text and device data.

Text and device data be moved between the LCD Screen and the Work Area with or .

When the dialog is closed, the work area data is discarded.

3. Word Device

Inserts a word device at the cursor position. The value of the specified word device is displayed on the SmartAXIS LCD. For details, see "Insert Word Device" on page 13-4.

4. Bit Device

Inserts a bit device in the area specified by the cursor. Two different items of text can be switched between and displayed on the SmartAXIS LCD according to the value of the specified bit device. For details, see "Insert Bit Device" on page 13-5.

5. Text with Effects

Inserts text in the area specified by the cursor. The specified text is displayed on the SmartAXIS LCD. For details, see "Insert Text with Effect" on page 13-6.

6. Bar Graph

Inserts a bar graph in the area specified by the cursor. The value of the specified device is displayed as a bar graph on the SmartAXIS LCD. For details, see "Insert Bar Graph" on page 13-7.

1.3.4.5.6.

7. 8. 9.

10. 11.

2.

Page 69: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 13-3

13: DISPLAY INSTRUCTIONS

7. Special Data

Special data such as the current date and time can be entered at the cursor position. Select the data to enter on the special data list window popped up when Special Data is pressed. Size of the area used on the LCD screen varies based on the selected special data.

8. Special Character

A special character can be entered at the cursor position. Select the character to enter on the special characters list window popped up when Special Character is pressed. The special characters that can be used are as follows.

9. Insert/Overwrite

Selects insert or overwrite as the character input mode. Click this button to switch the input mode.

10. Priority

The priority of the MSG instruction can be configured between 0 to 49. 0 is the highest priority and 49 is the lowest priority.

The same priority cannot be set for multiple MSG instructions.

When inputs to two or more MSG instructions turns on, the message of the MSG instruction with the highest priority is displayed, out of all the MSG instructions with inputs that are on.

When the MSG instruction input with the highest priority changes from on to off, the message for the MSG instruction with the next highest priority is displayed (the priority is checked when the input changes).

If Acknowledgement (11) is enabled for the MSG instruction with the highest priority, even after the input changes from on to off, the same message is kept displayed. The message for the MSG instruction with the next highest priority is displayed when the SmartAXIS module

(OK) button is pressed.

Note: When you press the (up) or (down) button on the SmartAXIS, the messages are switched between the MSG instructions that have inputs that are on. Messages are also switched when the acknowledgement for the MSG instruction is enabled.

11. Acknowledgment

When acknowledgement is enabled, the message is kept displayed even after the input to the MSG instruction is turned off. The message is closed when (OK) button on the SmartAXIS is pressed, and then the message for the MSG instruction with the next highest priority is displayed, out of all the MSG instructions with inputs that are on at that time. If the input to the MSG instruction is on, the message is not closed even when the (OK) button is pressed.

Special dataDisplay Occupied Area

(Lines x columns)Display type Display example (January 1, 2012, 13:30)

Current date YYYY/MM/DD 2012/01/01 1 x 10

Current time HH:MM 13:30 1 x 5

Date the input to the MSG instruction is turned on YYYY/MM/DD 2012/01/01 1 x 10

Time the input to the MSG instruction is turned on HH:MM 13:30 1 x 5

Special characters list

°C °F ° ±

Example: Message outputin Priority 30

Example: Message output in Priority 10

Date and current time

Running

2012/OCT/01/MON09:00:12

Motor 5STOP AT10:12

!! ACTION !!

Motor 23000hours

!! MAINTENANCE !!

Page 70: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

13: DISPLAY INSTRUCTIONS

13-4 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Insert Word DeviceThe value of the specified word device can be displayed on the SmartAXIS LCD.

1. Device

Enter the device to display.

Valid Devices

2. Data Type and Conversion Type

Select the display type for the specified device. The size of the area used on the LCD screen varies based on the specified data type and conversion type.

3. Display Options

Configure the options to blink or invert the value of the specified device. For the blinking speed, see "MSG Instruction Common Settings" on page 13-8.

4. Occupied Area

Shows the size of the area to be used on the LCD screen (Lines: 1, columns: 4 to 13). The area is determined by the selected data type and conversion type.

W (word) TC, TP, CC, CP, D

I (integer) D

D (double word) CC, CP, D

L (long) D

F (float) D

Data Type Conversion Type Occupied Area Example on LCD

W (word)Decimal 5 65535

Hexadecimal 4 FFFF

I (integer) Decimal 6 -32768

D (double word)Decimal 10 4294967295

Hexadecimal 8 FFFFFFFF

L (long) Decimal 11 -2147483648

F (float) Decimal 13 -3.402823E+38

Display Options Description

Blinking Blinks the value of the specified device.

Invert Inverts the display of the specified value.

1.

2.

3.

4.

Page 71: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 13-5

13: DISPLAY INSTRUCTIONS

Insert Bit DeviceTwo different items of text can be switched between and displayed on the SmartAXIS LCD according to the value of the specified bit device (when on/when off).

1. Device

Enter the device to display.

Valid Devices

2. Display Options

Configure the options to blink or invert the text. For the blinking speed, see "MSG Instruction Common Settings" on page 13-8.

3. Occupied Area

Shows the size of the area to be used on the LCD screen (Lines: 1, columns: 1 to 24). The display size is determined by the selected range on the LCD screen area (or work area). If multiple lines are selected, the area at the top line in the selected range is used.

4. ON Text

Enter the text to display when the specified device is on. Up to 24 single-byte characters can be entered. A space is also counted as one character.

5. OFF Text

Enter the text to display when the specified device is off. Up to 24 single-byte characters can be entered. A space is also counted as one character.

6. Special Character

Enters a special character at the cursor position. Select the character to enter on the special characters list window popped up when Special Character is pressed. For the special characters, see "8. Special Character" on page 13-3.

7. Insert/Overwrite

Selects whether to insert or overwrite characters when entering new characters.

I Q M R T C DX X X X X X —

Display Options Description

Blinking Blinks the specified text.

Invert Inverts the display of the specified text.

1.

2.

3.

4.

5.

6. 7.

Page 72: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

13: DISPLAY INSTRUCTIONS

13-6 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Insert Text with EffectThe specified text can be displayed on the SmartAXIS LCD.

1. Display Options

Configure the options to scroll, blink, or invert the specified text. For the scroll unit, scroll speed, and blinking speed, see "MSG Instruction Common Settings" on page 13-8.

2. Occupied Area

Shows the size of the area to be used on the LCD screen (Lines: 1, columns: 1 to 24). The occupied area is determined by the selected range on the LCD screen area (or work area). If multiple lines are selected, the area at the top line in the selected range is used.

3. Input Text Directly

Directly enter the characters to display. A space is also counted as one character. If scrolling is disabled, the message can be entered up to 24 single-byte characters. However, you cannot enter a number of characters that exceeds the occupied area. If scrolling is enabled, the message can be entered up to 48 single-byte characters.

4. Select from Text Manager

Select the text to display from the text manager. This can be selected only when the scroll is enabled.

5. Special Character

Enters a special character at the cursor position. Select the character to enter on the special characters list window popped up when Special Character is pressed. For the special characters, see "8. Special Character" on page 13-3.

6. Insert/Overwrite

Selects whether to insert or overwrite characters when entering new characters.

[When scrolling is disabled] [When scrolling is enabled]

1.

2.

3.

4.

5. 6. 5.

4.

6.

Display Options Description

Scroll Scrolls the specified text.

Blinking Blinks the specified text.

Invert Invert the display of the specified text.

Page 73: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 13-7

13: DISPLAY INSTRUCTIONS

Insert Bar GraphThe value of the specified device can be displayed as a bar graph on the SmartAXIS LCD.

1. Device

Enter the device to display as a bar graph.Valid Devices

2. Data Type

Selects the data type for the specified device.Data Type

For data types, see "Data Types for Advanced Instructions" on page 4-10.

3. Maximum

Enter the maximum value for the bar graph. If the device value is larger than the maximum value, the bar graph is displayed as the maximum value. The valid range varies based on the data type. See "Data Types for Advanced Instructions" on page 4-10.

4. Minimum

Enter the minimum value for the bar graph. If the device value is smaller than the minimum value, the bar graph is displayed as the minimum value. The valid range varies based on the data type. See "Data Types for Advanced Instructions" on page 4-10.

5. Origin

Enter the value to be the origin of the bar graph. If the device value is larger than the origin value, the bar graph is displayed on the right side of the origin value. If the device value is smaller than the origin value, the bar graph is displayed on the left side of the origin value. The valid range varies based on the data type. See "Data Types for Advanced Instructions" on page 4-10. The origin value must satisfy the condition of Minimum ≤ Origin ≤ Maximum.

6. Occupied Area

The occupied area is determined by the selected range on the LCD screen area (or work area). If multiple lines are selected, the area at the top line in the selected range is used (Lines: 1, columns: 1 to 24).

W (word) TC, TP, CC, CP, D

I (integer) D

D (double word) CC, CP, D

L (long) D

F (float) —

W (word) X

I (integer) X

D (double word) X

L (long) X

F (float) —

1.

2.

3.

4.

5.

6.

7.

Line A monitorTarget count:Prod. count:

3000014500

Min Origin Max<= <=

Page 74: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

13: DISPLAY INSTRUCTIONS

13-8 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

7. Blinking Settings

Blink the bar graph when the value of the specified device exceeds the upper or lower limit.For the blinking speed, see "MSG Instruction Common Settings" on page 13-8.

Maximum, minimum, upper limit, and lower limit values must satisfy the following condition.

■MSG Instruction Common Settings

The common settings, character set, scroll unit, scroll speed, and blinking speed, for the message to display can be configured. The common settings are configured in the WindLDR Function Area Settings dialog box.Note: The common settings for the MSG instructions are applicable for all MSG (message) instructions in the user program. For the MSG instruction individual settings, see "MSG Instruction Individual Settings" on page 13-2.

Function Area Settings dialog box

1. Character Set

The character set used for the messages can be configured from the following.

2. Scroll Unit

The unit to scroll the texts can be configured.

3. Scroll Speed

The speed to scroll the texts can be configured. The setting range is 500 to 1000 ms.

4. Blinking SpeedThe speed to blink the texts can be configured. The setting range is 500 to 1000 ms.

Note: The MSG instruction character set can be configured irrespective of the SmartAXIS system menu language.

Blinking Settings Description

Upper limit The bar graph is blinked when the value of the specified device is larger than the upper limit.

Lower limit The bar graph is blinked when the value of the specified device is smaller than the lower limit.

Line A monitorTarget count:Prod. count:

3000014500

Min Lower limit Upper limit Max< < <

Selection Character Set Languages usable in the MSG instruction

European ISO-8859-1 (Latin 1) Italian, English, Dutch, Spanish, German, French

Japanese Shift-JIS Japanese

Chinese GB2312 Chinese (simplified)

Cyrillic ANSI 1251 Russian

1 character Scrolls the text in 1 character units.

1 dot Scrolls the text in 1 dot units.

1.2.3.4.

Page 75: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 13-9

13: DISPLAY INSTRUCTIONS

MSG Instruction Configuration Example

■Settings

Configure the following items.

2 0 21 / 0 31 / 0 2 0 21 / 0 31 / 0

IDEC outdoor temp isNow: -5

IDEC room temp isNow: °C28°C

[Display the room temperature when M0000 is on and the outdoor temperature when M0000 is off]

The room temperature/outdoor temperature value is stored in D0002.

Bar graph is used to Show the rise and fall in temperature visually.Displays the current date.

Setting items Setting details

1. Bit Device

Device M0000

Display Options All disabled (scroll, blink, invert)

ON Text IDEC room temp is:

OFF Text IDEC outdoor temp is:

2. Text with EffectsText Now:

Display Options All disabled (scroll, blink, invert)

3. Word Device

Device D0002

Data Type I (integer)

Conversion Type Decimal

4. Special Character °C

5. Bar Graph

Device D0002

Data Type I (integer)

Max 50

Min -20

Origin 0

Blinking Settings Disabled

6. Special Data Current date

IDEC room temp isNow: 28°C

2 0 21 / 0 31 / 0

1. Bit Device

2. Text with Effects

6. Special Data

3. Word Device5. Bar Graph

4. Special Character

Page 76: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

13: DISPLAY INSTRUCTIONS

13-10 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

■Operation Procedure

1. On the WindLDR right-click menu, click Advanced Instructions > Display > MSG (Message).

2. The MSG (Message) dialog box opens.

Configuring the bit device

3. Select the area to insert the parameter and click Bit Device.

The Insert Bit Device dialog box opens.

4. Configure the parameters so that the room temperature is displayed when M0000 is on and the outdoor temperature is displayed when M0000 is off. Set Device to "M0000". Using the keyboard, enter "IDEC room temp is:" as the ON Text and "IDEC outdoor temp is:" as the OFF Text. Under Display Options, disable all of the options.

IDEC room temp is

IDEC outdoor temp is

Displayed when M0000 is on

Displayed when M0000 is off

Page 77: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 13-11

13: DISPLAY INSTRUCTIONS

5. After the settings are configured, click OK.The configured content is displayed on the LCD screen area.

Configuring the text with effect

6. Select the six-column area from the start of the second line and click Text with Effect.

Note: The text can also be entered directly on the LCD screen area. In the sample above, move the cursor to the start of the second line and enter "Now:" with the keyboard. When you directly enter the text, proceed to "Configuring the word device" on page 13-12, step 9.

The Insert Text with Effect dialog box opens.

7. In Text, enter "Now:" with the keyboard. Under Display Options, disable all of the options.

IDEC room temp isNow:

Page 78: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

13: DISPLAY INSTRUCTIONS

13-12 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

8. After the settings are configured, click OK.The configured content is displayed on the LCD screen area.

Configuring the word device

9. Select the area at the ninth column on the second line and click Word Device.

The Insert Word Device dialog box opens.

10. Set Device to "D0002", Data Type to I (Integer), and Conversion Type to Decimal.Under Display Options, disable all of the options.

IDEC room temp isNow: 28

Page 79: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 13-13

13: DISPLAY INSTRUCTIONS

11. After the settings are configured, click OK.The configured content is displayed on the LCD screen area.

Configuring the special character

12. Select the area at the 15th column on the second line and click Special Character.

The Special Characters List window is popped up.

13. Double-click on °C.

The configured content is displayed on the LCD screen area.

IDEC room temp isNow: 28°C

Page 80: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

13: DISPLAY INSTRUCTIONS

13-14 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Configuring the bar graph

14. Select the entire area on the third line and click Bar Graph.

The Insert Bar Graph dialog box opens.

15. Set Device to "D0002", Max to "50", Min to "-20", and Origin to "0".Disable the blinking settings.

16. After the settings are configured, click OK.The configured content is displayed on the LCD screen area.

IDEC room temp isNow: 28°C

Min Origin Max

Page 81: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 13-15

13: DISPLAY INSTRUCTIONS

Configuring the special data

17. Select the left edge of the fourth line and click Special Data.

The Special Data List window is poped up.

18. Double-click on the Current date.

19. After the settings are configured, click OK.The configured content is displayed on the LCD screen area.

This concludes configuring the settings.

LCD display

2 0 21 / 0 31 / 0

IDEC room temp isNow: 28°C

2 0 21 / 0 31 / 0

IDEC room temp isNow:

2 0 21 / 0 31 / 0

IDEC outdoor temp is

28°C

Now: -5°C

When M0000 is on, the room temperature stored in D0002is displayed as the numeric value (°C) and bar graph.

When M0000 is off, the outdoor temperature stored in D0002is displayed as the numeric value (°C) and bar graph.

Page 82: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

13: DISPLAY INSTRUCTIONS

13-16 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Modifying Device Values on the SmartAXISThe values of the word devices displayed on the SmartAXIS LCD can be modified using the SmartAXIS operation buttons.The values cannot be modified when the SmartAXIS is stopped.

[To modify the value of word device CP0]

When the SmartAXIS is running and the input to the MSG instruction is turned on, the following screen will be displayed on the LCD.

While the above message is displayed, press and hold the (OK) button and the cursor is displayed on the devices that can be modified.

Move the cursor to the device you wish to edit using the (up) (down) (left) (right) buttons and press and hold the (OK) button to change the device in the editable state.

Press the (right) button to move the cursor to the fourth digit, and then use the (up) button to modify the target value to "65000".

Press the (OK) button to confirm the modifications.

Line A monitorPlan: CPO Actual:CCODiff: DO

Bar Graph CC0

Line A monitorPlan: 60000 Actual:20000Diff: 40000

Line A monitorLine A monitor

Diff: 40000Plan: 60000 Actual:20000

Line A monitor

Diff: 40000Plan: 60000 Actual:200006

Line A monitor

Diff: 40000Plan: 65000 Actual:200005

Line A monitorLine A monitor

Diff: 40000Plan: 65000 Actual:20000

Page 83: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 13-17

13: DISPLAY INSTRUCTIONS

Scrolling text example

[Character Set: European scroll speed: 500 ms]

When a text with effect is set to scroll, the text is displayed on the SmartAXIS LCD as follows.

When scrolling a text longer than the specified area on the LCD

Text: "IDEC Corporation SmartAXIS"

When scrolling a text shorter than or equal to the specified area on the LCD

Text: "IDEC Corp. SmartAXIS"

500 msec

500 msec

500 msec

500 msec

500 msec

500 msec

500 msec

500 msec

500 msec

500 msec

500 msec

500 msec

IDEC Corporation SmartAXIS

・・・

IDEC Corporation SmartAXIS

ion SmartAXIS

on SmartAXIS

IDEC Corpor

IDEC Corpora

IDEC Corporat

IDEC Corporati

IDEC Corporation SmartAXIS

IDEC Corporation SmartAXIS

IDEC Corporation SmartAXIS

IDEC Corporation SmartAXIS

IDEC Corporation SmartAXIS

500 msec

500 msec

500 msec

500 msec

500 msec

500 msec

・・・

IDEC Corp. SmartAXIS

DEC Corp. SmartAXIS I

EC Corp. SmartAXIS ID

C Corp. SmartAXIS IDE

Corp. SmartAXIS IDEC

Corp. SmartAXIS IDEC

orp. SmartAXIS IDEC C

Page 84: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

13: DISPLAY INSTRUCTIONS

13-18 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

[Character Set: European, Scroll speed: 500 ms, Scroll unit: 1-dot]

When a text with effect is set to scroll, the text is displayed on the LCD of the SmartAXIS as follows.

Text: "IDEC Corporation SmartAXIS"

62.5 msec

62.5 msec

62.5 msec

62.5 msec

62.5 msec

62.5 msec

62.5 msec

62.5 msec

1 character (8 dots) is scrolled in 500 ms

62.5 msec

123456789101011111212131314141515161612

1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 55 6 7 8 1 25 6 7 8 1 21 2123456789

10111213141516

12

IDEC Corporation.

Page 85: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 14-1

14:PROGRAM BRANCHING INSTRUCTIONS

IntroductionThe program branching instructions reduce execution time by making it possible to bypass portions of the program whenever certain conditions are not satisfied.

The basic program branching instructions are LABEL and LJMP, which are used to tag an address and jump to the address which has been tagged. Programming tools include “either/or” options between numerous portions of a program and the ability to call one of several subroutines which return execution to where the normal program stopped.

LABEL (Label)

Applicable SmartAXIS

Valid Devices

LJMP (Label Jump)

Applicable SmartAXIS

Valid Devices

For valid device address ranges, see "Device Addresses" on page 3-1.

Since the LJMP instruction is executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction should be used.

Note: Make sure that a LABEL instruction of the label number used for a LJMP instruction is programmed. When designating S1 using other than a constant, the value for the label is a variable. When using a variable for a label, make sure that all probable LABEL numbers are included in the user program. If a matching label does not exist, a user program execution error will result, turning on special internal relay M8004 and the ERR LED on the SmartAXIS. For details about the user program execution errors, see "User Program Execution Errors" on page 4-13.

This is the label number, from 0 to 255, used at the program address where the execution of program instructions begins for a program branch.

An END instruction may be used to separate a tagged portion of the program from the main program. In this way, scan time is minimized by not executing the program branch unless input conditions are satisfied.

Note: A single label number cannot be used more than once.

LABEL***

FT1A-12 FT1A-24 FT1A-40 FT1A-40 FT1A-TouchX X X X X

Device Function I Q M R T C D Constant RepeatLabel number Tag for LJMP and LCAL — — — — — — — 0-255 —

When input is on, jump to the address with label 0 through 255 assigned by S1.

When input is off, no jump takes place, and program execution proceeds with the next instruction.

The LJMP instruction is used as an “either/or” choice between two portions of a program. Program execution does not return to the instruction following the LJMP instruction, after the program branch.

LJMP S1*****

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-TouchX X X X X

Device Function I Q M R T C D Constant RepeatS1 (Source 1) Label number — — — — — — X 0-255 —

Page 86: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

14: PROGRAM BRANCHING INSTRUCTIONS

14-2 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Example: LJMP and LABEL

The following example demonstrates a program that jumps to three different portions of the program depending on the input.

Using the Timer Instruction with Program Branching

When the timer start input of the TML, TIM, TMH or TMS instruction is already on, countdown begins immediately at the location jumped to, starting with the timer current value. When using a program branch, it is important to make sure that timers are initialized when desired, after the jump. If it is necessary to initialize the timer instruction (set to the preset value) after the jump, the timer’s start input should be kept off for one or more scan cycles before initialization. Otherwise, the timer input on will not be recognized.

Using the SOTU/SOTD Instructions with Program Branching

Check that pulse inputs of counters and shift registers, and inputs of single outputs (SOTU and SOTD) are maintained during the jump, if required. Hold the input off for one or more scan cycles after the jump for the rising or falling edge transition to be recognized.

LABEL0

I0LJMP S1

0

END

I1LJMP S1

1

I2LJMP S1

2

M8121

END

M8122

END

M8123

END

Q0

Q1

Q2

LABEL1

LABEL2

When input I0 is on, program execution jumps to label 0.

When input I1 is on, program execution jumps to label 1.

When input I2 is on, program execution jumps to label 2.

M8121 is the 1-sec clock special internal relay.

When jump occurs to label 0, output Q0 oscillates in 1-sec increments.

M8122 is the 100-ms clock special internal relay.

When jump occurs to label 1, output Q1 oscillates in 100-ms increments.

M8123 is the 10-ms clock special internal relay.

When jump occurs to label 2, output Q2 oscillates in 10-ms increments.

Although normally, the SOTU instruction produces a pulse for one scan, when used in a program branch the SOTU pulse will last only until the next time the same SOTU instruction is executed.

In the example on the left, the program branch will loop as long as internal relay M0 remains on. However, the SOTU produces a pulse output only during the first loop.

Since the END instruction is not executed as long as M0 remains on, output Q1 is not turned on even if input I1 is on.

I1SOTU

M0LJMP S1

0

Q1

LABEL0

Q1 Internal ONOFF

Q1 OutputON

OFF

Memory

END END

Page 87: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 14-3

14: PROGRAM BRANCHING INSTRUCTIONS

LCAL (Label Call)

Applicable SmartAXIS

Valid Devices

For valid device address ranges, see "Device Addresses" on page 3-1.

Since the LCAL instruction is executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction should be used.

Note: Make sure that a LABEL instruction of the label number used for a LCAL instruction is programmed. When designating S1 using other than a constant, the value for the label is a variable. When using a variable for a label, make sure that all probable LABEL numbers are included in the user program. If a matching label does not exist, a user program execution error will result, turning on special internal relay M8004 and the ERR LED on the SmartAXIS.

LRET (Label Return)

Applicable SmartAXIS

Valid Devices

When input is on, the address with label 0 through 255 assigned by S1 is called. When input is off, no call takes place, and program execution proceeds with the next instruction.

The LCAL instruction calls a subroutine, and returns to the main program after the branch is executed. A LRET instruction (see below) must be placed at the end of a program branch which is called, so that normal program execution resumes by returning to the instruction following the LCAL instruction.

Note: The END instruction must be used to separate the main program from any subroutines called by the LCAL instruction.

A maximum of four LCAL instructions can be nested. When more than four LCAL instructions are nested, a user program execution error will result, turning on special internal relay M8004 and the ERR LED on the SmartAXIS.

LCAL S1*****

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-TouchX X X X X

Device Function I Q M R T C D Constant RepeatS1 (Source 1) Label number to call — — — — — — X 0-255 —

This instruction is placed at the end of a subroutine called by the LCAL instruction. When the subroutine is completed, normal program execution resumes by returning to the instruction following the LCAL instruction.

The LRET must be placed at the end of the subroutine starting with a LABEL instruction. When the LRET is programmed at other places, a user program execution error will result, turning on special internal relay M8004 and the ERR LED on the SmartAXIS.

LRET

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-TouchX X X X X

Device Function I Q M R T C D Constant Repeat— — — — — — — — — — —

Page 88: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

14: PROGRAM BRANCHING INSTRUCTIONS

14-4 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Correct Structure for Calling Subroutine

When a LCAL instruction is executed, the remaining program instructions on the same rung may not be executed upon return, if input conditions are changed by the subroutine. After the LRET instruction of a subroutine, program execution begins with the instruction following the LCAL instruction, depending on current input condition.

When instructions following a LCAL instruction must be executed after the subroutine is called, make sure the subroutine does not change input conditions unfavorably. In addition, include subsequent instructions in a new ladder line, separated from the LCAL instruction.

Example: LCAL and LRET

The following example demonstrates a program that calls three different portions of program depending on the input. When the subroutine is complete, program execution returns to the instruction following the LCAL instruction.

I0

LCAL S10

REPS1 –D0

D1 –D1

MOV(W)

REPS1 –D20

D1 –D21

MOV(W)

Correct

I0

LCAL S10

REPS1 –D0

D1 –D1

MOV(W)

REPS1 –D20

D1 –D21

MOV(W)

Incorrect

Separate the ladder line for each LCAL instruction. I0 status may be changed by the subroutine upon return.

M0S

M0S

I0

I0LCAL S1

0

END

I1LCAL S1

1

I2LCAL S1

2

M8121

LRET

M8122

LRET

M8123

LRET

Q0

Q1

Q2

LABEL0

LABEL1

LABEL2

When input I0 is on, program execution jumps to label 0.

When input I1 is on, program execution jumps to label 1.

When input I2 is on, program execution jumps to label 2.

M8121 is the 1-sec clock special internal relay.

When jump occurs to label 0, output Q0 oscillates in 1-sec increments.

Program execution returns to the address of input I1.

M8122 is the 100-ms clock special internal relay.

When jump occurs to label 1, output Q1 oscillates in 100-ms increments.

Program execution returns to the address of input I2.

M8123 is the 10-ms clock special internal relay.

When jump occurs to label 2, output Q2 oscillates in 10-ms increments.

Program execution returns to the address of END.

Page 89: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 14-5

14: PROGRAM BRANCHING INSTRUCTIONS

DJNZ (Decrement Jump Non-zero)

Applicable SmartAXIS

Valid Devices

For valid device address ranges, see "Device Addresses" on page 3-1.

Since the DJNZ instruction is executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction should be used.

The label number can be 0 through 255. Make sure that a LABEL instruction of the label number used for a DJNZ instruction is programmed. When designating S2 using a data register, the value for the label is a variable. When using a variable for a label, make sure that all probable LABEL numbers are included in the user program. If a matching label does not exist, a user program execution error will result, turning on special internal relay M8004 and the ERR LED on the SmartAXIS.

When input is on, the value stored in the data register assigned by S1 is decremented by one and is checked. If the resultant value is not 0, program execution jumps to address with label 0 through 255 assigned by S2. If the decrement results in 0, no jump takes place, and program execution proceeds with the next instruction.

DJNZ S1*****

S2*****

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-TouchX X X X X

Device Function I Q M R T C D Constant RepeatS1 (Source 1) Decrement value — — — — — — X — —

S2 (Source 2) Label number to jump to — — — — — — X 0-255 —

Page 90: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

14: PROGRAM BRANCHING INSTRUCTIONS

14-6 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Example: DJNZ and LABEL

The following example demonstrates a program to store consecutive values 1000 through 1049 to data registers D100 through D149, respectively.

LABEL255

M8120

END

M8120REPS1 –

D0D1 –D99

IMOV(W) S2 D2D1

REPS1 –1049

D1 –D0

MOV(W)

REPS1 –50

D1 –D1

MOV(W)

S/DD0

DEC(W)

S2255

S1D1

DJNZ

M8120 is the initialize pulse special internal relay.

At start-up, MOV instructions store initial data.

1049 D0 to store the value for the first cycle.

50 D1 to determine the jump cycles.

IMOV moves D0 data 1049 to D1049 in the first cycle.

DEC decrements D0 data to 1048.

DJNZ jumps to label 255 until D1 value reduces to 0.

1049D0Destination: D99 + 50 = D149 1049D14950D11st cycle:

1048D0Destination: D99 + 49 = D148 1048D14849D12nd cycle:

1047D0Destination: D99 + 48 = D147 1047D14748D13rd cycle:

1046D0Destination: D99 + 47 = D146 1046D14647D14th cycle:

1001D0Destination: D99 + 2 = D101 1001D1012D149th cycle:

1000D0Destination: D99 + 1 = D100 1000D1001D150th cycle:

Page 91: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 15-1

15:REFRESH INSTRUCTIONS

IntroductionThis chapter describes the refresh instructions that update the status of input contacts, external output , and the current value of the high-speed counter, to the latest value during a ladder scan.

IOREF (I/O Refresh)

Applicable SmartAXIS

Valid Devices

Only input or output numbers available on the SmartAXIS can be designated as S1. Input and output numbers for remote I/O slaves cannot be designated as S1. For valid device address ranges, see "Device Addresses" on page 3-1.

Input Device Addresses and Allocated Internal RelaysInternal relays are allocated to each input device as shown in the table below. For example, when I10 is designated as S1, the latest value of I10 is set to M310.

During normal execution of a user program, I/O statuses are refreshed simultaneously when the END instruction is executed at the end of a scan. When a real-time response is needed to execute an interrupt, the IOREF instruction can be used. When the input to the IOREF instruction is turned on, the status of the designated input or output is read or written immediately.

When the IOREF instruction is executed for an input, the filter does not take effect and the input status at the moment is read to a corresponding internal relay.

The actual input status of the same input number is read to the internal input memory when the END instruction is executed as in the normal scanning, then the filter value has effect as designated in the Function Area Settings. See Chapter 5 "Special Functions" - "Input Filter"in the SmartAXIS Pro/Lite User's Manual.

When input is on, 1-bit I/O data assigned by source device S1 is refreshed immediately regardless of the scan time.

When I (input) is used as S1, the actual input status is immediately read into an internal relay starting with M300 allocated to each input available on the SmartAXIS.

When Q (output) is used as S1, the output data in the RAM is immediately written to the actual output available on the SmartAXIS.

Refresh instructions are useful when a real-time response is required in a user program which has a long scan time. The refresh instruction is most effective when using the refresh instruction at a ladder step immediately before using the data.

The IOREF instruction can be used with an interrupt input or timer interrupt to refresh data.

IOREF S1*****

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-TouchX X X X X

Device Function I Q M R T C D Constant RepeatS1 (Source 1) I/O for refresh X X — — — — — — —

Input Device Internal Relay Input Device Internal

Relay Input Device Internal Relay Input Device Internal

RelayI0 M300 I10 M310 I20 M320 I30 M330

I1 M301 I11 M311 I21 M321 I31 M331

I2 M302 I12 M312 I22 M322 I32 M332

I3 M303 I13 M313 I23 M323 I33 M333

I4 M304 I14 M314 I24 M324 I34 M334

I5 M305 I15 M315 I25 M325 I35 M335

I6 M306 I16 M316 I26 M326

I7 M307 I17 M317 I27 M327

Page 92: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

15: REFRESH INSTRUCTIONS

15-2 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Example: IOREF

The following example demonstrates a program that transfers the input I0 status to output Q0 using the IOREF instruction. Input I2 is designated as an interrupt input. For the interrupt input function, see Chapter 5 "Special Functions" - "Interrupt Input"in the SmartAXIS Pro/Lite User's Manual.

M8120

END

Main Program

M8125

Q0

REPS1 –0

D1 –D8033

MOV(W)

IOREF S1I0

M300

M8125IOREF S1

Q0

LRET

LABEL0

M8120 is the initialize pulse special internal relay.

D8033 stores 0 to designate jump destination label 0 for interrupt input I2.

When input I2 is on, program execution jumps to label 0.

M8125 is the in-operation output special internal relay.

IOREF immediately reads input I0 status to internal relay M300.

M300 turns on or off the output Q0 internal memory.

Another IOREF immediately writes the output Q0 internal memory status to actual output Q0.

Program execution returns to the main program.

Page 93: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 15-3

15: REFRESH INSTRUCTIONS

HSCRF (High-speed Counter Refresh)

Applicable SmartAXIS

Example: HSCRF

The following example demonstrates a program that updates the current value of high-speed counter HSC1 using the HSCRF instruction. For the timer interrupt, see Chapter 5 "Special Functions" - "Timer Interrupt" in the SmartAXIS Pro/Lite User's Manual.

When input is on, the HSCRF instruction refreshes the high-speed counter current values in special data registers in real time.

The current values of six high-speed counters HSC1 through HSC6 are usually updated in every scan. The HSCRF can be used in any place in the ladder diagram where you want to read the updated high-speed counter current value.

For the high-speed counter function, see Chapter 5 "Special Functions" - "High-Speed Counter" in the SmartAXIS Pro/Lite User's Manual.

HSCRF*

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-TouchX X X X X

M8120

END

Main Program

M8125

REPS1 –0

D1 –D8036

MOV(W)

M8125

M8125IOREF S1

Q1

LRET

LABEL0

HSCRF1

REPS1 –D8210

D1 –Q1

CMP>(D) S2 –150000

M8120 is the initialize pulse special internal relay.

D8036 stores 0 to designate jump destination label 0 for timer interrupt.

The interrupt program is separated from the main program by the END instruction.

While the CPU is running, program execution jumps to label 0 repeatedly at intervals selected in the Function Area Settings.

M8125 is the in-operation output special internal relay.

HSCRF updates the HSC1 current value in data registers D8050 and D8051.

When D8050/D8051 exceeds 150000, Q1 is turned on.

IOREF immediately writes the output Q1 internal memory status to actual output Q1.

Each time the interrupt program is completed, program execution returns to the main program at the address where timer interrupt occurred.

Page 94: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

15: REFRESH INSTRUCTIONS

15-4 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Page 95: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 16-1

16:INTERRUPT CONTROL INSTRUCTIONS

IntroductionThe DI or EI instruction disables or enables interrupt inputs and timer interrupt individually.

DI (Disable Interrupt)

EI (Enable Interrupt)

Applicable SmartAXIS

Valid Devices

Interrupt inputs I0 through I7 and timer interrupt selected in the Function Area Settings are normally enabled when the CPU starts. When the DI instruction is executed, interrupt inputs and timer interrupt designated as source device S1 are disabled even if the interrupt condition is met in the user program area subsequent to the DI instruction. When the EI instruction is executed, disabled interrupt inputs and timer interrupt designated as source device S1 are enabled again in the user program area subsequent to the EI instruction. Different interrupts can be selected for the DI and EI instructions to disable and enable interrupt inputs selectively. For Interrupt Input and Timer Interrupt, see Chapter 5 "Special Functions" - "Interrupt Input" and "Timer Interrupt" in the SmartAXIS Pro/Lite User's Manual.

Make sure that interrupt inputs and timer interrupt designated as source device S1 are selected in the Function Area Settings. Otherwise, when the DI or EI instruction is executed, a user program execution error will result, turning on special internal relay M8004 and the ERR LED on the SmartAXIS.

The DI and EI instructions cannot be used in an interrupt program. If used, a user program execution error will result, turning on special internal relay M8004 and the ERR LED on the SmartAXIS. For details about the user program execution errors, see "User Program Execution Errors" on page 4-13.

Special Internal Relays M8070-M8075 and M8144: Interrupt Status

Special internal relays M8070 through M8075 and M8144 are provided to indicate whether interrupt inputs and timer interrupt are enabled or disabled.

When input is on, interrupt inputs and timer interrupt assigned by source device S1 are disabled.DI S1

**

When input is on, interrupt inputs and timer interrupt assigned by source device S1 are enabled.EI S1

**

FT1A-12 FT1A-24 FT1A-40 FT1A-48 FT1A-TouchX X X X X

Device Function I Q M R T C D Constant RepeatS1 (Source 1) Interrupt inputs and timer interrupt — — — — — — — 1-127 —

Interrupt (Lite·Pro/Touch) Interrupt Enabled Interrupt DisabledGroup 1 (I0/-) M8070 ON M8070 OFF

Group 2 (I2/I2) M8071 ON M8071 OFF

Group 3 (I3/I3) M8072 ON M8072 OFF

Group 4 (I5/I4) M8073 ON M8073 OFF

Group 5 (I6/I5) M8074 ON M8074 OFF

Group 6 (I7/-) M8075 ON M8075 OFF

Timer Interrupt M8144 ON M8144 OFF

Page 96: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

16: INTERRUPT CONTROL INSTRUCTIONS

16-2 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382

Programming WindLDR

In the Disable Interrupt (DI) or Enable Interrupt (EI) dialog box, select the check box on the left of Interrupt Groups 1 through 6 or Timer Interrupt to select source device S1. The example below selects interrupt groups 2, 3, and timer interrupt for the DI instruction, and a 22 will be shown as source device S1.

The total of selected interrupt inputs and timer interrupt is shown as source device S1.

Interrupt (Lite·Pro/Touch) S1 ValueGroup 1 (I0/-) 0

Group 2 (I2/I2) 2

Group 3 (I3/I3) 4

Group 4 (I5/I4) 8

Group 5 (I6/I5) 32

Group 6 (I7/-) 64

Timer Interrupt 16

DI S122

Page 97: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382 16-3

16: INTERRUPT CONTROL INSTRUCTIONS

Example: DI and EI

The following example demonstrates a program that will disable and enable interrupt inputs and timer interrupt selectively. For the interrupt input and timer interrupt functions, see Chapter 5 "Special Functions" - "Interrupt Input" and "Timer Interrupt" in the SmartAXIS Pro/Lite User's Manual. In this example, inputs I2 and I3 are designated as interrupt inputs and timer interrupt is used with interrupt intervals of 100 ms.

M8120

END

I10

REPS1 –0

D1 –D8033

MOV(W)

DI S122

LABEL0

REPS1 –1

D1 –D8034

MOV(W)

REPS1 –2

D1 –D8036

MOV(W)

I10EI S1

6

EI S116

I11

I12 I10

M8125ALT D1

Q2

M8125IOREF S1

Q2

LRET

LABEL1

M8125ALT D1

Q3

M8125IOREF S1

Q3

LRET

LABEL2

M8125ALT D1

Q4

M8125IOREF S1

Q4

LRET

M8120 is the initialize pulse special internal relay.

D8033 stores jump destination label number 0 for interrupt input I2.

D8034 stores jump destination label number 1 for interrupt input I3.

D8036 stores jump destination label number 2 for timer interrupt.

When input I10 is on, DI disables interrupt inputs I2, I3, and timer interrupt, then M8071, M8072, and M8144 turn off.

When input I11 is on and I10 is off, EI enables interrupt inputs I2 and I3, then M8071 and M8072 turn on.

When input I12 is on and I10 is off, EI enables timer interrupt, then M8144 turns on.

End of the main program.

When input I2 is on, program execution jumps to label 0.

M8125 is the in-operation output special internal relay.

ALT turns on or off the output Q2 internal memory.

IOREF immediately writes the output Q2 internal memory status to actual output Q2.

Program execution returns to the main program.

When input I3 is on, program execution jumps to label 1.

M8125 is the in-operation output special internal relay.

ALT turns on or off the output Q3 internal memory.

IOREF immediately writes the output Q3 internal memory status to actual output Q3.

Program execution returns to the main program.

Timer interrupt occurs every 100 ms, then program execution jumps to label 2.

M8125 is the in-operation output special internal relay.

ALT turns on or off the output Q4 internal memory.

IOREF immediately writes the output Q4 internal memory status to actual output Q4.

Program execution returns to the main program.

Page 98: 9: BOOLEAN COMPUTATION INSTRUCTIONS...11 1 S1 + S2 D1 When input is on, 16- or 32-bit data assigned by source devices S1 and S2 are ORed, bit by bit. The result is set to destination

16: INTERRUPT CONTROL INSTRUCTIONS

16-4 SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382