You are on page 1of 7

Chapter - Instruction List (IL) Programming

I:000/00 I:000/01
O:001/00
I:000/02 I:000/03

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


Label Opcode Operand Comment

START: LD %I:000/00 (* Load input bit 00 *)


AND( %I:000/01 (* Start a branch and load input bit 01 *)
OR( %I:000/02 (* Load input bit 02 *)
ANDN %I:000/03 (* Load input bit 03 and invert *)
)
)
ST %O:001/00 (* SET the output bit 00 *)
LD I:000/0 AND( I:000/1 OR( I:000/2 ANDN I:000/3 ) )

I:000/0 I:000/1 I:000/2 result_1 result_2 result_3


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

Given:
I:000/0 = 1 1 0 1 1 1 1 1
I:000/1 = 0 ( ( ( ( AND 1
I:000/2 = 1 AND 1 OR 0 OR 0 AND 1
I:000/3 = 0 ( (
AND 1 AND 1

Given:
I:000/0 = 0 0 1 0 0 0 0 0
I:000/1 = 1 ( ( ( ( AND 1
I:000/2 = 0 AND 0 OR 1 OR 1 AND 1
I:000/3 = 1 ( (
AND 0 AND 0
Operator Modifiers Data Types Description

LD N many set current result to value


ST N many store current result to location
S, R BOOL set or reset a value (latches or flip-flops)
AND, & N, ( BOOL boolean and
OR N, ( BOOL boolean or
XOR N, ( BOOL boolean exclusive or
ADD ( many mathematical add
SUB ( many mathematical subtraction
MUL ( many mathematical multiplication
DIV ( many mathematical division
GT ( many comparison greater than >
GE ( many comparison greater than or equal >=
EQ ( many comparison equals =
NE ( many comparison not equal <>
LE ( many comparison less than or equals <=
LT ( many comparison less than <
JMP C, N LABEL jump to LABEL
CAL C, N NAME call subroutine NAME
RET C, N return from subroutine call
) get value from stack
Ladder Instruction List (IL)
A X LD A
ST X

A X LDN A
ST X

A B X LD A LD A
LD B AND B
ANB ST X
ST X
A B X LD A LD A
LDN B ANDN B
ANB ST X
ST X
A C X LD A LD A
LD B OR B
ORB AND C
B
LD C ST X
ANB
ST X
Ladder Instruction List (IL)

A X LD A
ST X
Y ST Y

A X LD A LD A
ST X ST X
B LD B AND B
Y
ANB ST Y
ST Y
A B X LD A LD A
MPS MPS
C LD B AND B
Y
ANB ST X
ST X MPP
MPP AND C
LD C ST Y
ANB
ST Y
I:001/0
TON
Timer T4:0
Delay 5s

ADD
SourceA 3
SourceB T4:0.ACC
Dest N7:0
START:LD I:001/0
TON(T4:0, 1.0, 5, 0)
LD 1
ADD (3, T4:0.ACC, N7:0)
END
Program File 2:

Label Opcode Operand Comment

START: CAL 3 (* Jump to program file 3 *)

Program File 3:

Label Opcode Operand Comment

TEST: LD %I:000 (* Load the word from input card 000 *)


BCD_TO_INT (* Convert the BCD value to an integer *)
ST %N7:0 (* Store the value in N7:0 *)
GT 100 (* Check for the stored value (N7:0) > 100 *)
JMPC ON (* If true jump to ON *)
CAL RES(C5:0) (* Reset the timer *)
ON: LD 2 (* Load a value of 2 - for the preset *)
ST %C5:0.PR (* Store 2 in the preset value *)
CAL TON(C5:0) (* Update the timer *)
LD %C5:0.DN (* Get the timer done condition bit *)
ST %O:001/00 (* Set the output bit *)
RET (* Return from the subroutine *)

You might also like