Resources for PLC Training

FUNCTION REFERENCE

The function references that follow are meant to be an aid for programming. There are some notes that should be observed, especially because this list discusses instructions for more than one type of PLC.

· The following function descriptions are for both the Micrologix and PLC-5 processor families. There are some differences between PLC models and families.

- Floating point operations are not available on the micrologix.

- Some instruction names, definition and terminologies have been changed from older to newer models. I attempt to point these out, or provide a general description that is true for all.

- Details for specific instructions can be found in the manuals available at (http://www.ab.com)

· Many flags in status memory can be used with functions, including;

S2:0/0 carry in math operation

S2:0/1 overflow in math operation

S2:0/2 zero in math operation

S2:0/3 sign in math operation

FUNCTION DESCRIPTIONS

General Functions

 

 

 

 

Program Control

 

 

 

 

 

Timers and Counters

Counter memory instructions can share the same memory location, so some redundant bits are mentioned here.

 

 

 

 

 

Compare

 

 

 

 

 

 

Calculation and Conversion

 

 

 

 

 

 

 

Logical

 

 

Move

 

 

 

File

Most file instructions will contain Mode options. The user may choose these with the implications listed below.

All - All of the operations will be completed in a single scan when the input to the function is edge triggered. Care must be used not to create an operation so long it causes a watchdog fault in the PLC

Incremental - Each time there is a positive input edge the function will advance the file operation by one.

'number' - when a number is supplied the function will perform that many iterations while the input rung is true.

 

 

 

 

List

 

 

 

 

 

Program Control

 

 

 

 

 

Advanced Input/Output

 

 

 

String

 

 

 

 

 

 

 

 

 

DATA TYPES

The following table describes the arguments and return values for functions. Some notes are;

· 'immediate' values are numerical, not memory addresses.

· 'returns' indicates that the function returns that data value.

· numbers between '[' and ']' indicate a range of values.

· values such as 'yes' and 'no' are typed in literally.

 

Instruction Data Types

Function

Argument

Data Types

Edge Triggered

ABL

channel

control

characters

immediate int [0-4]

R

returns N

yes

ACB

channel

control

characters

immediate int [0-4]

R

returns N

yes

ACI

source

destination

ST

N

no

ACN

source A

source B

ST

ST

no

ACS

source

destination

N,F,immediate

N,F

no

ADD

source A

source B

destination

N,F,immediate

N,F,immediate

N,F

no

AEX

source

index

number

destination

ST

immediate int [0-82]

immediate int [0-82]

ST

no

AFI

 

 

no

AHL

channel

AND mask

OR mask

control

immediate int [0-4]

immediate hex [0000-ffff]

immediate hex [0000-ffff]

R

yes

AIC

source

destination

N, immediate int

ST

no

ARD

channel

destination

control

string length

characters read

immediate int [0-4]

ST

R

immediate int [0-83]

returns N

yes

ARL

channel

destination

control

string length

characters read

immediate int [0-4]

ST

R

immediate int [0-83]

returns N

yes

ASC

source

index

search

result

ST

N, immediate

ST

R

no

ASN

source

destination

N,F,immediate

N,F

no

ASR

source A

source B

ST

ST

no

ATN

source

destination

N,F,immediate

N,F

no

AVE

file

destination

control

length

position

#F,#N

F,N

R

N,immediate int

returns N

yes

AWA

channel

source

control

string length

characters sent

immediate int [0-4]

ST

R

immediate int [0-82]

returns N

yes

AWT

channel

source

control

length

characters sent

N, immediate int

ST

R

immediate int [0-82]

returns N

yes

BSL

file

control

bit address

length

#B,#N

R

any bit

immediate int [0-16000]

yes

BSR

file

control

bit address

length

#B,#N

R

any bit

immediate int [0-16000]

yes

BTD

source

source bit

destination

destination bit

length

N,B,immediate

N,immediate int [0-15]

N

immediate int [0-15]

immediate int [0-15]

no

BTR

rack

group

module

control block

data file

length

continuous

immediate octal [000-277]

immediate octal [0-7]

immediate octal [0-1]

BT,N

N

immediate int [0-64]

'yes','no'

yes

BTW

rack

group

module

control block

data file

length

continuous

immediate octal [000-277]

immediate octal [0-7]

immediate octal [0-1]

BT,N

N

immediate int [0-64]

'yes','no'

yes

CLR

destination

N,F

no

CMP

expression

expression

no

COP

source

destination

length

#any

#any

immediate int [0-1000]

no

COS

source

destination

F,immediate

F

no

CPT

destination

expression

N,F

expression

no

CTD

counter

preset

accumulated

C

returns N

returns N

yes

CTU

counter

preset

accumulated

C

returns N

returns N

yes

DDT

source

reference

result

compare control

length

position

result control

length

position

binary