0% found this document useful (0 votes)
78 views79 pages

Visilogic Software Manual-Ladder Parte1

Uploaded by

Marcilio
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views79 pages

Visilogic Software Manual-Ladder Parte1

Uploaded by

Marcilio
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 79

Software Manual

Ladder
V230-21-G23 Rev: 12/04
No part of this document may be used for any purpose other than
for the purposes specifically indicated herein nor may it be
reproduced or transmitted in any form or by any means,
electronic or mechanical, including photocopying and/or
recording, for any purpose without written permission from
Unitronics.
The information appearing in this document is for general
purposes only. Unitronics makes no warranty of any kind with
regard to the information appearing in this document, including,
but not limited to, implied warranties of merchantability and/or
fitness for a particular use or purpose. Unitronics assumes no
responsibility for the results, direct and/or indirect, of any misuse
of the information appearing in this document nor for any use of
the Unitronics products referred to herein in any manner
deviating from the recommendations made in this document.
Unitronics assumes no responsibility for the use of any parts,
components, or other ancillary appliances including circuitry other
than as recommended hereunder or other than that embodied in
the Unitronics product.
Unitronics retains all rights to its proprietary assets including, but
not limited to its software products which are copyrighted and
shall remain the property of Unitronics. Copyright protection
claimed includes all Forms and matters of copyrightable materials
and information legally allowed including but not limited to
material generated from the software programs which are
displayed on the screen of the Unitronics products such as styles,
templates, icons, screen displays, looks, etc. Duplication and/or
any unauthorized use thereof are strictly prohibited without prior
written permission from Unitronics.
All brand or product names are used for identification purpose
only and may be trademarks or registered trademarks of their
respective holders.
Unitronics reserves the right to revise this publication from time to
time and to amend its contents and related hardware and
software at any time. Technical updates (if any) may be included
in subsequent editions (if any).
VisiLogic Software Manual - Ladder
Table Of Contents
Ladder......................................................................................................................................................................... 1
Ladder Editor.......................................................................................................................................................... 1
Calls: Program Control........................................................................................................................................... 1
Calls, Jumps, and Labels................................................................................................................................... 1
Program Sequencing: Modules, Subroutines, Labels & Jumps ........................................................................ 2
Labels & Jumps ................................................................................................................................................ 5
Call Subroutine ................................................................................................................................................. 8
Subroutine: Return ............................................................................................................................................ 8
Open a Subroutine .......................................................................................................................................... 10
Ladder Nets with Feedbacks ........................................................................................................................... 11
Elements ............................................................................................................................................................... 12
Ladder Elements and Functions List............................................................................................................... 12
Placing a Ladder Element in a Net.................................................................................................................. 15
Delete Elements .............................................................................................................................................. 16
Change Element Type..................................................................................................................................... 17
Contacts .......................................................................................................................................................... 17
Direct Contacts ............................................................................................................................................... 17
Inverted Contacts ............................................................................................................................................ 18
Negative Transition Contact ........................................................................................................................... 18
Positive Transition Contact............................................................................................................................. 19
Coils................................................................................................................................................................ 20
Direct Coil ...................................................................................................................................................... 20
Inverted Coil ................................................................................................................................................... 20
Reset Coil........................................................................................................................................................ 21
Set Coil ........................................................................................................................................................... 21
Toggle Coil ..................................................................................................................................................... 21
Immediate Elements........................................................................................................................................ 21
Immediate: Read Physical Input ..................................................................................................................... 22
Immediate: Update High-speed Input ............................................................................................................. 22
Immediate: Write to Output ............................................................................................................................ 24
Immediate: Write to Physical Analog Output ................................................................................................. 24
Operands............................................................................................................................................................... 25
Operands ......................................................................................................................................................... 25
Linking Operands to Elements........................................................................................................................ 26
Operand Addressing........................................................................................................................................ 27
Power-up Values............................................................................................................................................. 27
Constant Values # ......................................................................................................................................... 27
Operand Types................................................................................................................................................ 28
Functions .............................................................................................................................................................. 49
Placing a Function in a Net ............................................................................................................................. 49
FBs Library ..................................................................................................................................................... 50
Compare Functions ......................................................................................................................................... 52
Logic Functions .............................................................................................................................................. 56
Math Functions ............................................................................................................................................... 68
Store & Load Functions .................................................................................................................................. 80
Clock Functions .............................................................................................................................................. 85
Vector Functions........................................................................................................................................... 104

iii
VisiLogic Software Manual - Ladder

Strings ........................................................................................................................................................... 119


Com............................................................................................................................................................... 124
HMI Ladder Functions.................................................................................................................................. 138
Floating Math Functions ............................................................................................................................... 142
Interrupt Routines ......................................................................................................................................... 146
Index....................................................................................................................................................................... 149

iv
Ladder
Ladder Editor
Use the Ladder Editor to create the Ladder diagram that comprises your control application. Ladder diagrams
are composed of contacts, coils, and function block elements arranged in nets.

In a Ladder diagram, the contacts represent input conditions. They lead power from the left Ladder rail to the
right rail. This is why the first element in a net must always touch the left rail. Coils represent output
instructions. In order for output coils to be activated, the logical state of the contacts must allow the power to
flow through the net to the coil. This is why the elements in a net must be connected. Each net must contain
only one rung.

Use the Ladder Editor to:

Place and connect Ladder Elements.


Apply Compare, Math, Logic, Clock, Store, and Vector functions.
Insert Function Blocks (FBs) into your program.
Build program Modules and Subroutines, and use internal Subroutine Jumps and Labels.
Place Comments on Ladder nets.
Ladder elements and functions may be dragged and dropped between nets. Hotkeys are also available for easy
programming.
To start the Ladder Editor
Click the Ladder button on the toolbar.

Calls: Program Control


Calls, Jumps, and Labels
The Call menu's functions enable you to set the sequence in which your program runs.

1
VisiLogic Software Manual - Ladder

Program Sequencing: Modules, Subroutines, Labels & Jumps


A module is a container of subroutines. Use modules and subroutines to divide your application into program
blocks. You can then run these program blocks conditionally, from any point in your control application.

Note • Within the program tree, elements are presented alphabetically. This does not affect the order in
which the program runs.
• Ladder Modules and subroutines can be moved via drag-and-drop, as can HMI Modules and
Displays. Again, moving elements does not affect the order in which they run.
The Main Ladder Module, Main Subroutine, Start-up HMI Module and the Start-up HMI Display
cannot be moved via drag-and-drop or erased. For easy identification, they are always marked in
orange.
To control the Ladder program flow sequence and avoid loops, use the Call Subroutine function to conditionally
call subroutines. Within a subroutine, you control the sequence by conditionally skipping over nets using Labels
and Jump to Label functions. This enables you to shorten the program scan time.

A new VisiLogic project contains the main module and subroutine for the program. Each new subroutine
contains a default number of nets and a Subroutine Return function.

Subroutines do not run if they are not called by Call Subroutine. If no Call Subroutine commands are included in
the first subroutine of the main module, the program runs until it reaches the Subroutine Return function, and
then jumps back to the beginning of the first subroutine.

Note • If a subroutine does not run, the coils in that subroutine will not be updated. For example,
Subroutine 4 contains . If MB0 is turned ON in Subroutine 1, but Subroutine 4 is not
called, O0 is not updated. The order in which I/Os are updated depend on the PLC program scan.

2
Ladder

• Some FBs require Configuration, such as SMS. The FB Configuration should be placed in the first
subroutine of the main program module. If a Configuration is in a subroutine that is not called into
the program, linked FBs will not be processed even if the activating condition for that FB has been
turned ON.

Subroutines can be reused as many times as required. Subroutines can also be exported and imported between
projects.

PLC Program Scan


A scan is a complete execution of the controller's entire program. The scan cycle is performed continuously.

Note • Power-up tasks, relating to the status of SB2 Power-up bit, are performed when the controller is
turned on. These tasks are performed before the program scan.
• The scan time is stored in SI 0 Scan Time, Resolution: Units of 10 mSec.

3
VisiLogic Software Manual - Ladder

Call Subroutine & Subroutine: Return

4
Ladder

Within Subroutines: Labels & Jumps

Labels & Jumps


Labels enable you to jump over Ladder nets within a subroutine.

Using Labels

1. Place a Label in a net.

5
VisiLogic Software Manual - Ladder

2. Create the condition that will cause the jump condition.


3. Place a Jump after the condition

6
Ladder

7
VisiLogic Software Manual - Ladder

Renaming Labels

1. To rename a Label, double click it, enter the new name and click Apply.

You can also use labels as bookmarks, by using them to mark program sections and then locating them using the
Go To Label <Alt> + <Right/Left arrow> and List of Labels <Ctrl> + <L> utility.

Call Subroutine
This function causes a subroutine to run in response to a Ladder Condition.

Using Call Subroutine

Subroutine: Return
A subroutine runs until it reaches a Subroutine Return function, and then jumps back to the beginning of the
previous subroutine.

8
Ladder

Using Subroutine Return

9
VisiLogic Software Manual - Ladder

Open a Subroutine
To open a Subroutine for editing:

Double-click in the Project Explorer tree, -or-


Right-click the Subroutine in the Project Explorer tree, then select Open, -or-
Right-click a Call Subroutine element to access the targeted subroutine.

10
Ladder

Name-Rename Modules and Subroutines

Ladder Nets with Feedbacks


According to IEC 1131 - 3, it is possible to create Ladder Diagram nets that contain feedback loops, i.e. where
an element is used as both contact(s) and coil(s) in the same net.

In Ladder Diagram, all external input values such as those associated with contacts are gathered before each net
is evaluated.

In the above example:

Where the net uses the state of its own output, the value of FAN (MB 7) coil associated with an inverted contact
of MB 7 is always the value resulting from the previous evaluation.

However, if the value of FAN (MB 7) is used in any following nets, the latest evaluated state is used.

11
VisiLogic Software Manual - Ladder

Elements
Ladder Elements and Functions List
Contacts

Direct Contact (NO)

Inverted Contact (NC)

Positive Transition (Rise)

Negative Transition (Fall)

Immediate: Read Physical Input

Immediate: Update High-speed Input

Coils

Direct Coil

Inverted (negated) Coil

Set Coil

Reset Coil

Toggle Coil

Immediate: Write to Output

Compare

Greater Than

Greater/Equal

Equal

Not Equal

Less/Equal

Less Than

Math

Add

Subtract

12
Ladder

Multiply

Divide

Linearization, single value

Linearization, vector

Factor

Power

Square Root

Increment/Decrement

Floats

Basic: Store Direct, Add, Sub, Mul, Div, Abs

Extended: Square Root, Power, Exp, LN, Log10, A Mul (10^B)

Trig: Sin, Cos, Tan, ArcSin, ArcCos, ArcTan, Degrees, Radians

Compare: Greater Than, Greater Equal, Equal, Not Equal, Less Equal, Less Than

Convert: A+B/n, INV (A+B/n)

Logic

AND

OR

XOR

Shift Left/Right

Rotate Left/Right

Bit Set/Reset

Bit Test

Store Bit Status

Load Bit Status

RS-SR Flip-Flop

Clock

Time

Day Of Week

13
VisiLogic Software Manual - Ladder

Day Of Month

Month

Year

UTC (Universal Time) functions

Store

Store Direct Function

Store Indirect Function

Store Timer/Counter Preset

Load Indirect Functions

Load Timer/Counter Preset

Store Time/Counter: Current Value

Load Timer/Counter: Current Value

Vector

Load

Load Timer Bit Value


Store

Find

Fill / Fill Offset

Copy / Copy Offset

Compare / Compare Offset

Bit to Numeric, Numeric to Bit

Get Max

Get Min

Vector: Copy Memory


Shift Byte Left

Calls

Jump to Label

Load HMI Display

14
Ladder

HMI Display Loaded

Load Last HMI Display

Call Subroutine

Subroutine Return

Strings

Transpose

Num to ASCII

Display RTC (ASCII

IP to ASCII

Data Tables

Read/Write

Direct Read/Write

Data Tables: Clear Table


Data Tables: Find Row

Immediate Elements

Immediate: Read Physical Input

Immediate: Update High-speed Input

Immediate: Write to Output

Immediate: Write to Physical Analog Output

For information regarding advanced functions, such as MODBUS, check the topic FBs Library.

Placing a Ladder Element in a Net

1. Select any type of Ladder element by:


Clicking its icon on the Ladder toolbar, -or-

Selecting it from the Ladder menu, -or-


Right-clicking on the Ladder to display the Ladder menu and then selecting the element.

2. Move the element to the desired net location, then click.

15
VisiLogic Software Manual - Ladder

3. Link operands using the Select Operand and Address dialog box shown below.

Delete Elements
Select the desired element(s), then

Select Cut. -or-

-or-
Select Cut or Copy from the Edit menu.
16
Ladder

Click the Delete button on the toolbar. -or


Right-click the Element, then select Delete from the menu.

Change Element Type


To change an element type after it is placed in a net and linked to an operand:

Right-click the element, select Replace Ladder Element, then select the appropriate element type.

After the element has been changed, it remains linked to the same operand.

You can use this method to change contact or coil types, to switch math and other function types while retaining
the same input and output operands.

Contacts
A contact represents an action or condition. You can link it to any of the following bit operands:

Memory Bit
System Bit
Network System Bit
Network System Input
Inputs
Output
Timer
Each contact condition in a net is loaded into the bit accumulator and evaluated to determine the coil (output or
expression) condition. There are 4 types of contacts:

Direct Contact
Inverted Contact
Positive Transition Contact (Rise or One Shot)
Negative Transition Contact (Fall)
Contacts can be connected in series and in parallel on a Ladder net.

Direct Contacts
A Direct Contact is a normally open (NO) contact condition. You can link it to any of the following bit
operands:

17
VisiLogic Software Manual - Ladder

Memory Bit
System Bit
Network System Bit
Network System Input
Output
Timer
A door buzzer is an example of a Direct Contact. When you push the buzzer, power flows through the circuit
and the buzzer sounds. When you release the buzzer, the sound stops.

During the system scan, the processor evaluates the program elements net by net.

If the Direct Contact bit operand (the door buzzer) is OFF (logic 0): power will not flow through the Direct
Contact. The door buzzer is silent.

If the Direct Contact address (the door buzzer) is ON (logic 1): power will flow through the Direct Contact. The
door buzzer sounds.

Inverted Contacts
An Inverted Contact represents a normally closed contact condition. You can link it to any of the following bit
operands:

Memory Bit
System Bit
Network System Bit
Network System Input
Output
Timer
An Inverted Contact condition can be from an external input device (for example: a push button) or from an
internal input system element (for example: SB 50 Key +/- is pressed).

An emergency light contains an example of an Inverted Contact.

Normally, there is power flow through the emergency light's Inverted Coil and the light stays off.
During an electric power outage, the power flow through the Inverted Coil stops and the
emergency light comes on.
During the system scan, the processor evaluates the program elements net by net.

If the Inverted Contact address (power supply) is ON (logic 1): power will flow through the Inverted Contact.
The emergency light will stay off.

If the Inverted Contact address (power supply) is OFF (logic 0): power will not flow through the Inverted
Contact. The emergency light comes on.

If the power outage ends and power flow is returned to the Inverted Contact, it will close again and the
emergency light will go off again.

Negative Transition Contact


A Negative Transition Contact gives a single one-shot pulse when the bit operand it is linked to falls from ON
(logic 1) to OFF (logic 0). A Negative Transition Contact registers the fall in status from ON to OFF. You can
link it to any of the following bit operands:

18
Ladder

Memory Bit
System Bit
Network System Bit
Network System Input
Output
Timer
A computer ON/OFF button is an example of a Negative Transition Contact. The computer is ON.

If you push the ON/OFF button in without releasing it, the computer will not shut down. But when you release
the button, the system registers a change in status from ON to OFF. The computer then shuts down.

During the system scan, a Negative Transition Contact address is evaluated for a transition from ON to OFF. A
transition allows power to flow through the Negative Transition Contact for one scan.

At the end of a scan, the Negative Transition Contact is reset to OFF (logic 0). The Negative Transition Contact
can only be re-activated when the triggering signal again changes from ON to Off.

Note • A maximum of 255 Rise/Fall elements is allowed in a project. To ascertain how many elements
of each type are in the project, use the Find Element utility on the Edit menu. Search for
Positive Transition Contact and Negative Transition Contact. The sum of the results must not
exceed 255. If a program exceeds this number, Error 1017 results.

Positive Transition Contact


A Positive Transition Contact gives a single one-shot pulse when its reference address rises from OFF (logic 0)
to ON (logic 1). A Negative Transition Contact registers the fall in status from OFF to ON. You can link it to
any of the following bit operands:

Memory Bit
System Bit
Network System Bit
Network System Input
Output
Timer
A cellular phone keypad key is an example of a Positive Transition Contact. When you push a key a number is
displayed on the screen. It does not matter if you push the key quickly or hold it down for several seconds. The
number will only appear once on the screen.

The cellular phone registers the transition from key NOT pressed to key pressed. The length of time the key is
pressed is not relevant. You must release the key and press it again to repeat the number on the cellular phone
screen.

During the system scan, a Positive Transition Contact address is evaluated for a transition from OFF to ON. A
transition allows power to flow through the Positive Transition Contact for one scan.

At the end of a scan, the Positive Transition Contact is reset to ON (logic 1). The Positive Transition Contact is
re-activated when the linked signal turns from OFF to ON.

Note • A maximum of 255 Rise/Fall elements is allowed in a project. To ascertain how many elements
of each type are in the project, use the Find Element utility on the Edit menu. Search for
Positive Transition Contact and Negative Transition Contact. The sum of the results must not
exceed 255. If a program exceeds this number, Error 1017 results.

19
VisiLogic Software Manual - Ladder

Coils
A Coil represents a result or expression of an action. A coil turns ON when the preceding net conditions are ON,
allowing power flow to reach the coil from the net. If the preceding net conditions are OFF, a coil turns OFF.
You can link it to any of the following bit operands:

Memory Bit
System Bit
Output
Timer
Each contact condition is evaluated in a net to determine the coil (result or expression) condition. Coil types
include:

Direct Coil
Inverted Coil
Set Coil
Reset Coil
Toggle Coil

Note • Do not energize a coil more than once in a program.

Direct Coil
An Direct Coil turns ON when the preceding net conditions are ON, allowing power flow to reach the coil from
the net. If the preceding net conditions are OFF, an direct coil turns OFF. You can link it to any of the following
bit operands:

Memory Bit
System Bit
Output
Timer
The coil can represent an external output device (for example: alarm bell) or to an internal system element, as
for example, SB 41, which is key #1 on the controller's keyboard..

Inverted Coil
An Inverted Coil turns OFF when the preceding net conditions are ON, allowing power flow to reach the coil
from the net. If the preceding net conditions are OFF, an inverted coil turns ON. You can link an Inverted Coil
to an:

Memory Bit
System Bit
Output
Timer
The coil can represent an external output device (for example: alarm bell) or to an internal system element, as
(for example, SB 4 Divide by 0.

To place a coil in a Ladder net:

1. Click a Coil icon on the toolbar.


2. Move your cursor to the desired location in the net, then click.
3. The coil drops into place.

20
Ladder

Reset Coil
A reset coil turns a set coil OFF (unlatches), when the preceding net conditions are ON, allowing power flow to
reach the reset coil from the net.

Note • Once a set coil is turned ON, it stays ON, independent of the original set condition, until a reset
coil linked to the same address resets (unlatches) the coil condition.
You can link it to any of the following bit operands:

Memory Bit
System Bit
Output
Timer
Do not use a set coil without a reset coil in a program.

Set Coil
A set coil separates the coil from the action or condition that energized the coil. Once energized, a set coil's
result is no longer dependant on the action that energized it. A set coil stays energized (latched) until its
condition is reset (unlatched) by a reset coil. You can link it to any of the following bit operands:

Memory Bit
System Bit
Output
Timer
An example of a set coil is an overhead light. When you turn on a light, it stays lit until you turn it off (reset or
unlatch it) or the light bulb burns out. You do not have to hold the light switch to keep the light on.

An example of a coil that you do not want to be set ( latched) is a car horn. You expect it to toot only when you
press on the horn button and you expect it to stop when you stop pressing on the horn button.

Do not use a set coil without a reset coil in a program.

Toggle Coil
A toggle coil changes its state when it is activated. You can link it to any of the following bit operands:

Memory Bit
Output
Toggle Coil is fast;the execution time is shorter that Reset Coil.

An example of a toggled coil is an light switch. When you turn on a light, it stays lit until you toggle it; it then
turns off. The light stays off until you toggle it back on.

Immediate Elements
Immediate elements are located on the More> Immediate menu.

Generally, I/Os values are read and written to according to the PLC program scan.

Immediate elements immediately update the current value of I/Os--without regard to the program scan. This
enables you:

Write values to inputs, and use the new input value to execute the rest of the PLC program.
Turn outputs ON, as for example in an emergency routine.
If your program requires you to immediately update an I/O value, use Immediate elements in conjunction with
Interrupt routines.

21
VisiLogic Software Manual - Ladder

Immediate: Read Physical Input


Read Physical Input is located on the More> Immediate menu.. This element can be used to immediately read
the current status of a physical, hardwired input and use the new input status to execute the PLC program.

Ordinarily, a PLC program scan runs like this:

When the program encounters Read Physical Input, the program immediately reads the physical PLC input,
updates the PLC memory, and executes the rest of the program using the new input data.

To use Read Physical Input, place it in a net after an activating condition and select the desired input.

Note • Within a net, Read Physical Input should stand alone except for its activating condition.
Immediate: Update High-speed Input
Update High-Speed Input is located on the More> Immediate menu. This element can be used to immediately
update the current value of a physical, hardwired high-speed input--without regard to the program scan--and use
the new input value to execute the PLC program.

22
Ladder

When the program encounters Update High-Speed Input, the program immediately compares the actual, current
input value against the value in the MI linked to the input.

If the values are not equal, the MI is updated with the current input value; the rest of the program executes
according to the new input data.

To use Update High-Speed Input, place it in a net after an activating condition and select the desired input.

Note • Within a net,Update High-Speed Input should stand alone except for its activating condition.

23
VisiLogic Software Manual - Ladder

Immediate: Write to Output


Write to Output is located on the More> Immediate menu. This element can be used to immediately update the
status of a physical, hardwired output.

Ordinarily, a PLC program scan runs like this:

When the program encounters Write to Output, the program immediately writes the physical PLC output, then
executes the rest of the program.

To use Write to Output, place it in a net after an activating condition and select the desired output.

Note • Within a net, Write to Output should stand alone except for its activating condition.
• If, after Write to Output has been executed, the same output is updated as the rest of the
program runs, the last update is the one written to the PLC memory at the end of the program
scan.
Immediate: Write to Physical Analog Output
Write to Physical Analog Output is located on the More> Immediate menu. This element can be used to
immediately write a value into a physical, hardwired output--without regard to the program scan.

This function is generally included in an Interrupt routine, for example to turn an output ON in case of an alarm
or emergency.

24
Ladder

Note • Within a net, Write to Physical Analog Output should stand alone .

Operands
Operands
Ladder elements and functions are linked to operands. Operands contain data. The Ladder elements and
functions determine the way that operand data is used in your program. Every Operand has an Address and a
Description. When you select a Ladder element and place it in a net, the Select Operand and Address box opens,
enabling you to link an Operand type, select an address, and assign a description.

To View Operand Lists


1. Select the Operand tab at the bottom of the Output Window; the operands are displayed.
2. Click an operand type in the left pane; a list of that operand type is displayed.
Note that you can edit values and descriptions in the Output Window.

25
VisiLogic Software Manual - Ladder

Operand Types and Symbols

Type Symbol Quantity Value Address Range


Input I 544 Bit I0-I543

Output O 544 Bit O0-O543

Timer T 192 32-bit T0-T191

Counters (C) c 24 16-bit C0-C24

Memory Bit MB 4096 Bit MB0-MB4095

Memory Integer MI 2048 16-bit MI0-MI2047

Memory Long Integer ML 256 32-bit ML0-ML255

Double Word (unsigned) DW 64 32-bit DW0-DW63

Memory Floating Point Integer MF 24 32 MF0-MF24

Constant Value # Dynamic Dynamic

System Operands
System Operands are connected to certain functions and values in the controller's operating system.

Type Symbol Quantity Value Address Range


System Bit SB 512 Bit SB0-SB511

System Integer SI 512 16-bit SI0-SI511

System Long Integer SL 56 32-bit SL0-SL63

System Double Word (unsigned SDW 64 32-bit

Network Operand Types and Symbols


If a controller is networked, the following operands are accessible to other controllers:

Type Symbol Quantity Value Address Range


Network System Bit NSB 8 Bit SB200-SB207

Network Input NI 17 Bit I0-I16

Network System Integer NSI 2 16-bit SI200-SI201

Linking Operands to Elements


When you place a Ladder element or function on a net, the Select Operand and Address dialog box opens. All of
the operands and operand types that are displayed in the Select Operand and Address dialog box are applicable
to the element or function that you have selected. To edit an operand attached to an element, you can also
double-click on the yellow Description field of an element after it has been placed in the Ladder.

You can search for a particular operand by using the Search: Symbolic Name function at the bottom of the
dialog box.

26
Ladder

Operand Addressing
An Operand Address is the physical location in the controller memory where the data is stored.

For example:

MB 10 - "10" is the address of the MB Operand


MI 35 - "35" is the address of the MI Operand
T 12 - "12" is the address of the Timer Operand
You can also assign descriptions to the operands you use in your application.

Power-up Values
Power-up values can be assigned to most operands. These values are written into the operands when the
controller is turned on.

Bit operands can be SET or RESET. Integers, Long Integers, and Double Words can be assigned values that are
written into the operand at power-up.

You can assign Power-up Values in the:

Select Operand and Address Dialog Box


Check the box next to the plug-shaped icon. This enables you to enter a value in the Power-up value
fill-in field.

Operand View Window


1. Select the Operand tab at the bottom of the screen.
2. Click on the Operand type to display the list of operands.
3. Enter Power-up values in the column headed by the Power-up icon.

Constant Values #
A Constant Value is an integer number, either signed or unsigned, that is created by the programmer. Constant
Values are symbolized by a number sign.

To use a Constant Value in your program, select the


Constant option in the Select Operand and Address dialog
box and enter a number.
You can also select the unsigned integer option.

27
VisiLogic Software Manual - Ladder

When entering the value, you can toggle to Hex via


<CTRL> + <H>.

Constant Value Operands


You can create a list of named Constant Value Operands in the Output Window at the bottom of the screen.

1. Select the Constant tab in the Output Window; the list of Constant Values opens.
2. Enter a Description and a Value; note the Unsigned option.
3. Create a new Constant Value by pressing Enter.
When you create a Constant Value in this way, the program references the value by the description.

By entering the Constant Value's description in the Select Operand and Address dialog box, you can use this
Constant Value in your application.

Operand Types
Memory Bits (MB)
Memory Bits are bit operands ( 0 or 1).

There are 4096 MBs, address MB 0 - MB 4095.

To display a list of operands, click on the Operand tab in the Output Window at bottom of the screen, then select
the operand type. Scroll down to view the list

Inputs (I)
Inputs are bit operands (0 or 1).

The number of Inputs varies according to the Snap-in I/O Modules and I/O Expansion Modules you integrate
into your system.

An Input is an actual hardwired input connection into the controller.

To display a list of operands, click on the Operand tab in the Output Window at bottom of the screen, then select
the operand type. Scroll down to view the list

Outputs (O)
Outputs are bit operands ( 0 or 1).

The number of Outputs varies according to the Snap-in I/O Modules and I/O Expansion Modules you integrate
into your system.

An Output is an actual hardwired output connection from the controller.

To display a list of operands, click on the Operand tab in the Output Window at bottom of the screen, then select
the operand type. Scroll down to view the list

Timers (T)
To use a timer in your program, place an element in a net, select T, then define the timer's attributes as shown
below.'

28
Ladder

There are 3 types of timers. Each timer type has 3 variables:

Timer Bit Value: A timer is scanned as a bit data type (scan for OFF, scan for ON). The result of
the scan is dependent on the timer type.
Timer Preset Value. A running timer always decrements (counts down) from the Preset Value.
The Preset Values are loaded for all timers at power up. The Preset Value is also loaded into the
Current Value when the timer is reset.
Timer Current Value. The current value of the timer is dependent on the timer type.
All timer types are activated by a rising transition edge, OFF to ON. The condition you use to activate the timer
should be scanned only once per PLC program scan

TD- Timer: On Delay

When the timer's Start & Run Condition is OFF, the timer's Bit Value is also OFF.

When the timer's Start & Run Condition rises, the timer's Preset Value is loaded into the timer's Current Value.
The timer begins to run. Note that the timer's Bit Value is OFF.

If the timer's Start & Run Condition remains ON during subsequent PLC cycles, the Current Value of the timer
continues to decrement.

When the timer has decremented to 0, and the timer's Start & Run Condition is still ON, the timer's Bit Value
turns ON. Note that when the timer has finished running, its Current Value is 0.

If the timer's Start & Run Condition falls while the timer is decrementing, the timer stops running. The current
value of the timer remains.

Timer Reset takes precedence over the timer's Start & Run Condition. When the timer' Reset Condition rises, the
timer's Bit Value turns OFF. The timer's Preset Value is loaded into the Current Value, and the timer's Start &
Run Condition cannot activate the timer as long as Reset is ON..

When the timer's Reset Condition falls while the timer's Start & Run Condition is ON, the timer begins to run,
exactly the same as when the timer's Start & Run Condition rises.

Below, pressing Key #1 on the Vision keypad activates TD1, which is preset to 5 seconds. If Key #1 is held
down for 5 seconds, TD1 decrements to zero. O1 switches on.

If, however, Key #1 is released before TD1 has finished, the timer stops. When Key #1 is pressed again, TD1
again begins to decrement from 5 seconds.

29
VisiLogic Software Manual - Ladder

TA Timer: Accumulated

When the timer's Run Enable Condition rises, the timer's Preset Value is loaded into the timer's Current Value.
The timer begins to run. Note that the timer's Bit Value is OFF. When the timer's Run Enable Condition remains
ON during subsequent PLC cycles, the Current Value of the timer continues to decrement.

When the timer has decremented to 0, and the timer's Start & Run Condition is still ON, the timer's Bit Value
turns ON. Note that when the timer has finished running, its Current Value is 0.

If the timer's Run Enable Condition falls while the timer is running, the timer stops running, but the current
value of the timer is retained. When the timer is reactivated, it begins decrementing from the retained value.

Timer Reset takes precedence over the timer's Run Enable Condition. When the timer' Reset Condition rises, the
timer's Bit Value turns OFF. The timer's Preset Value is loaded into the Current Value, and the timer's Run
Enable Condition cannot activate the timer as long as Reset is ON.

When the timer's Reset Condition falls while the timer's Start & Run Condition is ON, the timer begins to run,
exactly the same as when the timer's Run Enable Condition rises.

Note • Once a TA Timer has reached its preset value, its Bit Value remains ON until the timer is reset
in the program. The timer cannot be activated by Run Enable until it has been reset.

In the net below, pressing Key #2 on the Vision keypad activates TA2, which is preset to 5 seconds. If Key #2 is
held down for 5 seconds, TA2 decrements to zero. O2 switches on.

If, however, Key #2 is released after 2.53 seconds--before TA2 has reached the preset value--the timer stops and
its current value is retained . When Key #2 is pressed again, TA2 begins to decrement from 2.53 seconds. When
TA2 decrements to 0, O2 turns ON.

30
Ladder

TE Timer: Extended Pulse

When the timer's Start Condition rises, and the Bit Value is OFF, the timer's Preset Value is loaded into the
timer's Current Value. The timer begins to run and the Bit Value turns ON.
If the timer's Start Condition remains ON during subsequent PLC cycles, the Current Value of the timer
continues to decrement. However, if the timer's Start Condition rises before the timer has decremented to its
Preset Value, the timer reloads the Preset Value into the Current Value, and again begins to decrement. Note that
a falling Start condition does not affect the timer.
When the timer has decremented to 0 the timer's Bit Value turns OFF. Note that when the timer has finished
running, its Current Value is 0.
Timer Reset takes precedence over the timer's Start Condition. When the timer' Reset Condition rises, the timer's
Bit Value turns OFF. The timer's Preset Value is loaded into the Current Value, and the timer's Start Condition
cannot activate the timer as long as Reset is ON..
When the timer's Reset Condition falls while the timer's Start Condition is ON, the timer begins to run, exactly
the same as when the timer's Start Condition rises.
Note • Once a TE Timer has reached its preset value, its Bit Value remains OFF until the timer is reset
in the program.
In the nets below, pressing Key #3 on the Vision keypad activates TE3, which is preset to 5 seconds. Once Key
#3 is pressed, TE3 decrements to zero. O3 switches on.

Notes • A Timer value can be displayed in a Display as either a current or elapsed value.
• The maximum amount of time that you can set a timer for is 99 hours, 59 minutes, and 59.99
seconds.

Viewing and Setting Timers


To display a list of Timers, click on the Operand tab in the Output Window at bottom of the screen, then select
Timers. Scroll down to view the list.

31
VisiLogic Software Manual - Ladder

Timers can also be preset and edited in the Select Operand and Address dialog box when you insert a timer into
your program.

You can also use Information Mode to edit or enter a timer value via the controller keyboard while the controller
is running its control program.

Counters (C)
VisiLogic offers 24 built-in counters, represented by the symbol C. To use an Up Counter in your program,
place an Increment function in a net and select C. To use a Down Counter in your program, use a Decrement
function.

A counter counts rising-edge pulses.

When the accumulated number of pulses equals the counter's preset value, power flows through the function and
the counter bit turns ON. Once the preset value is reached, the counter bit stays ON until it is reset via a Reset
Coil. This also initializes the counter value.

Note • Counter values can be displayed on the controller screen via a Counter Variable in the HMI
editor. Either the current or the elapsed counter value can be shown in a Display.

Viewing and Setting Counters


A counter's Preset Value can be assigned either in the Select Operand box or in the Output Window. To display
a list of Counters, click on the Operand tab in the Output Window at bottom of the screen, then select Counters.
Scroll down to view the list.

Memory Integers (MI)


Memory Integers are 16-bit integer operands that may be signed or unsigned. The range of an MI is -32768 to
+32767.

32
Ladder

There are 2048 MIs (Address MI 0 - MI 2047).

To display a list of operands, click on the Operand tab in the Output Window at bottom of the screen, then select
the operand type. Scroll down to view the list

Memory Long Integer (ML)


Memory Long Integers are 32-bit integer operands that may be signed or unsigned, with a range of -
2,147,483,648 to +2,147,483,647.

There are 256 MLs (ML 0 - ML 255).

To display a list of operands, click on the Operand tab in the Output Window at bottom of the screen, then select
the operand type. Scroll down to view the list

Double Word (DW)


Double Words are 32-bit unsigned integer operands, maximum value 4,294,967,296.

There are 64 Double Words, address DW0 to DW63.

Memory Floating Point Integer (MF)


Floating point integers are 32-bit integer operands that may be signed or unsigned, with a range of -
3.402823E38 to -1.401298E-45 for negative numbers, and +1.401298E-45 to +3.402823E38 for positive
numbers

There are 24 MFs (MF 0 - MF23).

To display a list of operands, click on the Operand tab in the Output Window at bottom of the screen, then select
the operand type. Scroll down to view the list

System Operands (SI) (SL) (SB) (SDW)


System Operands types include: System Bits (SB), System Integers (SI), System Double Word (SDW), and
System Long (SL).

System Operands are used by the controller's operating system to manage certain functions and values. Many
System Operands are linked to fixed parameters and are read-only, such as SB 2 Power-up bit, which turns ON
for a single cycle whenever the controller powers up.

Other System Operands can be written to by the program, or via INFO Mode. For example, to calculate the
current internal temperature of the controller, you can turn on SB 14; the controller will then write the current
temperature into SI 14, which is read only.

To display a list of System Operands with their descriptions, click on the Operand tab in the Output Window at
bottom of the screen, then select the operand type. Scroll down to view the list.

Note • System Operands have preset descriptions that describe their function. If descriptions have been
changed, or if you are opening a project that was written using a different version of VisiLogic,
you can display restore descriptions via the Project Menu Project>System Descriptions>Restore
all System Descriptions.
• All SBs and SIs which do not have descriptions are reserved for use by the system.

System Bits
General, SBs 0-14

# Description Turns ON when: Turns OFF when: Reset by:


SB 0 Always 0 Never Always

33
VisiLogic Software Manual - Ladder

SB 1 Always 1 Always Never

SB 2 Power-up bit Power-up occurs, for 1 scan

SB 3 1 second pulse

SB 4 Divide by zero

SB 5 Outputs short circuit

SB 6 Keyboard is active

SB 7 100 mS pulse

SB 8 Battery low

SB9 RAM failure :Bit value is not 0 or 1

SB 10 Float Error By OS when the result of a float By user, or at


operation is an illegal float value. power-up.

SB 11 User Stack Overflow

SB 14 Calculate current controller temperature OS

Touchscreen models only (V280), SBs 16-17, 20-22

# Description Turns ON when: Turns OFF when: Reset by:

SB 16 Touchscreen Active Touchscreen is actually being touched The screen is not OS


being touched.

SB 17 Enable/Disable Touch- User turns ON to enable a message to be User turns it off. User
screen indication, handwritten on the touch-screen with a stylus
Message Board function

SB 22 Enable Virtual Keypad • ON by default in Touchscreen-only models • Off by default in User/ OS


(V290) models with
Touchscreen +
• In Touchscreen + HMI keypad models (
HMI keypad
V280), user turns ON to enable Virtual keypad.
When ON, the normal alphanumeric keypad is • May be turned
suspended. OFF by user.

HMI Display tasks, SBs 26-34

# Description Turns ON when: Turns OFF when: Reset by:

SB 26 Exiting OS Draw Mode (ON for 1 cycle after Turns ON for a single cycle At all other times OS
OS draw) when SB 28 turns OFF. This
OS Draw Mode means that the controller's happens at the following
Operating System takes control of the LCD times:
screen: • When the PLC exits Info
• During Info Mode Mode.
• When a Display is entered • Rises the cycle after a
Display is entered.
• When the Virtual Keypad (touch-screen
models) is displayed • When Virtual Keypad
mode exits.
• When 'Symbols' are displayed during

34
Ladder

Keypad Entry. • After 'Symbols' are


displayed during Keypad
Entry.

SB 27 Enter Display without active Keypad Entry By program By program


Variables
If SB 27 is ON when a Display is shown:
The user cannot navigate through the
variables using the Enter or Right-arrow
keys.
No Keypad Entry Variable will be marked
by the blinking cursor. In this case, a
variable may be activated by:
Touch (V280 only)--assuming it has
been assigned the Touch property.
By writing the variable ID # into SI
250, either via Info or Online mode.

SB 28 LCD controlled by OS (OS drawing) • ON when the PLC is in • PLC exits Info OS
OS Draw Mode means that the controller's Info Mode. Mode
Operating System takes control of the LCD • ON when 'Symbols' are • After a Display
screen: displayed during Keypad is entered.
• During Info Mode Entry.
• When a Display is entered • Rises when a Display is
entered.
• When the Virtual Keypad (touch-screen
models) is displayed • In V290, which uses a
virtual screen keyboard,
• When 'Symbols' are displayed during SB 28 is always ON.
Keypad Entry.

SB 29 Current keypad entry sets SB 30 (HMI keypad OS


entries complete)
Turn SB 29 ON after data is keyed into any
variable, enabling the user to skip keying in
data for all of the variables on-screen.
Also refreshes all Display variables on-screen

SB 30 HMI keypad entries completed OS

SB 31 Refresh current LCD screen display variables OS

SB 32 HMI keypad entry in progress OS

SB 33 Display, Call Sub When a Display containing a OS


The positive status of SB33 is visible within Call Sub starts loading, ON
the specific subroutine only when it runs. Use for a single scan cycle.
it to initialize operands in the HMI subroutine.

SB 34 Display Exit Turns ON for a single scan OS


cycle when a display is exited.

OnLine Test SB 35

# Description Turns ON when: Turns OFF when: Reset by:

SB 35 OnLine Test Point During OnLine mode, Single Scan, One or none instances are

35
VisiLogic Software Manual - Ladder

when more than 1 instance of activated


OnLine Test Point is activated
(receives RLO).

INFO mode, SB 36

# Description Turned ON Turned Off Comments

SB 36 INFO mode By OS, Remote Access, Turns OFF when user Delay time to enter Info Mode is 4 seconds,
or program exits Info Mode may be modified via SI 50

Invert Touchscreen element pixels, SB 38

# Description Turned Turned Off Comments


ON
SB 38 Invert Touchscreen element By By program If a Touchscreen text or image element is touched and this
pixels (Text, images) program bit is on, the pixels in the element reverse color.

Keypad keys, SBs 40-72

Note that the presence of function keys is model-dependant.

# Description Turns ON when: Turns OFF Reset by:


when:
SB 40 Key: # 0 Key is pressed/held down Key is released OS

SB 41 Key: # 1

SB 42 Key: # 2

SB 43 Key: # 3

SB 44 Key: # 4

SB 45 Key: # 5

SB 46 Key: # 6

SB 47 Key: # 7

SB 48 Key: # 8

SB 49 Key: # 9

SB 50 Plus/Minus

SB 51 Left Arrow

SB 52 Right Arrow

SB 53 ENTER

SB 54 <i> (ON when in Info mode, may be turned ON in


order to enter Info, via Remote Access or user
program)

36
Ladder

SB 55 Up

SB 56 Down

SB 57 ESC

SB 58 F1

SB 59 F2

SB 60 F3

SB 61 F4

SB 62 F5

SB 63 F6

SB 64 F7

SB 65 F8

SB 66 F9

SB 67 F10

SB 68 F11

SB 69 F12

SB 70 F13

SB 71 F14

SB 72 F15

COM Port/Modem initialization, SBs 80-85

Each port is linked to 2 SBs indicating COM Port/Modem initialization status following COM Init.
Both SBs are initialized to OFF by the OS, at Power-up and at the beginning of COM Init process. When COM Init is complete,
one is ON, the other OFF.

# Description

SB 80 Modem Initialized: COM Port 1


Example: COM Port 1

SB 81 COM Port/Modem Initialization Failed: COM


SB 80 SB 81
Port 1

SB 82 Modem Initialized: COM Port 2 0 0 After Power-up, before COM Init

SB 83 COM Port/Modem Initialization Failed: COM


Modem Initialization attempt failed, Modem is
Port 2 0 1
not initialized

SB 84 Modem Initialized: COM Port 3


Modem Initialization attempt succeeded,
1 0
Modem is initialized.

37
VisiLogic Software Manual - Ladder

SB 85 COM Port/Modem Initialization Failed: COM


1 1 Not possible
Port 3

Modem connection status, SB 86-88

Each port is linked to an SB indicating modem connection status. These can be used in conjunction with SBs 132-137, which
indicate indicating whether incoming or outgoing data is flowing through the port, to troubleshoot problems as shown in the
Help topic Modem Troubleshooting.

# Description Turns ON when: Turns OFF when: Reset by:

SB 86 Modem Connection Status: COM Port 1 PLC receives 'Connect' • Hang-up OS, at Power-
string from modem up
• PLC receives string 'No
SB 87 Modem Connection Status: COM Port 2 Carrier'
• PLC receives break signal
SB 88 Modem Connection Status: COM Port 3

I/O Expansion Modules, SB 90-91

See Help topic Detecting short-circuited end devices

# Description Turns ON when: Turns OFF when: Reset by:

SB 90 I/O Expansion error \ I/O Expansion


not connected

SB 91 I/O Exp. Module--Command buffer When an I/O is processing a OFF when an I/O is
is full command. idle.

GPRS modem connected, SB 100

# Description Turns ON when: Turns OFF when: Reset by:

SB 100 GPRS modem • Call Remote device begins. • End Session OS


connected succeeds.
• GPRS incoming call is answered.
• Disconnect from
Network
succeeds.

Draw: Out of Range SB 110

# Description Turns ON when: Turns OFF when: Reset by:

SB 110 Draw: Out of Range The OS attempts to draw a line or At the beginning of OS
pixel outside of the legal limits of every cycle
the controller's LCD.

DTR/DSR signals, SBs 120-125

SBs 120-125 register the signals that each port receives from the DTR and DSR pins of a serial communication cable.
The DTR SBs 120, 122, and 124 are also used by the OS to control the DTR signal during RS485 serial communications, and
during GPRS communications using the Sony Ericsson GPRS modem.

# Description Turns ON when: Turns OFF when: Reset by:

SB 120 DTR COM Port 1 (signal output from DTR signal DTR signal absent OS, may also be reset by user
PLC) present

38
Ladder

SB 121 DSR COM Port 1 (signal input to PLC) DSR signal DSR signal absent OS
present

SB 122 DTR COM Port 2 (signal output from DTR signal DTR signal absent OS, may also be reset by user
PLC) present

SB 123 DSR COM Port 2 (signal input to PLC) DSR signal DSR signal absent OS
present

SB 124 DTR COM Port 3 (signal output from DTR signal DTR signal absent OS, may also be reset by user
PLC) present

SB 125 DSR COM Port 3 (signal input to PLC) DSR signal DSR signal absent OS
present

COM SBs 132-137

Each port is linked to 2 SBs indicating when incoming or outgoing data is flowing through the port. To troubleshoot problems,
use these in conjunction with the Modem Connection Status SBs 86-88, as shown in the topic Modem Troubleshooting.

# Description Turns ON when: Turns OFF when: Reset by:

SB 132 COM Port 1, Data Transmission During data send When data is not being sent OS

SB 133 COM Port 2, Data Transmission

SB 134 COM Port 3, Data Transmission

SB 135 COM Port 1, Data Receive During data reception When data is not being received OS

SB 136 COM Port 2, Data Receive

SB 137 COM Port 3, Data Receive

Ethernet-enabled controllers only, SBs 141-158

# Description Turns ON when: Turns OFF when: Reset by: Comments

SB 141 Ethernet: Card Ethernet card is No Ethernet card is When the Ethernet: Card
Exists found installed Initialization FB runs,
the PLC checks whether
an Ethernet card is
installed.

SB 142 Ethernet: Card Ethernet card Ethernet card


Initialized initialization initialization fails
succeeds

SB 143 Ethernet: Socket Socket 0 initialization Socket 0


0 Initialized succeeds initialization fails

SB 144 Ethernet: Socket Socket 1 initialization Socket 1


1 Initialized succeeds initialization fails

SB 145 Ethernet: Socket Socket 2 initialization Socket 2


2 Initialized succeeds initialization fails

SB 146 Ethernet: Socket Socket 3 initialization Socket 3


3 Initialized succeeds initialization fails

39
VisiLogic Software Manual - Ladder

SB 147 Ethernet: Socket Connection Socket 0 is free


0 Connected established via
Socket 0

SB 148 Ethernet: Socket Connection Socket 1 is free


1 Connected established via
Socket 1

SB 149 Ethernet: Socket Connection Socket 2 is free


2 Connected established via
Socket 2

SB 150 Ethernet Status: Connection Socket 3 is free


Socket 3 established via
Connected Socket 3

SB 151 Ethernet Link: A link exists No link exists


Communication
established

SB 152 Ethernet Link: When a 10baseT link When a 10baseT


10baseT is detected, during link is not detected,
data transmit/ during data
receive. transmit/ receive.

SB 153 Ethernet Link: When a 100baseT When a 100baseT


100baseT link is detected, link is not detected,
during data transmit/ during data
receive. transmit/ receive.

SB 154 Ethernet: data More than one device One or no devices


collision is transmitting data are transmitting
over the Ethernet data over the
network Ethernet network

SB 155 Ethernet: Socket Data is being Data is not being


0 Send in transmitted via transmitted via
Progress Socket 0 Socket 0

SB 156 Ethernet: Socket Data is being Data is not being


1 Send in transmitted via transmitted via
Progress Socket 1 Socket 1

SB 157 Ethernet: Socket Data is being Data is not being


2 Send in transmitted via transmitted via
Progress Socket 2 Socket 2

SB 158 Ethernet: Socket Data is being Data is not being


3 Send in transmitted via transmitted via
Progress Socket 3 Socket 3

SMS message transmission status, SBs 184-185

When the Send process begins, for each and every message, both SB 184 and 185 are OFF. After the message is sent, the
relevant bit turns ON, indicating the success or failure of that message. Operands that are linked by the user to SMS FBs may

40
Ladder

be found in the topic SMS Operands.

SB Description Turns ON when: Turns OFF when:

184 SMS: Transmission Succeeded Transmission succeeds Transmission begins

185 SMS: Transmission Failed Transmission fails Transmission begins

CANbus, SBs 200-237

To learn how to use these operands to communicate data, check the topic CANbus Networking.

# Description Turns ON when: Turns OFF when: Reset by:

SB 200 CANbus Network operand

SB 201 CANbus Network operand

SB 202 CANbus Network operand

SB 203 CANbus Network operand

SB 204 CANbus Network operand

SB 205 CANbus Network operand

SB 206 CANbus Network operand

SB 207 CANbus Network operand

SB 208 CANbus Network operand

SB 209 CANbus Network operand

SB 210 CANbus Network operand

SB 211 CANbus Network operand

SB 212 CANbus Network operand

SB 213 CANbus Network operand

SB 214 CANbus Network operand

SB 215 CANbus Network operand

CANbus Network communication


SB 236 Error is fixed.
error

SB 237 CANbus Network disable

Keypad entry, SBs 250-251

41
VisiLogic Software Manual - Ladder

To learn how to use these operands to communicate data, check the topic Limit Keypad Entry.

# Description Turns ON when: Turns OFF when: Reset by:

For a single cycle after


SB 250 Keypad entry within limits keypad entry when
entry within limits.

For a single cycle after


SB 251 Keypad entry exceeds limits keypad entry when
entry exceeds limits.

SMS ASCII, SB 279

# Description Turns ON when: Turns OFF when: Reset by:

Send SMS User Program


SB 279 messages in ASCII Should be turned ON at power-up, User Program
format before Com Init.

Reset PLC, SB 300

# Description Turns ON when: Turns OFF when: Reset by:

By program or
SB 300 Reset PLC Reset is run OS
Remote Access

Buzzer SB 310, 311

Turns OFF
# Description Turns ON when: Reset by:
when:

Buzzer
SB 310 By user By user User
Turn this ON to sound a buzzer

Buzzer - Screen Touch


Turn this ON to cause a keypad By user,
SB 311 touch (both HMI keypad and ON by default in By user User
Virtual keypad) to sound a V290/280
buzzer

Data Tables, SB 500

# Description Turns ON when: Turns OFF when: Reset by:

DT Write: Address exceeds DT


SB 500
range

System Integers
General, SIs 0-14

# Description Value Comments

42
Ladder

SI 0 Scan Time, Resolution: Units of Updated by the controller at the A scan is a complete execution of the
10 mSec end of every scan. controller's entire program: reading inputs,
executing the Ladder program, updating the
outputs, running the HMI program,and
processing communications.
Scan time depends on the size and complexity of
the application. Check the topic Program
Sequencing: Modules, Subroutines, Labels &
Jumps.

SI 6 Current key pressed

SI 7 LCD Contrast Control 0=Minimal Contrast


50=Medium Contrast
100=Maximal Contrast

SI 8 Unit ID (Network) The ID # 1 is assigned by To learn how to use this operand, check the
default. topic Assigning a Unit ID number
SI 9 LCD Backlight intensity 0 - 0ff
1 - On (low intensity) (V230
only)
2 - On (max. intensity) -
Default
SI 14 Current controller temperature Includes decimal point. For example, if the
value is 245, the actual value is 24.5.

Real Time Clock, SIs 30-34

# Description Value Comments

SI 30 Current second According to RTC

SI 31 Current time

SI 32 Current date

SI 33 Current year

SI 34 Current day

Touch Coordinates

# Description Value Comments

SI 40 Touchscreen is being touched- If the screen is touched, SI 40 When the screen is not touched, SI 40 = -1
X coordinates shows the current location on the X
axis.

SI 41 Touchscreen is being touched-Y If the screen is touched, SI 41 When the screen is not touched, SI 41 = -1
coordinates shows the current location on the Y
axis.

INFO delay time, SI 50

# Description Value Comments

43
VisiLogic Software Manual - Ladder

SI 50 INFO delay time Default by O/S (every • Units: seconds.


power up) = 4 seconds
• Legal values: 0, 3 to 20.
• If you force or store '0' into equal Zero – INFO is disabled.
• For V290 – Touching the <i\> key on the touch screen starts
Info Mode – Touching a legal Ladder application variable clears
the INFO time.

COM Port: Port/Modem Status, Error codes, SIs 80-85

Each COM Port is linked to 2 SIs; their values and messages are indicted below.

SI 80 Modem Status: COM


1 Error (SI 81,83,85,) Status ( SI 80, 82, 84)

Value Message Value Message


SI 81 Error Code: COM 1

0 No error 0 Modem Idle

SI 82 Modem Status: COM


2
1 TimeOut exceeded: no reply 1 Initialization in Progress

2 Reply Error 2 Initialization OK


SI 83 Error Code: COM 2

3 Wrong PIN number 3 Initialization Failed

SI 84 Modem Status: COM


3
4 Registration failed 4 Modem Connected

SI 85 Error Code: COM 3


5 PUK number needed 5 Hang-up in progress

10 COM Busy 6 Dial in progress

11 Reply Busy

12 Reply No Dial

15 Attempted Initialization during active


break signal. Note that a port cannot be
initialized while the break signal is
active

Max. Delay between characters, MODBUS + Modem, SI 100

44
Ladder

SI Description Value

100 Maximum Time When MODBUS (Serial) is configured to a port linked to a modem, the MODBUS
Delay between function checks SI 100. If SI 100 = 1, a time interval of up to 2.5 msecs is permitted
characters (units between characters, if SI 100 contains 2, the permitted interval is 5 msecs ( n x 2.5
2.5ms) MODBUS + =interval).
Modem Note that:
- The power-up value is 1,
- the application must update SI 100 before the MODBUS configuration is activated.

Ethernet-enabled controllers only, SIs 141-148

Parameter Description Value Comments

SI 141 Ethernet Socket 0: Protocol Type • 0=PC application (Read-only)


(default) Sockets are set to Protocol Type 0 by
• 1=MODBUS default. Activating MODBUS
SI 142 Ethernet Socket 1: Protocol Type
Configuration changes the Protocol
Type to 1.
SI 143 Ethernet Socket 2: Protocol Type

SI 144 Ethernet Socket 3: Protocol Type

Parameter Function
SI value Message

0 Initialized to UDP, status: Closed

S1 145 Socket 0: Status


2 Initialized to TCP, status: Listen

SI 146 Socket 1: Status


14 Initialized to UDP, status: Ready

15 Initialized to UDP, status: Engaged in


Transmit/Receive
SI 147 Socket 2: Status

SI 148 Socket 3: Status

GSM Cellular Modem, GSM Signal Quality, SI 185

SI Description Value

185 GSM Signal Quality • The value is written during COM Init of the GSM modem. The value is
updated whenever the user uses the GSM Signal Quality FB.
• A value of -1(FFFF) signifies a modem error. This may be due to a weak
signal; try repositioning the antenna. If this has no effect, check the
modem.

45
VisiLogic Software Manual - Ladder

CANBUS, SIs 200-201, 236-237, 240-243

SI 200 CANbus Network operand

SI 201 CANbus Network operand

SI 236 CANbus Network communication error


code Value Message

1 No Acknowledgement

2 CANbus OFF

4 CANbus Warning error

10 ISC receiving TimeOut

SI 237 CANbus Network: failed unit ID

SI 240 SIs 240-243 comprise a bitmap indicating which unit is in error. If, for example, the network includes unit ID
numbers 8, 9 and 13, and PLC #9 cannot be accessed, then the ninth bit in SI240 will turn ON. When the error is
SI 241 fixed, the bit falls to OFF

SI 242

SI 243

HMI Displays, SIs 249-252

SI 249 Last Active Keypad Entry Variable Contains the ID number of the last active variable.

SI 250 Currently active keypad entry, Currently active keypad entry, read/write.
read/write When either SB 250' Keypad Entry Within Limits' or SB251 'Keypad Entry
Exceeds Limits' turn ON, the index number of the variable is stored here. As
you navigate between variables, as for example with the right-left arrow keys,
SI 250 will show only the numbers of variables that have not been completed.
Note • A value of -1 indicates that, in this particular display, the user has
pressed Enter for all the Keypad Entry variables in the Display.

SI 251 Previous HMI Display Number

SI 252 Current HMI Display Number To see a list of Displays in a project together with their Display numbers,
select HMI Information from the View menu.

Info Mode, SI 253

SI 253 Password: Info Mode Note that at every power-up, the default password to Info Mode, 1111, is
restored. To maintain a different password after power-up, use SB 2-Power-up
as a condition to store the desired password value into SI 253.
The password may also be modified by accessing the controller via VisiLogic,
then running On-line Test mode and changing the value. This value will be
erased at power-up.

46
Ladder

Error, General, SI 500

SI 500 General Error


Value Message

3 7FFF or 8000 (integer result)FFFF or


0000(unsigned integer result)

4 +INF or -INF (float result)

5 0.0 (float result)

7 +INF or -INF or NaN (float result)

9 NAN (float result)

10 0 (integer result)

11 Floating point stack underflow

12 Floating point stack overflow

User Stack Depth, SI 503

SI 503 User Stack Depth

System Long Integers


SL 4 Divide Remainder (signed divide function)
System Double Words
# Description Value Comments
SDW 0 10mS counter

SDW 2 SDW 2 Cycle Counter Increments by 1 every program cycle

SDW 3 2.5 mS counter

SDW 4 Divide Remainder Unsigned divide function

SDW 5 Expansion module short


circuit bitmap

SDW 6 Snap-in module short circuit


bitmap

SDW 10 Keypad entry variable value When a keypad entry variable value is
entered, this SDW 10 holds the value.

SDW 13 Phone number of last last 9 digits


received SMS

SDW 14 Socket 0: Number of sent Updated after each data transmission via
transmissions Socket 0

SDW 15 Socket 1: Number of sent Updated after each data transmission via

47
VisiLogic Software Manual - Ladder

transmissions Socket 1

SDW 16 Socket 2: Number of sent Updated after each data transmission via
transmissions Socket 2

SDW 17 Socket 3 : Number of sent Updated after each data transmission via
transmissions Socket 3

SDW 18 Socket 0: Number of Updated after each data packet received


received transmissions via Socket 0

SDW 19 Socket 1: Number of Updated after each data packet received


received transmissions via Socket 1

SDW 20 Socket 2: Number of Updated after each data packet received


received transmissions via Socket 2

SDW 21 Socket30: Number of Updated after each data packet received


received transmissions via Socket 3

SDW 30 Variable display bitmap, The value is checked when a display is When a bit is ON, the corresponding
0=Normal, 1=Inverse (or entered. variable is displayed in inverted
negative) It is initialized to 0: (negative) color; black pixels are changed
to white and white to black.
- At Power-up.
- When the program exits the Display.

SDW 31 Hide Var The value is checked when a display is When a bit is ON, the corresponding
entered. variable is hidden
It is initialized to 0 at:
- Power-up.
- When the program exits the Display.

SDW 60 Info Error Status Error Indication

On-line Test (Remote Access) Mode, SI 86,88

These SIs enable the controller to send SMS messages when the controller is in On-line Test (Remote Access)
mode. The SIs do not need to be used in the application because the process is transparent to the user.

SI Description

86 Modem Connection Status: COM 1

87 Modem Connection Status: COM 2

88 Modem Connection Status: COM 3

Network Operands-Communicating Data Via CANbus


When a controller is integrated into a CANbus network, the data contained in certain system operands is
continuously broadcast to the network, together with the controller's unique ID number. The data is contained in
16 System Bits (SB 200 to SB 215( 16 Inputs (I 0 to I 15), and 2 System Integers (SI 200 and SI 201).

In order to enable a networked controller to read the values from another networked controller, place the desired
function in the net. In the Select Operand Address box, click on the Network tab, then select the ID of the target
controller and the desired operand.

48
Ladder

Functions
Placing a Function in a Net

1. Select any type of Ladder function by:


Selecting it from the Ladder toolbar, -or-
Selecting it from the Ladder menu, -or-
Right-clicking on the Ladder to display the Ladder menu and then selecting the function.
2. Move the function to the desired net location, then click.

3. Link operands using the Select Operand and Address.

49
VisiLogic Software Manual - Ladder

FBs Library
Unitronics offers an FB library for advanced functions, such as SMS messaging and MODBUS
communications. FBs that are currently installed in VisiLogic are listed under the FB's menu.

Note • You must use a condition (RLO) to activate any FB that requires Configuration in your
application, such as MODBUS or SMS.

To install an updated FB library, select Update from the Web from the FBs menu or Help menu, then follow the
on-screen instructions. Note that at the end of the download, you must close and then restart VisiLogic. The new
FBs will appear on the FBs menu.

Note • To enable Live Update, you can select to use a proxy server in Project Properties.

Use Function Block Information, located on the View menu, to check:

Which FBs are installed in your library.


Which FB versions are installed, which versions are used in the open project, and to manage FB
versions.
FB memory usage.

50
Ladder

FB Library

Versions Used

FBs List

Trends: Real-Time HMI Graph

Draw Axis

PID FB

Events

51
VisiLogic Software Manual - Ladder

MB as PWM

Loadcell

Filter

MODBUS, serial

MODBUS, IP

SMS Messaging

GPRS

Communication Protocol

Compare Functions
Compare Functions
A compare function compares two values according to the type of function you select.

If the comparison is true (logic 1): power flows through the block.

If the comparison is false (logic 0): power does not flow through the block.

There are 6 types of Compare Functions:

Greater Than
Greater Than or Equal To
Equal To
Not Equal To
Less Than or Equal To

Note • The Vector menu includes a Compare Vector function.


These values may be compared:

Memory Integer (MI)


Memory Long Integer (ML)
Double Word (DW)
System Operands:(SI) (SL)(SDW)
Network System Integer (NSI)
Constant Value #

Equal
The Equal function block compares the value of input A to input B.

If input A is equal to input B : power will flow through the function block.

If input A is not equal to input B: power will not flow through the function block.

52
Ladder

According to the above example:

If MI 1 is equal to MI 3; then MB 55 will go to logic "1" (ON).


If MI 1 is not equal to MI 3; then MB 55 will go to logic "0" (OFF).
These values may be compared:

Memory Integer (MI)


Memory Long Integer (ML)
Double Word (DW)
System Operands:(SI) (SL)(SDW)
Network System Integer (NSI)
Constant Value #

Greater or Equal to
The Greater Than or Equal function block compares the value of input A to input B.

If input A is greater than or equal to input B: power will flow through the function block.

If input A is not greater than or not equal to input B: power will not flow through the function block.

According to the above example:

If MI 1 value is greater or equal to constant integer 35; then MB 50 will go to logic "1" (ON).
If MI 1 value is not greater or equal to constant integer 35; then MB 50 will go to logic "0"
(OFF).
These values may be compared:

53
VisiLogic Software Manual - Ladder

Memory Integer (MI)


Memory Long Integer (ML)
Double Word (DW)
System Operands:(SI) (SL)(SDW)
Network System Integer (NSI)
Constant Value #

Greater Than
The Greater Than function block compares the value of input A to input B.

If input A is greater than input B: power will flow through the function block.

If input A is not greater than input B: power will not flow through the function block.

According to the above example:

If MI 1 value is greater than 35; then MB 50 will go to logic "1" (ON).


If MI 1 not greater than 35; MB 50 will go to logic "0".

Note • Greater and Less Than function blocks do not give an output when input A equals input B.
These values may be compared:

Memory Integer (MI)


Memory Long Integer (ML)
Double Word (DW)
System Operands:(SI) (SL)(SDW)
Network System Integer (NSI)
Constant Value #

Less or Equal to
The Less Than or Equal To function compares input A to input B. The function is located on the Compare
menu.

If input A is less than or equal to input B: power will flow through the function.

If input A is not less than or equal to input B: power will not flow through the function.

54
Ladder

According to the above example:

If MI1's value is less than or equal to MI3's value, then MB 51 will go to logic "1" (ON).
If MI1's value is less than or equal to MI3's value, then MB 51 will go to logic "0" (OFF).
These values may be compared:

Memory Integer (MI)


Memory Long Integer (ML)
Double Word (DW)
System Operands:(SI) (SL)(SDW)
Network System Integer (NSI)
Constant Value #

Less Than
The Less Than function compares input A to input B. The function is located on the Compare menu.

If input A is less than input B: power will flow through the function.

If input A is not less than input B: power will not flow through the function.

According to the above example:

If MI 1 value is less than constant integer 35; then MB 60 will go to logic "1" (ON).
If MI 1 values is not less than constant integer 35; MB 60 will go to logic "0" (OFF).
These values may be compared:

55
VisiLogic Software Manual - Ladder

Memory Integer (MI)


Memory Long Integer (ML)
Double Word (DW)
System Operands:(SI) (SL)(SDW)
Network System Integer (NSI)
Constant Value #

Not Equal
The Not Equal function evaluates input A to see if its integer value is not equal to input B. The function is
located on the Compare menu.

If input A is not equal to input B: power will flow through the function.

If input A is equal to input B: power will not flow through the function.

According to the above example:

If MI 1 is not equal to MI 3; then MB 65 will go to logic "1" (ON).


If MI 1 is equal to MI 3; then MB 65 will go to logic "0" (OFF).
These values may be compared:

Memory Integer (MI)


Memory Long Integer (ML)
Double Word (DW)
System Operands:(SI) (SL)(SDW)
Network System Integer (NSI)
Constant Value #

Logic Functions
Logic Functions
Function blocks are provided for:

56
Ladder

Bit Test
Set/Reset Bit
AND
OR
XOR
Shift
Rotate
Convert
Test Bit
Store Bit Status
Load Bit Status
RS-SR Flip-Flop
The internal operation of a function block is transparent to the user. You select input operands; the result is
automatically output by the function block.

The input values in a logic function may be:

Memory Integer (MI)


Memory Long Integer (ML)
Double Word (DW)
System Operands:(SI) (SL)(SDW)
Network System Integer (NSI)
Constant Value #
With the exception of Constant Value, any of these operands may be used to contain the output value.

The functions are located under the Logic menu on the Ladder toolbar.

AND
The AND logic function evaluates the state of two integers.

If a bit is true (logic 1) in both input A and B, then the output C will be true (logic 1).
If input A and B is false (logic 0), then the output C will be false (logic 0).
If either input A or B is false (logic 0) - the output C will be false (logic 0).

The input values in an AND function may be:

Memory Integer (MI)


Memory Long Integer (ML)
Double Word (DW)
System Operands:(SI) (SL)(SDW)
Network System Integer (NSI)
Constant Value #
With the exception of Constant Value, any of these operands may be used to contain the output value.

57
VisiLogic Software Manual - Ladder

AND can be used to mask out certain bits of an input integer not relevant to a given function.

Example:

If a clock function block uses the first bit of a 16-bit word to decide if a given time is A.M. or P.M., you can
mask out the other 15 bits. This will tell you if the current time is A.M. or P.M.

All of the non-relevant bits will be turned off (logic 0) except the A.M. / P.M. bit.

The function is located under the Logic menu on the Ladder toolbar.

OR
The OR logic function block can evaluate the state of two integers to see if either input A or B is true. If input A
OR B is true - the output C will be true (logic 1). If both input A and B are true (logic 1) - the output C will also
be true (logic 1).

The input values in an OR function may be:

58
Ladder

Memory Integer (MI)


Memory Long Integer (ML)
Double Word (DW)
System Operands:(SI) (SL)(SDW)
Network System Integer (NSI)
Constant Value #
With the exception of Constant Value, any of these operands may be used to contain the output value.

The function is located under the Logic menu on the Ladder toolbar.

XOR
The XOR logic function block can evaluate the state of two integers to see if input A and B are equal. If either
input A OR B is true - the output C will be true (logic 1). If both input A and B are true (logic 1) - the output C
will be false (logic 0). If both input A and B are false (logic 0) - the output C will be false (logic 0).

The input values in a XOR function may be:

59
VisiLogic Software Manual - Ladder

Memory Integer (MI)


Memory Long Integer (ML)
Double Word (DW)
System Operands:(SI) (SL)(SDW)
Network System Integer (NSI)
Constant Value #
With the exception of Constant Value, any of these operands may be used to contain the output value.

Use XOR to recognize changes in an integer to check for integer bit corruption. If 2 integers are equal: the result
will return logic 0. If there has been bit corruption: the corrupted bit will return logic 1.

The function is located under the Logic menu on the Ladder toolbar.

Shift
The Shift function moves the bits in an integer to the left or to the right. Note that any bit shifted out cannot be
recovered.

Shift Right

60
Ladder

Operand A: contains the value to be shifted.


Operand B: contains the number of bits to be shifted (one or more).
Operand C: contains the resulting value.
Operand D: shows the status of the final bit in the integer after the operation, regardless of the
number of bits shifted out during the operation.

Note that regardless of the number of bits shifted out, Operand D shows the sta

The Shift function may be performed on values contained in the following operands:

Memory Integer (MI)


Memory Long Integer (ML)
Double Word (DW)
System Operands:(SI) (SL)(SDW)
The functions are located under the Logic menu on the Ladder toolbar.

Rotate
The Rotate function moves the bits in an integer to the left or to the right.

Operand A: contains the value to be rotated.


Operand B: contains the number of bits to be rotated.
Operand C: contains the resulting value.
Operand D: shows the status of the final bit in the integer after the operation.

The Rotate function may be performed on values contained in the following operands:

61
VisiLogic Software Manual - Ladder

Memory Integer (MI)


Memory Long Integer (ML)
Double Word (DW)
System Operands:(SI) (SL)(SDW)
The functions are located under the Logic menu on the Ladder toolbar.

Vector: Bit to Numeric, Numeric to Bit


Use these functions to convert an array of bit values to a numeric value, or a numeric value to an array of bits.

The functions are located on the Vector menu.

Bit to Numeric
Operand A: contains the Start Address for the array of bits to be converted.
Operand B: is the start of the vector that will contain the converted value. Take care in
addressing operands, since the converted value may not fit into a single register; the function will
overwrite as many consecutive registers as it requires to convert the value.
Operand C: contains the length of the bit array that will be converted.

Numeric to Bit
Operand A: contains the Address of the value to be converted.
Operand B: contains the Start Address of the bit array that will contain the converted value.
Operand C: contains the Length of the bit array that will contain the converted value.

Test Bit
Test Bit enables you to select a bit within a vector of registers, and store its status in an MB.

62
Ladder

Operand A, Start of Vector, determines the start of the vector of registers.


Operand B, Offset in Vector, selects the bit within that vector.
Operand C, Target Bit, determines where the value of the selected bit will be stored.

The function is located under the Logic menu on the Ladder toolbar.

Set/Reset Bit
Set Bit enables you to select a bit within a vector of registers, and set it.

Reset Bit enables you to select a bit within a vector of registers, and reset it.

Operand A, Start of Vector, determines the start of the vector of registers.


Operand B, Offset in Vector, selects the bit within that vector.

The functions are located under the Logic menu on the Ladder toolbar.

Store Bit Status


Use this to select an MB and store its status in an MB within a defined vector.

63
VisiLogic Software Manual - Ladder

Operand A, Start of Vector, determines where the vector begins.


Operand B, Offset in Vector, selects the target bit within that vector.
Operand C, Bit Value, determines the source bit. The status of this bit will be stored into the
target bit within the defined vector.

The function is located under the Logic menu on the Ladder toolbar.

Load Bit Status


Use this to select an MB within a defined vector and load its status in an MB outside of that vector.

Operand A, Start of Vector, determines where the vector begins.


Operand B, Offset in Vector, selects the source bit within that vector.
Operand C, Bit Value, determines the target bit--where the value of the source bit will be stored.

The function is located under the Logic menu on the Ladder toolbar.

RS-SR Flip-Flop
The RS and SR Flip-Flop functions are located on the Logic menu. These functions compare the logic state of
two inputs, and use the result to determine an output result in accordance with the tables shown below.

RS Flip-Flop SR Flip-Flop

64
Ladder

Binary Numbers
Memory Integers and System Integers are 16-bit binary numbers. You enter decimal numbers into Memory
Integers and System Integers. The program converts these decimal numbers into binary numbers and performs
the specified functions.

You may want to use a logic function to mask out bits or check for bit corruption. You can do this by using a
decimal number that converts to the appropriate binary number. The following charts will help you understand
why the decimal numbers {0,1,2,4,8,16,32,64,128, etc} were chosen for use with logical OR to evaluate keypad
input numbers in the following example.

65
VisiLogic Software Manual - Ladder

66
Ladder

67
VisiLogic Software Manual - Ladder

Math Functions
Math Functions
You perform mathematical functions by placing math functions in a net. Math functions, located on the Math
menu are provided for:

Increment/Decrement
Addition
Subtraction
Multiplication
Division
Square Root
Power
Factor
Linearization
Each type of math function can use up to 8 input values to compute a single sum.

The internal operation of a function block is transparent to the user.

The example below shows an Add function block with 2 input values.

68
Ladder

The operands listed below can be used to provide both input and output values, with exception of Constant
Values. Constant values can provide input values, but can not contain output values.

Memory Integer (MI)


Memory Long Integer (ML)
Double Word (DW)
System Operands:(SI) (SL)(SDW)
Network System Integer (NSI)
Constant Value #

Multiple Input Values in Math Functions


You can input up to 8 values into a math function block. The function will output a single sum. This example
shows an Add function that uses 5 input values.

1. Click on the Math button on the Ladder toolbar.


-or-
Right-click on the Ladder to show the Ladder pop-up menu.
2. Select More..., then select the desired function type.
3. Click on the function with the desired number of input values.

4. Move the function to the desired net location, then click. The net automatically enlarges to fit the function

69
VisiLogic Software Manual - Ladder

5. Link operands using the Select Operand and Address dialog box. The dialog box opens automatically
until all input values and the output value have been linked.

Add
The math function Add is executed by the Add function block shown below. You can choose to add up to 8
input values of the following operand types:

Memory Integer (MI)


Memory Long Integer (ML)
Double Word (DW)
System Operands:(SI) (SL)(SDW)
Network System Integer (NSI)
Constant Value #
With the exception of Constant Value, any of these operands may be used to contain the output value.

The example below shows an Add function with two input values.

Divide
The math function Divide is executed by the Divide function block shown below. The input values in a Divide
function may be:

70
Ladder

Memory Integer (MI)


Memory Long Integer (ML)
Double Word (DW)
System Operands:(SI) (SL)(SDW)
Network System Integer (NSI)
Constant Value #
With the exception of Constant Value, any of these operands may be used to contain the output value.

T
This Divide function can only return whole numbers. To divide floating point numbers, use the Divide function
on the Float menu.

Signed remainder values are stored in SL 4 - Divide Remainder (Signed); unsigned results are stored in SDW 4
Divide Remainder (Unsigned).

Note that you must store the remainder values immediately after the division function because these registers
will be overwritten by the next division function.

Values may not be divided by zero. In the event that this occurs, System Bit 4 (SB 4 - Divide by Zero) turns ON.

Multiply
The math function Multiply is executed by the Multiply function block shown below. You can choose to
multiply up to 8 input values of the following types:

Memory Integer (MI)


Memory Long Integer (ML)
Double Word (DW)
System Operands:(SI) (SL)(SDW)
Network System Integer (NSI)
Constant Value #
With the exception of Constant Value, any of these operands may be used to contain the output value.

The example below shows a Multiply function with two input values.

71
VisiLogic Software Manual - Ladder

Subtract
The math function Subtract is executed by the Subtract function block shown below. The function is located on
the Math menu.

The input values in a Subtract function may be:

Memory Integer (MI)


Memory Long Integer (ML)
Double Word (DW)
System Operands:(SI) (SL)(SDW)
Network System Integer (NSI)
Constant Value #
With the exception of Constant Value, any of these operands may be used to contain the output value.

Linearization, Vector Linearization


The Linearization functions, located on the Math menu, enable you to convert values. Use them, for example, to
convert analog input values to a values in degrees Celsius.

Linearize a Single Value


This function linearizes a single source value, then stores it in the target register.

72
Ladder

If, for example, X1 and Y1 are 0, and


X2=100 while Y2=1023, the output value
will be linearized as graphed.

These values would cause:

A temperature input of 1000


C to be converted to 1023
Digital value.
A temperature input of 500
C to be converted to 512
Digital value

Linearize a Vector of Values


This function linearizes a vector of source values, then stores the values in the target vector.

You can convert values contained in the following operand types:

73
VisiLogic Software Manual - Ladder

Memory Integer (MI)


Memory Long Integer (ML)
Double Word (DW)
System Operands:(SI) (SL)(SDW)
With the exception of Constant Value, any of these operands may be used to contain the output value.

Linearizing Analog I/O values

Note • Analog output values are contained in the register that you link to the output in Hardware
Configuration.

Working within the 4-20mA range

Available ranges, according to controller and I/O module, are shown in the topic Analog I/O ranges. Note that
devices used in conjunction with the controller must be calibrated accordingly. In the examples below, the
analog device is a pressure transducer; values are therefore translated to millibars.

10-bit Analog Input, V200-18-E1

12-bit Analog Output,IO-A14-AO2

74

You might also like