Chapter - Instruction List (IL) Programming

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
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
AND(
OR(
ANDN
)
)
ST

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

(* Load input bit 00 *)


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

%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/2
(
OR I:000/1
(
AND I:000/0

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

result_3

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

result_2
(
AND I:000/0

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

0
(
AND 1

1
(
OR 0
(
AND 1

1
(
OR 0
(
AND 1

1
(
AND 1

1
AND 1

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

1
(
AND 0

0
(
OR 1
(
AND 0

0
(
OR 1
(
AND 0

0
(
AND 1

0
AND 1

Operator

Modifiers

Data Types

Description

LD
ST
S, R
AND, &
OR
XOR
ADD
SUB
MUL
DIV
GT
GE
EQ
NE
LE
LT
JMP
CAL
RET
)

N
N

many
many
BOOL
BOOL
BOOL
BOOL
many
many
many
many
many
many
many
many
many
many
LABEL
NAME

set current result to value


store current result to location
set or reset a value (latches or flip-flops)
boolean and
boolean or
boolean exclusive or
mathematical add
mathematical subtraction
mathematical multiplication
mathematical division
comparison greater than >
comparison greater than or equal >=
comparison equals =
comparison not equal <>
comparison less than or equals <=
comparison less than <
jump to LABEL
call subroutine NAME
return from subroutine call
get value from stack

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

Ladder

Instruction List (IL)

LD A
ST X

LDN A
ST X

LD A
LD B
ANB
ST X

LD A
AND B
ST X

LD A
LDN B
ANB
ST X

LD A
ANDN B
ST X

LD A
LD B
ORB
LD C
ANB
ST X

LD A
OR B
AND C
ST X

A
B

Ladder

Instruction List (IL)

X
Y

X
B

LD A
ST X
ST Y
LD A
ST X
LD B
ANB
ST Y

LD A
ST X
AND B
ST Y

LD A
MPS
LD B
ANB
ST X
MPP
LD C
ANB
ST Y

LD A
MPS
AND B
ST X
MPP
AND C
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

(* Jump to program file 3 *)

Program File 3:
Label

Opcode

Operand

Comment

TEST:

LD
BCD_TO_INT
ST
GT
JMPC
CAL
LD
ST
CAL
LD
ST
RET

%I:000

(* 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 *)

ON:

%N7:0
100
ON
RES(C5:0)
2
%C5:0.PR
TON(C5:0)
%C5:0.DN
%O:001/00

You might also like