Visilogic Software Manual-Ladder Parte1
Visilogic Software Manual-Ladder Parte1
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
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.
1
VisiLogic Software Manual - Ladder
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.
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
4
Ladder
Using Labels
5
VisiLogic Software Manual - Ladder
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.
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
9
VisiLogic Software Manual - Ladder
Open a Subroutine
To open a Subroutine for editing:
10
Ladder
In Ladder Diagram, all external input values such as those associated with contacts are gathered before each net
is evaluated.
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
Coils
Direct Coil
Set Coil
Reset Coil
Toggle Coil
Compare
Greater Than
Greater/Equal
Equal
Not Equal
Less/Equal
Less Than
Math
Add
Subtract
12
Ladder
Multiply
Divide
Linearization, vector
Factor
Power
Square Root
Increment/Decrement
Floats
Compare: Greater Than, Greater Equal, Equal, Not Equal, Less Equal, Less Than
Logic
AND
OR
XOR
Shift Left/Right
Rotate Left/Right
Bit Set/Reset
Bit Test
RS-SR Flip-Flop
Clock
Time
Day Of Week
13
VisiLogic Software Manual - Ladder
Day Of Month
Month
Year
Store
Vector
Load
Find
Get Max
Get Min
Calls
Jump to Label
14
Ladder
Call Subroutine
Subroutine Return
Strings
Transpose
Num to ASCII
IP to ASCII
Data Tables
Read/Write
Direct Read/Write
Immediate Elements
For information regarding advanced functions, such as MODBUS, check the topic FBs Library.
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
-or-
Select Cut or Copy from the Edit menu.
16
Ladder
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).
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.
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.
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
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.
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.
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
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
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.
25
VisiLogic Software Manual - Ladder
System Operands
System Operands are connected to certain functions and values in the controller's operating system.
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:
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.
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.
27
VisiLogic Software Manual - Ladder
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).
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.
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.
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
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
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
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.
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.
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.
32
Ladder
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
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
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 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
33
VisiLogic Software Manual - Ladder
SB 3 1 second pulse
SB 4 Divide by zero
SB 6 Keyboard is active
SB 7 100 mS pulse
SB 8 Battery low
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 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
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.
OnLine Test SB 35
SB 35 OnLine Test Point During OnLine mode, Single Scan, One or none instances are
35
VisiLogic Software Manual - Ladder
INFO mode, SB 36
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
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
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
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
37
VisiLogic Software Manual - Ladder
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.
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
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.
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.
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.
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
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.
SB 132 COM Port 1, Data Transmission During data send When data is not being sent OS
SB 135 COM Port 1, Data Receive During data reception When data is not being received OS
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.
39
VisiLogic Software Manual - Ladder
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
To learn how to use these operands to communicate data, check the topic CANbus Networking.
41
VisiLogic Software Manual - Ladder
To learn how to use these operands to communicate data, check the topic Limit Keypad Entry.
By program or
SB 300 Reset PLC Reset is run OS
Remote Access
Turns OFF
# Description Turns ON when: Reset by:
when:
Buzzer
SB 310 By user By user User
Turn this ON to sound a buzzer
System Integers
General, SIs 0-14
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 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.
SI 31 Current time
SI 32 Current date
SI 33 Current year
SI 34 Current day
Touch Coordinates
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.
43
VisiLogic Software Manual - Ladder
Each COM Port is linked to 2 SIs; their values and messages are indicted below.
11 Reply Busy
12 Reply No Dial
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.
Parameter Function
SI value Message
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
1 No Acknowledgement
2 CANbus OFF
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
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 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.
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
10 0 (integer result)
SDW 10 Keypad entry variable value When a keypad entry variable value is
entered, this SDW 10 holds the value.
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 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.
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
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
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.
50
Ladder
FB Library
Versions Used
FBs List
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.
Greater Than
Greater Than or Equal To
Equal To
Not Equal To
Less Than or Equal To
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
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.
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
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.
Note • Greater and Less Than function blocks do not give an output when input A equals input B.
These values may be compared:
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
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:
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.
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
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.
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 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).
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).
58
Ladder
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).
59
VisiLogic Software Manual - Ladder
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
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:
Rotate
The Rotate function moves the bits in an integer to the left or to the right.
The Rotate function may be performed on values contained in the following operands:
61
VisiLogic Software Manual - Ladder
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
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.
The functions are located under the Logic menu on the Ladder toolbar.
63
VisiLogic Software Manual - Ladder
The function is located under the Logic menu on the Ladder toolbar.
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 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.
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:
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
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:
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.
72
Ladder
73
VisiLogic Software Manual - Ladder
Note • Analog output values are contained in the register that you link to the output in Hardware
Configuration.
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.
74