Webcontrol Tm Plc Programming; The Basics Of Plc Programming - CAI Networks WebControl PLC User Manual

Programmable logic controller
Table of Contents

Advertisement

TM
WebControl
PLC User Guide Version 3.02.17f
TM
6 WebControl
PLC Programming
TM
The WebControl
PLC firmware can be programmed to execute programmable logic
sequences, including comparison and sub routines. This is the major change from
TM
the BRE(Boolean Run Engine) version firmware. WebControl
PLC uses assembly
like PLC language. Its main program starts with "START" and finishes with "END".
The PLC program is pasted into the web GUI. WebControl will automatically store it
into its EEPROM so that if recycle power will not lose the program. The limitation of
the PLC is 1000 line of code. The support for PLC programming is not included in the
TM
free support for configuration of WebControl
PLC.

6.1 The Basics of PLC Programming

WebControl PLC program is NOT hard! We have included many examples toward
the end of this chapter. A PLC program is made up of main routine and optional
subroutines.
The main routine is enclosed between mandatory START and END instructions e.g.
START
#main instructions go here
END
To change the logic flow, GOTO instruction can be used as unconditional jump from
one section of logic to another without call stack to return. CALLSUB instruction is
for unconditional logic flow that may return to the original call stack. BNZ and BZ are
conditional GOTO to branch to different section in logic. CNZ and CZ are conditional
CALLSUB instruction allowing returning to call stack address.
Both GOTO and CALLSUB use label to identify where to execute next instruction.
Label can be any string less than 10 characters. Label cannot be identical to any
instruction keyword. If sub routines are used then they are coded after the END of
the main routine body. Sub routines start at their label and must end with the
instruction RET e.g.
TEST_IO_SUB:
#instructions here
RET
Subroutines can be called from the main program and from within other subroutines.
Note that WebControl PLC has a return program address stack depth of 8 (or call
stack 8).
The program control block has a zero bit that is updated implicitly on TEST
instructions. This zero bit is set by any one of these TEST instructions: TSTEQ,
TSTNE, TSTGT, TSTLT, TSTGE, TSTLE, ANDT, ORT, XORT, ANDBT, ORBT,
XORBT, TSTB. Zero bit flag can be accessed by IO name ZBIT. This zero bit can
also be used implicitly when using branch and call instructions, like BZ, BNZ, CZ,
CNZ. E.g. the following test instruction yields a Boolean result which will implicitly set
Copyright(c) 2008,-2013 CAI Networks, Inc.
22

Advertisement

Table of Contents
loading

Table of Contents