PLC Programming Guide for S40 V5.02
PLC Programming Guide for S40 V5.02
02
CHAPTER 1
REQUIREMENTS AND OBJECTIVES
Before programming, a basic knowledge of the Moeller programmable logic controller line is necessary.
This quick programming manual is intended to assist the user in getting started with programming the S40 Software.
Version 5.02 in a Windows environment.
CHAPTER 2
STARTING THE SOFTWARE
New
Project
POU
EDITOR
Test and
Commissioning
Form Editor
Topology
Configurator
Display
files
Make files and Library of Files Compile the file Create a new one
Compiled Function blocks optional MAKE current MAKE file
CHAPTER 3
STARTING A NEW PROJECT
Name of
Path of project
project
Open a new
pasta
source directory with the right mouse button: by clicking on New we can create
um novo diretório abaixo de SOURCE. Neste caso vamos chamar este sub-diretório de MOTORC2. .
• If we leave the MOTORC2 directory selected, all our sources will be saved there. In this example, we will
leave the source files saved in SOURCE, to do this click on the SOURCE directory and keep it selected.
• A single project can contain various software and different configurations.
CHAPTER 4
STARTING A SETUP
• The second step is to configure the hardware. This should be specified using the Topology Configurator.
• As soon as the Topology Configurator window opens, we select: ConfigurationÆ New...
• In the File Name field, type the following name: Master1, and in CLP Type, we click on the name presented and
we selected the CPU that we are using.
File name of
configuration
CPU model
• Through the Edit item, we can choose to add remote expansion modules, local expansion, or configure this CPU.
CPU network data, or through the icons on the screen itself, this data is more detailed in the Manuals.
Network Cycle
Create new
configuration Zoom
Parameterize element
Save
Module addressing
Configuration
CHAPTER 5
STARTING TO PROGRAM
• In the Navigator, we now select the desired CPU family, in our case we will choose the PS4-300 family.
Syntax
Locate Replace Check
text text
Control of New line New line in Ladder The Editor FBD Editor
Zoom in FBD
ST Editor Ladder Editor
• The software is capable of automatically generating the I/O addresses based on the previously created topology. Let's
select Yes.
.
• Now we choose the topology corresponding to this program, in our case it will be the file [Link]
• The area for variable declaration can be used in two distinct modes, Syntax Controlled and FREE MODE.
In the figure above, we are using the Syntax Controlled, which is the best option when you are a beginner. If your program
if it is not in Syntax Controlled just select this option in your tools menu.
• Remember that the variables that the program imports from its topology are in the Global folder!
• The programming area has four available programming forms: programming with logic blocks (FBD)
Ladder programming (LD), instruction list programming (IL), and structured programming (ST).
• Through the Windows menu, we can still select how we will view this screen. If we select
WindowsÆ Rotate, we will make a spin on the screen, the variable declaration will go to the left side of the screen, and the program
will remain on the right side of the screen. Through the Windows optionsÆ Tile Vertically and WindowsÆ Tile Horizontally,
DECLARING VARIABLES
Variables are usually declared before being used. The declaration consists of the variable name and the type of
data. Depending on the type of data assigned to a variable, there is a range of permissible values. For example: the type of
The SINT type has 8 bits and can take values between -128 and 127, while the USINT type, which also has 8 bits, can take
values between 0 and 255.
The elementary data types defined by IEC1131-3 are:
Binary one or several bits in a group of binary operations.
Integer all integers.
Real floating point numbers. (Only PS4-300 and PS416)
String alphanumeric character set.
Date/Time dates, time of day and date and time.
Along with the size of the variable and its range of values, data types also determine what types of operations are
allowed for these variables, for example, a variable of type Integer can only be used in arithmetic functions, while a
Binary type variable can only be used in logical functions.
This solves the problem of the operator who tests different types of data in the application. Frequent errors can be
easily recognized with a quick observation of the program. We have the following data types described below:
That is, if we want to do Boolean logic we should use variables of type: BOOL, Byte, or Word; if it is
to perform arithmetic functions we use variable types such as: INT, SINT, USINT, etc.
In this version of the S40, the I/Os are already declared in the Global field.
• Note that the software automatically places the name of the module to which the I/Os belong on the comment side (Comment).
They belong. If we had other modules connected to the CPU, their addresses would also appear, with their respective
code in the comment.
• Now it is necessary to declare our income / expenses, first let's locate our address. Suppose that
we want to use the first input of the CPU. Its address will be %I0.[Link], see the diagram below:
• We want a digital input, so the address starts with %I, the input is in the CPU (0.0.0), we want byte 0 and it is
the first bit that interests me (0.0).
• Write in the 'Name' field the name of this variable, which will be 'Partida'. It is prohibited to use characters in variable names.
special characters like: !#$%&*()-+/?<>.;,\|
• Variable names can have up to 30 characters, try to use self-explanatory names to make it easier at the time of
start-up. If they are compound names, try to write with Underline, for example: BOMB_RECALQUE or then
Recirculation Pump.
• Let's now declare the other variables necessary for the functioning of our triangle star program, declare
the other variables are as follows below:
NOTE: When we declare a Tag and specify only the type, for example BOOL, and do not specify the address, the
the compiler itself determines that it is a Flag because it does not have physical Input/Output, so it automatically reserves
a memory area for this Tag. However, if it is necessary to relate this Tag to a known memory (for communication
with a HMI for example) the addressing is done as follows:
TAG1 BOOL M0.[Link]
Name_2 BYTE MB0.0.0.0
Any_name WORD MW0.0.0.0
• Now we will place a label contact, so select the contact from the variable Match.
• Now choose the parallel contact option:
Contact series Open Closed series contact Parallel Contact Open Closed Parallel Contact
• Right after the appearance of the contact, we named it the variable, Stop.
• To place a comment on this line, simply click the Insert Network Comment option: .
• Now we need to turn on the other contactors. To perform the Star-Delta starting, two are needed.
timers, one to determine the time for the change between the star contactor and the triangle and another that waits for a
circuit breaker to activate another. But it is necessary to declare them before using them.
Available libraries
• Now let's write the rest of our program, we will include the lines that trigger the others.
counters.
• Edit the following lines in Ladder:
• Put the name motor and save it in the Source folder of your project. The S40 automatically opens this path for you.
• The final program is as follows:
• Now select the option Create a new MAKE file in the Navigator toolbar, .
Name of
Source program
Name of
configuration
• By pressing OK we will create a new MAKE file. The name of this file will appear in the upper window of
Navigator: .
• The lower window of the Navigator is the message area, every time an error occurs while we are generating.
a new file, or else when we are compiling our program, this error will appear in this window. If
no error occurs during the generation of the MAKE file, the following message will appear: .
• We now select the option PLC Programming Parameters, .
• The window changes according to the CPU model we are using, see below the windows corresponding to the CPUs of
família PS4-200.
Access password to
program
Program version
of the user
Maximum time of
allowed cycle
Area of
memories
retentives
Area of
memories of
recipe
Type of execution:
Cyclical or periodic
Program version
of the user
Maximum time of
allowed cycle
Area of
memories
retentive
Area of
memories of
recipe
• When we create a program that uses defined memory addresses, we must create an area of active memory.
• The CPU has a three-position switch, in the HALT position whenever the CPU is turned on it will enter HALT mode.
If the key is placed in the RUN position and the CPU is turned on, all memories configured as retentive and recipes
will be preserved, that is, its content will not be destroyed. And lastly, if the key is in the RUN M-RESET position and
a CPU for linked, only the recipe memories will be preserved, the other memories will be erased. This applies to
any PS4-200 or PS4-300 model.
• In our case, we won't need to declare any memory, just put the version of our in the Runtime Parameters.
program, in this case version 1.00.
• Having done this, we can compile our program, for this we click on the option Compile the current MAKE file, .
• If there are no errors in our program, the following message will appear in the lower window of the Navigator:
• If there is an error, a red message will appear, just click on this message and the POU Editor window will open.
reopen and select the line that contains the error.
• Once our program has been successfully compiled, we can transfer the program to the PLC and start testing.
To hit
watch of
Topology
On-Line CLP
Editor
On-
Connection status Line Type of CPU Serial interface
Speed
from the Door
Connection
via
MODEM
• Let's select the speed of 57600 Baud, remember this is valid for the PLCs of the PS4-300 and PS416 family.
CPUs from the PS4-200 family will always operate at a speed of 9600 Baud.
• So press Connect, The connection status will change from Disconnected for Connected .
• To transfer the program to the PLC click on the Transfer Program option:
Transfer to
FLASH Memory
Compare with
CLP
Type of
file to be
Compare with
displayed
Memory
• Note that a file named 341_206.OSF will appear in the program name field:
• Select now the file you wish to transfer, in our case it is the [Link] file, and then select the
Transfer optionÆCLP.
• Now close this window and turn on the CPU, to do this simply open the top cover of the CPU, place the key in the
position 3 and press the reset button.
• Note that the LEDs located at the top of the CPU indicate that the CPU is now in RUN mode.
System information
operational
Amount of memory
free in the CPU
Program information
• Among other information, we can see that the CPU is in RUN mode, and the CPU switch is in the RUN M RESET position.
we can see how much memory is free etc...
• Through the Program status window we can stop the CPU using the Halt key, or start it again.
we visualize the CPU cycle time, which will be around 1 ms, the size of our program in Code Size, etc...
• In the diagnostics window, we can observe the errors that are active and how many times certain errors have occurred.
occurred.
• If we turn on the network diagnosis and if there is any active diagnosis in this unit, it will appear as follows
below
• To know the current diagnosis of the CPU / Module, select the shaded module and then the option:
Presents current diagnosis,
• Now close the Topology Online window and select the Open Instance tree option,.
e-mail: suporte@[Link]