plc

7
er - Instruction List (IL) Programming Label START: Opcode LD AND( OR( ANDN ) ) ST Operand %I:000/00 %I:000/01 %I:000/02 %I:000/03 % O:001/00 Com m ent (* Load input bit00 *) (* Start a branch and load input bit01 *) (* Load input bit02 *) (* Load input bit03 and invert *) (* SET the output bit 00 *) read asO :001/00 = I:000/00 A ND (I:000/01 OR (I:000/02 A ND N OT I:000/03)) I:000/00 I:000/01 I:000/02 I:000/03 O:001/00

Upload: moddy-cavallindo

Post on 31-Jan-2016

213 views

Category:

Documents


0 download

DESCRIPTION

INSTRUCTION LIST

TRANSCRIPT

Page 1: PLC

Chapter - Instruction List (IL) Programming

Label

START:

Opcode

LDAND(OR(ANDN))ST

Operand

%I:000/00%I:000/01%I:000/02%I:000/03

%O:001/00

Comment

(* Load input bit 00 *)(* Start a branch and load input bit 01 *)(* Load input bit 02 *)(* Load input bit 03 and invert *)

(* SET the output bit 00 *)

read as O:001/00 = I:000/00 AND ( I:000/01 OR ( I:000/02 AND NOT I:000/03) )

I:000/00 I:000/01

I:000/02 I:000/03

O:001/00

Page 2: PLC

I:000/0

LD I:000/0

I:000/1(AND I:000/0

AND( I:000/1

I:000/2(OR I:000/1(AND I:000/0

OR( I:000/2

result_1(OR I:000/1(AND I:000/0

ANDN I:000/3

result_2(AND I:000/0

)

result_3

)

I:000/0 = 1I:000/1 = 0I:000/2 = 1I:000/3 = 0

1

Given:

0(AND 1

1(OR 0(AND 1

1(OR 0(AND 1

1(AND 1

1AND 1

1

I:000/0 = 0I:000/1 = 1I:000/2 = 0I:000/3 = 1

0

Given:

1(AND 0

0(OR 1(AND 0

0(OR 1(AND 0

0(AND 1

0AND 1

0

Page 3: PLC

Operator

LDSTS, RAND, &ORXORADDSUBMULDIVGTGEEQNELELTJMPCALRET)

Modifiers

NN

N, (N, (N, (((((((((((C, NC, NC, N

Description

set current result to valuestore current result to locationset or reset a value (latches or flip-flops)boolean andboolean orboolean exclusive ormathematical addmathematical subtractionmathematical multiplicationmathematical divisioncomparison greater than >comparison greater than or equal >=comparison equals =comparison not equal <>comparison less than or equals <=comparison less than <jump to LABELcall subroutine NAMEreturn from subroutine callget value from stack

Data Types

manymanyBOOLBOOLBOOLBOOLmanymanymanymanymanymanymanymanymanymanyLABELNAME

Page 4: PLC

A X

Ladder Instruction List (IL)

LD AST X

A X LDN AST X

A X LD ALD BANBST X

B LD AAND BST X

A X LD ALDN BANBST X

B LD AANDN BST X

A X LD ALD BORBLD CANBST X

B

LD AOR BAND CST X

C

Page 5: PLC

A X

Ladder Instruction List (IL)

LD AST XST YY

A X LD AST XLD BANBST Y

YB

LD AST XAND BST Y

A X LD AMPSLD BANBST XMPPLD CANBST Y

YC

LD AMPSAND BST XMPPAND CST Y

B

Page 6: PLC

TONTimer T4:0Delay 5s

I:001/0

ADDSourceA 3SourceB T4:0.ACCDest N7:0

START:LD I:001/0TON(T4:0, 1.0, 5, 0)LD 1ADD (3, T4:0.ACC, N7:0)END

Page 7: PLC

Label

TEST:

ON:

Opcode

LDBCD_TO_INTSTGTJMPCCALLDSTCALLDSTRET

Operand

%I:000

%N7:0100ONRES(C5:0)2%C5:0.PRTON(C5:0)%C5:0.DN%O:001/00

Comment

(* Load the word from input card 000 *)(* Convert the BCD value to an integer *)(* Store the value in N7:0 *)(* Check for the stored value (N7:0) > 100 *)(* If true jump to ON *)(* Reset the timer *)(* Load a value of 2 - for the preset *)(* Store 2 in the preset value *)(* Update the timer *)(* Get the timer done condition bit *)(* Set the output bit *)(* Return from the subroutine *)

Program File 3:

Label

START:

Opcode

CAL

Operand

3

Comment

(* Jump to program file 3 *)

Program File 2: