0% found this document useful (0 votes)
65 views27 pages

PLC Programming Guide for S40 V5.02

The document is a quick guide for programming the S40 V5.02 PLC software, detailing the requirements and objectives for users to effectively start programming. It covers the software's interface, including the POU Editor, Topology Configurator, and the steps to create and compile a new project. Additionally, it explains the declaration of variables and the process of writing programs using various programming languages supported by the software.
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)
65 views27 pages

PLC Programming Guide for S40 V5.02

The document is a quick guide for programming the S40 V5.02 PLC software, detailing the requirements and objectives for users to effectively start programming. It covers the software's interface, including the POU Editor, Topology Configurator, and the steps to create and compile a new project. Additionally, it explains the declaration of variables and the process of writing programs using various programming languages supported by the software.
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

SUCOSOFT S40 V5.

02

QUICK GUIDE TO PLC PROGRAMMING


PS4-200, PS4-300, and PS416 lines

Prepared by Danilo J.P. Quintiliano Application Engineering Department Page 1 of 27


INTRODUCTION
In the market, one can find a variety of different programming languages and systems. For each type of
language expensive training is required for all types of controllers, both for the language of
programming as for the operating system.
The user cannot swap program units between different systems because the languages of
programming is not compatible with each other. There is also no file format for the exchange of programs.
It is not possible to reuse programmed functions without requiring reprogramming, as the model of
data from these PLCs requires physical addresses.
Due to the reasons stated above, using a controller from another manufacturer was not viable because of the high cost.
The main objective of IEC1131.3 is to reduce, if not eliminate, all the problems mentioned above, by creating a
structuring and standard programming format, so that the user does not become dependent on the manufacturer.

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

Through the START menu, call the S40.


After the presentation of the Moeller logo, a window called Navigator will open.
Name of CLP Family (PS4-
Copy project Save the Open project
200, PS4-300 and PS416)
project antique Make file
(version
Open previous) Parameters of
project PLC programming

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

Prepared by Danilo J.P. Quintiliano Dept. Engineering Application Page 2 of 27


POU Editor is used to write programs and function blocks. The program can be written in instruction list.
contact diagram and logical blocks and it is also possible to change the different languages according to the needs and
preferences.
TOPOLOGY CONFIGURATOR is used to define the hardware configuration, defining the structure of the entire network.
TEST & COMMISSIONING - it is the environment used to carry out all communications between the PC and the PLC. In this,
it is possible to transfer the program to the PLC, stop or start the PLC, modify the program online and test the
logical sequences.
FORM EDITOR - is used to view and edit the program documentation. It is possible to define sheets through this.
standard with logos and designs of the company.

The necessary steps for creating a program are:

• Create a new project


• Configure the Hardware
• Create the necessary source files (POU)
• Create the Variables
• Implement the program logic
• Create a new Make
• Compile the program
• Perform the tests and commissioning
• Transfer the program to the PLC
• Run the program
• Test the program
• Compress and keep the source program in Flash memory to enable the upload. (optional)

CHAPTER 3
STARTING A NEW PROJECT

• Click on the Project menu in the Navigator.


• Select from the Project menuÆ New...or click on

Name of
Path of project
project

Open a new
pasta

Prepared by Danilo J.P. Quintiliano Dept. Eng. Application Page 3 of 27


• Select the path of the new project, or create a new directory to store your projects.
• In our case, type ENGINE and click the OK button.
• All the necessary directories for the creation of a program are already created.
• The Source directory will appear on the Navigator screen inside the Sources folder.
• If desired, we can create other directories to organize our programs. To do this, just click on the

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.

Add Local Module Add Remote Module Remove Module


Open
configuration
I/O usage

Network Cycle
Create new
configuration Zoom

Parameterize element

Save
Module addressing
Configuration

Prepared by Danilo J.P. Quintiliano Dept. Engineering Application Page 4 of 27


• We can still name each element of our configuration; to do this, simply click on the element.
with the right mouse button.

• And now we select the option Name…

• We named our element and clicked OK.


• We save our configuration.
• We clicked on ConfigurationÆ Exit, to leave the Topology Configurator. The file with our configuration will appear.
inside the SOURCE.

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.

• We now select the POU-Editor item.


• As soon as the POU editor opens:
Create new Create new Create new Declaration of Declaration of
Program Function Block Function variables SYNTAX variables
FREE MODE CONTROLLED

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

Prepared by Danilo J.P. Quintiliano Dept. Eng. Application Page 5 of 27


• We now select the option to Create a new Program.

• 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]

Variable Name Variable type Initial Value Attributes Address of


variable

Area for variable declaration

Area for programming Comments

• 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,

Prepared by Danilo J.P. Quintiliano Application Engineering Dept. Page 6 of 27


we managed to fix the programming screens. This is used when we want to work and visualize more than one
source program each time

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:

Keyword Data type. bits


BOOL boolean number; accepts values of 0 or 1. 1
SINT short integer; with a value range of -128 to 127. 8
INT integer; with a range of values from -32768 to 32767. 16
USINT unsigned short integer; with a range of values from 0 to 255. 8
UINT unsigned integer; with a range of values from 0 to 65535. 16
DINT double integer, with a value range of -231a 231 32 (Under PS4-341 and PS416)
UDINT unsigned double integer, with a range of values from 0 to 232 32 (Subject PS4-341 and PS416)
TIME duration -
DATE data. -
STRING Variable length character set. variable
BYTE sequence of 8 bits. 8
WORD sequence of 16 bits. 16
REAL Floating point number, with values of +/-10+/- 38 32 (Submit PS4-341 and PS416)

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:

Prepared by Danilo J.P. Quintiliano Dept. Eng. Application Page 7 of 27


Line: it is the number of the line where the slave is connected, line 0 is the basic rack, line 1 is the line that comes out of the CPU
The main lines 2 and 3 are the lines that come from the expansion modules connected to the master.
Station: Slave number in the Suconet K network
Module / Slot : ModuleÆ Local expansion number connected to EM4-2XX or PS4.
SlotÆ Slot number in the rack where the card was installed. (PS416)
Byte: Byte number, if the module has more than 16 outputs or inputs, it will have 2 bytes, byte 0 and byte 1.
Bit: This is the bit number, it is the number of the input or output itself, if the declared variable is of type Byte.
In Word, this number will not be presented.
I: Digital Entry IB: Digital input (Byte) IW: Digital Entry (Word)
Digital Output QB: Digital Output (Byte) Digital Output (Word)
IA: Analog Input QA: Analog Output IS: Module status

• 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

Prepared by Danilo J.P. Quintiliano Department of Applied Engineering Page 8 of 27


WRITING THE PROGRAM
• First, let's edit our program in Ladder, so select on the toolbar of the POU Editor the
Ladder Editor option: .
• At this point we are ready to edit our program, let's edit the command line that connects the MainContactor.
• First, select the New Line option in Ladder. . A new line in Ladder will open in the program area:

• To name the contact NA undef_opd, just double-click on it:

• Put the name Match on it.


• It is also possible to enter the name through another procedure, now select the output spool and click with
right mouse button

• Now select the option Insert Variable...

Prepared by Danilo J.P. Quintiliano Dept. Engineering Application Page 9 of 27


• Keep the Variable option selected, in option 1 choose Global, item 2 is a filter. For example, if we write a
letter C in option 2 we will see below all the variables that start with C.
• Now choose the option MainContact.

• Now we will place a label contact, so select the contact from the variable Match.
• Now choose the parallel contact option:

• Now we put in this contact the name of MainContact.


• We just need to add the off button to the logic, for this, just click on the line right in front of our seal. At this point
we selected the option: .

Prepared by Danilo J.P. Quintiliano Dept. Eng. Application Page 10 of 27


• Below we can see the four options available for inserting contacts. If we want to reverse the state of a
Contact already created, just select it and press the space bar on the keyboard, or select the 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.

Prepared by Danilo J.P. Quintiliano Dept. Eng. Application Page 11 of 27


DECLARING FUNCTION BLOCK's
• Let's go back to the Variable Declaration Area, here we will declare a new variable.
• Right-click on the variable declaration area and select the option Insert Variable Declaration...
press F5.

• The following screen will appear:

Available libraries

• Em Select the group deixe ativada a opção Function Block.


• Probably not many libraries will appear in your program, only the manufacturer (Select this), and the User. The
other libraries can be installed later on your computer, see the corresponding manuals for
greater data.
• In item 2, select the Timer function blocks group. Within this group, choose the MS_TimeRising option.
• Item 4 is used to insert the name of this Function Block, in this case DeltaStarDelay, into our program. And finally
In item 5, we determine the scope of this variable; we can leave it as Global or local, either way. (More details)
about variables can be found in the manuals or in the software Help
• For more information about the timers, use the Help of the S40. Press F1 and follow the instructions below,
You will have access to an Online help for all standard function blocks (which come with the S40).

Prepared by Danilo J.P. Quintiliano Dept. Eng. Application Page 12 of 27


• Let's declare another timer, as the PLC is faster than the contactor, if we were to wait...
only the switching time, the triangle contactor could turn on before the other contactor had time to turn off.
• The other timer will be of the same type as the previous one, MS_TimeRising, this time name it: ON_Delay.
• Our statement will be like this:

ENDING THE MOTOR PROGRAM


• Let's now finish our MOTOR program
• Right-click somewhere in the Programming Area, when the window opens, select the option
Insert Variable.

Prepared by Danilo J.P. Quintiliano Dept. Eng. Application Page 13 of 27


• In the folder right above this box, we selected that we will insert a Function Block, in item 1 we chose the scope.
This is the Function Block. If necessary, we have a filter option, option 2, as we have in the variables.
• In our case, choose the DeltaStarDelay and then enter ON_Delay. What will appear in the program is:

Prepared by Danilo J.P. Quintiliano Applied Engineering Dept. Page 14 of 27


• At the Set entry of the DeltaStarDelay, we specify who will start the time counting, in our case we should write
MainContactor
• We will not write anything in the ReSet and Hold entries as they will not be used in this program.
• In the PresetTime input, we place the desired time in milliseconds. For example, 10000.
• The OutputControl exit indicates when the desired time has run out. We also left this blank.
• The ElapsedTime output indicates how much time has passed. This field is also blank.
• Let's now fix the other function block, the ON_Delay.
• At the Set input of the ON_Delay block we will write the following: [Link], when we write the
the name of a function block, anywhere in the program, followed by a dot, means that we want to get a
input/output of this: Function_Block_Name.Desired_Entry_Exit
• We will not write anything in the ReSet and Hold entries as they will not be used in this program.
• In the PresetTime input, we enter the desired time in milliseconds. For example, 1000.
• The OutputControl and ElapsedTime outputs will also remain blank.
• See below how the blocks turned out in our program:

• 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:

Prepared by Danilo J.P. Quintiliano Dept. Application Engineering Page 15 of 27


• When we declare one of the contacts as ON_DELAY.OutputControl, this contact will have the same function as the output.
Output control of the ON_DELAY function block. Nothing prevents the programmer from placing a Flag on the output of the
timer and use this Flag in the program.
• Let's now save our program

• 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:

Prepared by Danilo J.P. Quintiliano Dept. Eng. Application Page 16 of 27


• Now we perform a check on the program, for this we use the Syntax Check, .
• If no errors appear, we can close the POU Editor and then move on to the next step of our programming.

Prepared by Danilo J.P. Quintiliano Department of Applied Engineering Page 17 of 27


CHAPTER 6
COMPILANDO O PROGRAMA
• Again on the Navigator screen, note that your MOTOR Program is now also appearing in the file window.
source:

• 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

Programming Parameters of the PLC PS4-200

Prepared by Danilo J.P. Quintiliano Dept. Eng. Application Page 18 of 27


Area of
active memories
do CLP

Area of
memories
retentives

Area of
memories of
recipe

Programming Parameters of the PLC PS4-200

Type of execution:
Cyclical or periodic

Program version
of the user

Programming Parameters of the PLC PS4-300

Maximum time of
allowed cycle

Programming Parameters of the PLC PS4-300

Prepared by Danilo J.P. Quintiliano Dept. Eng. Application Page 19 of 27


Área de
active memories
do CLP

Area of
memories
retentive

Area of
memories of
recipe

Programming Parameters of the PLC PS4-300

• 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.

Prepared by Danilo J.P. Quintiliano Dept. Engineering Application Page 20 of 27


CHAPTER 7
TRANSFERRING THE PROGRAM
• Turn on your PLC and connect it to the computer using the ZB4-303-KB1 cable.

• Call the Test and Commissioning program,. Status of Configuration


Connect with CLP Display CPU status Transfer Program Program from the serial

To hit
watch of
Topology
On-Line CLP
Editor
On-
Connection status Line Type of CPU Serial interface

• Select the type of CPU that we will work with first.


• Define the serial port that you are using.
• If we are working with a PLC from the PS4-200 family, we can skip the next steps and go straight to the
connection, if it is a CPU from the PS4-300 family we can choose the connection speed, this is important because as
it is a CPU of greater capacity, logically, it will have larger programs, thus we can use a
faster connection to save time.
• Click on the Serial Configuration option:

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:

Prepared by Danilo J.P. Quintiliano Dept. Eng. Application Page 21 of 27


Name of Transfer to
program CLP

Transfer to
FLASH Memory

Compare with
CLP
Type of
file to be
Compare with
displayed
Memory

• Keep the Programmer folder selected.


• If it is a PS4-200, we will be able to send the PCD file, a file in the PLC format, directly to the CPU. If it is a
The CLP from the PS4-300 or PS416 family comes without the operating system, so we need to load this system first.
the procedure only needs to be done once, and should be repeated only if the PLC is turned off and without the battery.
• To send the operating system, OSF, to the PS4-300 or PS416 select the Operating System (OSF) option:

• 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.

• Click now on the CPU Status option...

Prepared by Danilo J.P. Quintiliano Dept. Eng. Application Page 22 of 27


CPU status
Program Status
System status

Internal CPU clock

System information
operational

Amount of memory
free in the CPU

Information about the card


of memory. (When
installed

CPU status LEDs

Key position in the CPU

Last Parade event

CPU operation status

Program information

Prepared by Danilo J.P. Quintiliano Department of Applied Engineering Page 23 of 27


CPU Diagnosis

• 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.

Prepared by Danilo J.P. Quintiliano Dept. Engineering Application Page 24 of 27


• Exit this window and select the Topology Online icon .

CPU Status League diagnosis presents


from the Network current diagnosis

• 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,

MONITORING THE PROGRAM

• Now close the Topology Online window and select the Open Instance tree option,.

• In the left window, select the option ENGINE.


• We selected the Enter Editor Online option:

Prepared by Danilo J.P. Quintiliano Dept. Eng. Application Page 25 of 27


• Note that this fabric is the same as the one we have in the program editor, POU Editor, to the point that we can't open this screen.
if the POU Editor is running, therefore, it is highly recommended to close the POU Editor and the topology configurator
before starting the program's Debug.
• To view the status of your Tags, press the status display option. .
• The contacts/Coils that appear in red are logically closed/connected.
• On the left side of the screen, we can see our variable declaration. In the declaration, it is also possible to see
the status of each of the TAGs
• If you need to make changes online, do so normally using the same tools seen in the POU Editor.
• As soon as you finish the changes, the Activate Modification button will be enabled. . By pressing this key, the
modifications will be sent to the PLC.

Prepared by Danilo J.P. Quintiliano Dept. Eng. Application Page 26 of 27


CHAPTER 8
FINAL CONSIDERATIONS
This manual was created according to the latest version of the S40 software. Moeller Electric reserves the right to
make any changes to this manual without prior notice.
Read the programming manuals carefully, try to understand more function blocks through the Help of
software and through the manual.
The program presented here is for educational purposes only; Moeller Electric is not responsible for any damages that may occur.
use of this program may cause.

For any questions, contact:

Moeller Electric Ltd.

e-mail: suporte@[Link]

Prepared by Danilo J.P. Quintiliano Department of Applied Engineering Page 27 of 27

You might also like