0% found this document useful (0 votes)
407 views

Advanced PLC Note

The document provides an overview of programmable logic controllers (PLCs). It discusses how PLCs were developed to replace complex relay control systems, with key requirements being simple programming, changes without rewiring, smaller size, and lower cost than relay systems. The document then describes the basic components and memory areas of a PLC, including the power supply, CPU, input/output modules, and memory for storing the user program and input/output data. It explains that PLCs operate by continuously monitoring inputs, executing the stored program, and updating outputs.
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)
407 views

Advanced PLC Note

The document provides an overview of programmable logic controllers (PLCs). It discusses how PLCs were developed to replace complex relay control systems, with key requirements being simple programming, changes without rewiring, smaller size, and lower cost than relay systems. The document then describes the basic components and memory areas of a PLC, including the power supply, CPU, input/output modules, and memory for storing the user program and input/output data. It explains that PLCs operate by continuously monitoring inputs, executing the stored program, and updating outputs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

Advanced Programmable Logic Controllers 1

Advanced
Programmable
Logic Controllers

Nikini Automation Systems (Pvt) Ltd.

Nikini Automation Technology Training Centre 247, High level Rd, Colombo 05. Tel: 2826894 / Fax: 2826252
Advanced Programmable Logic Controllers- Siemens S7-200 2
The first Programmable Logic Controller (PLC) was developed by a group of engineers at General Motors
in 1968, when the company were looking for an alternative to replace complex relay control systems.
The new control system had to meet the following requirements:
• Simple programming
• Program changes without system intervention (no internal rewiring)
• Smaller, cheaper and more reliable than corresponding relay control systems
• Simple, low cost maintenance
Subsequent development resulted in a system, which enabled the simple connection of binary signals. The
requirements as to how these signals were to be connected were specified in the control program. With the
new systems it became possible for the first time to plot signals on a screen and to file these in electronic
memories.
The original task of a PLC involved the interconnection of input signals according to a specified program and,
if "true", to switch the corresponding output. Boolean algebra forms the mathematical basis for this operation,
which recognizes precisely two defined statuses of one variable: "0" and "1. Accordingly, an output can only
assume these two statuses. For instance, a connected motor could therefore be either switched on or off, i.e.
controlled. This function has coined the name PLC: Programmable logic controller, i.e. the input/output
behavior is similar to that of an electromagnetic relay or pneumatic switching valve controller; the program is
stored in an electronic memory.
However, the tasks of a PLC have rapidly multiplied: Timer and counter functions, memory setting and
resetting, mathematical computing operations all represent functions, which can be executed by practically
any of today’s PLCs.
The networking of several PLCs as well as that of a PLC and master computer is affected via special
communication interfaces. To this effect, many of the more recent PLCs are compatible with open,
standardized bus systems, such as Profibus. Thanks to the enormously increased performance capacity of
advanced PLCs, these can even directly assume the function of a master computer.
The PLCs currently on offer in the market place have been adapted to customer requirements to such an
extent that it has become possible to purchase an eminently suitable PLC for virtually any application.
Many PLCs can be expanded by means of additional input/output, analogue, positioning and communication
modules. Special PLCs are available for safety technology, shipping or mining tasks. Yet further PLCs are
able to process several programs simultaneously – (multitasking). Finally, PLCs are coupled with other
automation components, thus creating considerably wider areas of application.

Nikini Automation Technology Training Center 247, High level Rd, Colombo 05. Tel: 2826894 / Fax: 2826252
Advanced Programmable Logic Controllers- Siemens S7-200 3
HARDWARE CONFIGURATION OF A PROGRAMMABLE LOGIC CONTROLLER
Programmable logic controllers are microprocessor-based devices specifically designed to replace the relays
and hard-wired logic. They come complete with interfacing solid-state relays eliminating interfacing
problems.

A programmable logic controller system can be divided into the following blocks as shown in Figure 3.

Programming IBM PC or Compatible


Device

Power Supply CPU Program Memory

Component Data Memory

Input/Output
Modules

Input Output
Devices Devices

Figure 3: Components of a Programmable Logic Controller

Power Supply
Converts AC power to low voltage DC used to power the electronic logic in the CPU. It may also be
used to power the Input and Output Modules.

Central Processing Unit (CPU)


This is the "brains" of the system. It consists of one or more microprocessors that perform the
computations required to control the output devices according to the set of control instructions
or "program" that it follows and the status of the input signals to the Input Module.

Memory Unit
This is divided roughly into two parts:
The program memory contains the control instructions or user program, and the “read only” data
memory which holds all data of operations and status of the controller such as whether the
inputs/outputs are on/off and timer/counter data, etc. These values change as the program executes.

Nikini Automation Technology Training Center 247, High level Rd, Colombo 05. Tel: 2826894 / Fax: 2826252
Advanced Programmable Logic Controllers- Siemens S7-200 4
In addition, the executive (also known as the system firmware) has a super capacitor that is
essentially the base intelligence of the system which supervises the communication and housekeeping
duties. It also holds the read/write data memory.
Memory size is usually measured in the number of instruction words that can be stored, usually 1K,
4K or 8K. In modern PLCs, the size of the word is usually 16 bits.

Input /Output Modules


These provide the interface between the external control signals and the low voltage DC signals used
by the CPU. They are optically or otherwise isolated. The input/output modules are designed in this
way to minimize or eliminate the need for any intermediate circuitry between the PLC and the control
devices.
PLC OPERATION

The PLC operates internally in a way very similar to computers repetitively. The states of the input
devices are continuously monitored and copied from input module into input RAM memory area.
The CPU then executes the control program stored in the program memory area. Depending on the
program and the states of inputs, the output states of the relevant output devices are then written into
the output RAM memory area. At the end of each execution cycle, data in output RAM area are then
copied to the output module.

The SIMATIC S7-200 can access data in the following memory areas:
- Input Memory Area (I) is used to store status of the input devices from input modules.
- Output Memory Area (Q) is used to store status of the output devices after each execution of the
program logic.
- Variable Memory Area (V) is used to store intermediate results of operation being performed by
the program.
- Bit Memory Area (M) is used as control relays to store the intermediate status of an operation or
other control information.
- Timer Memory Area (T) is used to store timer’s current and preset values.
- Counter Memory Area (C) is used to store counter’s current and preset values.
- Special Memory Area (SM) is used to control some special functions
- Accumulators (AC) is used to pass parameters to and from subroutines and to store intermediate
values used in a calculation. S7-200 provides 4 32-bit accumulators (AC0 to AC3).
- Analog Inputs (AI) converts an analog value (such as pressure and speed) into a digital value.
Nikini Automation Technology Training Center 247, High level Rd, Colombo 05. Tel: 2826894 / Fax: 2826252
Advanced Programmable Logic Controllers- Siemens S7-200 5
- Analog Outputs (AQ) converts a digital value into a current or voltage.
- Local Memory Area (L) is used to store data or passing parameters to subroutines. L memory is
similar to V memory, except the data in L memory are local variables and those in V memory are
global variables.
There are some other types of memory areas that are not used for this course. Thus, they will not
mention in this course notes.

• Addressing Conventions
Data in most memory area (V, I, Q, M and SM) can be accessed as bit, byte, word or double word
using the “byte.bit” or “byte-address” format.

Bit Addressing
To access a bit in a memory area, the address specified should include the memory area identifier, the
byte address, and its bit number. An example is shown in Fig. 6.
I 1 . 5
bit number (bit 5)
separator (to separate byte address from bit number)
byte address (byte 1)
memory area identifier (I for input memory area)

Bit No 7 6 5 4 3 2 1 0
Byte 0
Byte 1
Byte 2

Bit Addressing

Byte, Word and Double Word Addressing


To access a byte, a word or a double word in a memory area, specify the memory area identifier, the
data types and then the byte address. Figure 7 shows examples of each data type of addressing mode.

V B 100
byte address MSB LSB
access as byte VB100 7 VB100 0
memory area identifier

Nikini Automation Technology Training Center 247, High level Rd, Colombo 05. Tel: 2826894 / Fax: 2826252
Advanced Programmable Logic Controllers- Siemens S7-200 6
V W 100
byte address MSB LSB
access as word
memory area identifier VW100 7 VB100 0 7 VB101 0

V D 100
byte address
access as double word
memory area identifier

MSB
LSB
7 VB100 0 7 VB101 0 7 VB102 0 7 VB103 0
VD100

• Other Data Memory Areas

Besides the I/O and IR (Work Bits) area, other different data areas in the S7-200 are given in the table
in Figure 10.
Area Channels
Input I0.0 to I15.7
Output Q0.0 to Q15.7
Variable Memory VB0 to VB 2047
Bit Memory M0.0 to M31.7
Special Memory SM0.0 to SM299.7
Timer
Retentive ON delay 1 ms T0, T64
10 ms T1 to T4 and T65 to T68
100 ms T5 to T31and T69 to T95

On/Off Timer 1 ms T32, T96


10 ms T33 to T36 and T97 to T100
100 ms T37 to T63 and T101 to T256
Counter C0 to C255
Accumulator Registers AC0 to AC3
Jumps/Labels 0 to 255
Call/Subroutine 0 to 63
Table of Data Memory Areas

The Special Memory Bit (SM) are used for system clocks, flags and status information. Some of the
more commonly used SM bits are shown in Fig. 11.

Bit Function
SM0.0 Always On flag
Nikini Automation Technology Training Center 247, High level Rd, Colombo 05. Tel: 2826894 / Fax: 2826252
Advanced Programmable Logic Controllers- Siemens S7-200 7
SM0.1 First Scan flag (On for 1 scan only)
SM0.2 Retentive Data Lost flag
SM0.3 Power On Reset flag
SM0.4 30 s off / 30 s on clock pulse
SM0.5 0.5 s on / 0.5 s on clock pulse
SM0.6 Off 1 scan / on 1 scan clock pulse (Step turns ON for 1
scan)
SM0.7 Switch in RUN position

SM1.0 Result of operation = 0


SM1.1 Overflow or illegal value
SM1.2 Negative result
SM1.3 Division by 0
SM1.4 Table Full
SM1.5 Table Empty
SM1.6 BCD to binary conversion error
SM1.7 ASCII to Hex conversion error

INTERNAL OPERATION OF PROGRAMMABLE LOGIC CONTROLLERS

INPUT MODULE OUTPUT MODULE


Input Relay
Input Relay
Input
InputDevice
Device Output Device
Output Device

CPU

Power supply Power supply


Output Relay
Opto-Isolator

Instructions

Nikini Automation Technology Training Center 247, High level Rd, Colombo 05. Tel: 2826894 / Fax: 2826252
Advanced Programmable Logic Controllers- Siemens S7-200 8
Bit Logic Instructions

•Normally Open
•Normally Closed
•Not
•Positive Transition
•Negative Transition
•Output
•Set
•Reset
•Set Dominant Bistable
•Reset Dominant Bistable
•No Operation

Counter instructions

•Up counter
•Down Counter
•Up-Down Counter

Timer instructions
•Delay ON timer
•Delay OFF timer
•Delay ON RETENTIVE timer

Compare instructions

Nikini Automation Technology Training Center 247, High level Rd, Colombo 05. Tel: 2826894 / Fax: 2826252
Advanced Programmable Logic Controllers- Siemens S7-200 9
•Compare BYTE
•Compare INTEGER
•Compare DOUBLE INTEGER
•Compare REAL
•Compare STRING

Convert Instructions

•Byte ÙInteger
•Integer Ù Double Integer
•Integer Ù BCD
•Double Integer Ù Real
•Round
•Trunk

Move instructions

•Move
–Byte
–Word
–Double Word
–Real
•Block move

Nikini Automation Technology Training Center 247, High level Rd, Colombo 05. Tel: 2826894 / Fax: 2826252
Advanced Programmable Logic Controllers- Siemens S7-200 10
•SWAP

Integer Math Instructions

•Add
- Integer
- Double integer
•Subtract
•Multiply
•Division
•Increment
- Byte
- Word
- Double word
•Decrement

The Increment Byte and Decrement Byte instructions add or subtract 1 to or from the input byte (IN) and
place the result into the variable specified by OUT.
Increment and decrement byte operations are unsigned. In LAD and FBD:
IN + 1 = OUT
IN - 1 = OUT

Floating-point math instructions

Nikini Automation Technology Training Center 247, High level Rd, Colombo 05. Tel: 2826894 / Fax: 2826252
Advanced Programmable Logic Controllers- Siemens S7-200 11

•Add
•Subtract
•Multiply
•Division
•Square root
•Trigonometric
•Logarithmic/ Exponential
•PID

Program control instructions


•For
•Next
•Jump
•Label
•Stop

Nikini Automation Technology Training Center 247, High level Rd, Colombo 05. Tel: 2826894 / Fax: 2826252
Advanced Programmable Logic Controllers- Siemens S7-200 12

Using Subroutines

Subroutines help you to partition your program. The instructions used in your main program determine
the execution of the specific subroutine. When the main program calls the subroutine for execution, the
subroutine carries out its program to its end. Then, the system returns control to the main program at the
network from which the subroutine was called.

Subroutines are used to segment or divide your program into smaller more manageable blocks. You can
take advantage of this benefit when debugging and performing maintenance on your program. By
working with smaller blocks, you can easily debug and troubleshoot these areas as well as the entire
program. The PLC can also be more efficiently used by only calling to the block when needed, as all
blocks may not have to execute every scan.

Finally, subroutines can be portable if your subroutine references only its parameters and local memory.
Make the subroutine portable, by avoiding any use of global variables/symbols (absolute addresses in I,
Q, M, SM, AI, AQ, V, T, C, S, AC memory). If your subroutine has no calling parameters (IN, OUT, or
IN_OUT), or uses only local variables in L memory, you can export the subroutine and import it into
another project.

To use a subroutine in your program, you must perform three tasks:

· Create the subroutine


· Define its parameters (if any) in the Local Variable Table of the subroutine
· Call the subroutine from the appropriate POU (from your main program or another subroutine)

When a subroutine is called, the entire logic stack is saved, the top of stack is set to one, all other stack
locations are set to zero , and control is transferred to the called subroutine. When this subroutine is
completed, the stack is restored with the values saves at the point of call, and control is returned to calling
routine.
Accumulators are common to subroutines and the calling routine. No save or restore operation is
performed on accumulators due to subroutine use.

Nikini Automation Technology Training Center 247, High level Rd, Colombo 05. Tel: 2826894 / Fax: 2826252
Advanced Programmable Logic Controllers- Siemens S7-200 13

Calling a Subroutine With Parameters

Subroutines may contain passed parameters. The parameters are defined in the local variable table of the
subroutine. The parameters must have a symbol name (maximum of 23 characters), a variable type, and a
data type. Sixteen parameters can be passed to or from a subroutine.
The variable type field in the local variable table defines whether the is passed into the subroutine (IN),
passed in to and out of the subroutine (IN_OUT), or passed out of the subroutine (OUT). The following
table describes the parameter types for a subroutine. To add a parameter entry, place the cursor on the
variable type field of the type (IN, IN_OUT, or OUT) that you want to add. Click the right mouse button
to get a menu of options. Select the Insert option and then the Row below option. Another parameter
entry of the selected type appears below the current entry.

Call Parameter
Type Description
IN Parameters are passed into the subroutine. If the parameter is a direct address (such as
VB10), the value at the specified location is passed into the subroutine. If the parameter is
an indirect address (such as *AC1), the value at the location pointed to is passed into the
subroutine. If the parameter is a data constant (16#1234), or an address (&VB100), the
constant or address value is passed into the subroutine.
IN_OUT The value at the specified parameter location is passed into the subroutine and the result
value from the subroutine is returned to the same location. Constants (such as 16#1234)
and addresses (such as &VB100) are not allowed for input/output parameters.
OUT The result value from the subroutine is returned to the specified parameter location.
Constants (such as 16#1234) and addresses (such as &VB100) are not allowed as output.
TEMP Any local memory that is not used for passed parameters may be used for temporary
storage within the subroutine.

Nikini Automation Technology Training Center 247, High level Rd, Colombo 05. Tel: 2826894 / Fax: 2826252
Advanced Programmable Logic Controllers- Siemens S7-200 14

Nesting and Recursion

You can have a total of 64 subroutines in a program (128


subroutines for CPU 226XM). From the main program, you can
nest subroutines (place a subroutine call within a subroutine), to
a depth of eight. From an interrupt routine, you cannot nest
subroutines. A subroutine call cannot be placed in any
subroutine called from an interrupt routine. Recursion (a
subroutine that calls itself) is not prohibited, but you should use
caution when using recursion with subroutines.

Data Blocks

The data block allows you to make initial data assignments to V memory (variable memory) only. You
can make assignments to bytes, words, or double words of V memory. Comments (preceded by double
forward slashes) are optional.

- The first line of the data block must have an explicit address assignment. Subsequent lines can have
explicit or implicit address assignments. An implicit address assignment is made by the editor when
you type multiple data values after a single address assignment, or type a line that contains only data
values. The editor assigns an appropriate amount of V memory based on your previous address
allocations and the size (byte, word, or double word) of the data value(s).

- The data block editor is a free-form text editor; that is, no specific fields are defined for particular
types of information. After you finish typing a line and press the ENTER key, the data block editor
formats the line (aligns columns of addresses, data, comments; capitalizes V memory addresses) and
redisplays it. The data block editor accepts uppercase or lowercase letters and allows commas, tabs,
or spaces to serve as separators between addresses and data values.

Nikini Automation Technology Training Center 247, High level Rd, Colombo 05. Tel: 2826894 / Fax: 2826252
Advanced Programmable Logic Controllers- Siemens S7-200 15

Interrupt Routine
Interrupts are event driven. Before an interrupt routine can be invoked, an association must be established
between the interrupt event and the program segment that you want to execute when the event occurs.
Use the Attach Interrupt instruction (ATCH) to associate an interrupt event (specified by the interrupt
event number) and the program segment (specified by an interrupt routine number). When you attach an
interrupt event to an interrupt routine, that interrupt is automatically enabled.

Nikini Automation Technology Training Center 247, High level Rd, Colombo 05. Tel: 2826894 / Fax: 2826252
Advanced Programmable Logic Controllers- Siemens S7-200 16
If you disable all interrupts using the global disable interrupt instruction, each occurrence of the
interrupt event is queued until interrupts are re-enabled, using the global enable interrupt instruction.
You can disable individual interrupt events by breaking the association between the interrupt event and
interrupt routine with the Detach Interrupt instruction (DTCH). The Detach instruction returns the
interrupt to an inactive or ignored state.

Understanding How the S7-200 Processes Interrupt Routines


The interrupt routine is executed in response to an associated internal or external event. Once the last
instruction of the interrupt routine has been executed, control is returned to the main program. You can
exit the routine by executing a Conditional Return from Interrupt instruction (CRETI).

Guidelines and Restrictions for Using Interrupt Routines


Interrupt processing provides quick reaction to special internal or external events. You should optimize
interrupt routines to perform a specific task, and then return control to the main program.
By keeping the interrupt routines short and to the point, execution is quick and other processes are not
deferred for long periods of time. If this is not done, unexpected conditions can cause abnormal operation
of equipment controlled by the main program.

Types of Interrupts Supported by the S7-200


The S7-200 supports the following types of interrupt routines:

- Communication port interrupts: The S7-200 generates events that allow your program to control the
communications port.

- I/O interrupts: The S7-200 generates events for different changes of state for various I/O. These
events allow your program to respond to the high-speed counters, the pulse outputs, or to rising or
falling states of the inputs.

- Time-based interrupts: The S7-200 generates events that allow your program to react at specific
intervals.

Communication Port Interrupts


The serial communications port of the S7-200 can be controlled by your program. This mode of operating

Nikini Automation Technology Training Center 247, High level Rd, Colombo 05. Tel: 2826894 / Fax: 2826252
Advanced Programmable Logic Controllers- Siemens S7-200 17
the communications port is called Freeport mode. In Freeport mode, your program defines the baud
rate, bits per character, parity, and protocol. The Receive and Transmit interrupts are available to
facilitate your program-controlled communications. Refer to the Transmit and Receive instructions for
more information.

I/O Interrupts
I/O interrupts include rising/falling edge interrupts, high-speed counter interrupts, and pulse train output
interrupts. The S7-200 can generate an interrupt on rising and/or falling edges of an input (either I0.0,
I0.1, I0.2, or I0.3). The rising edge and the falling edge events can be captured for each of these input
points. These rising/falling edge events can be used to signify a condition that must receive immediate
attention when the event happens.

The high-speed counter interrupts allow you to respond to conditions such as the current value reaching
the preset value, a change in counting direction that might correspond to a reversal in the direction in
which a shaft is turning, or an external reset of the counter. Each of these high-speed counter events
allows action to be taken in real time in response to high-speed events that cannot be controlled at
programmable logic controller scan speeds.

The pulse train output interrupts provide immediate notification of completion of outputting the
prescribed number of pulses. A typical use of pulse train outputs is stepper motor control.

You can enable each of the above interrupts by attaching an interrupt routine to the related I/O event.

Time-Based Interrupts
Time-based interrupts include timed interrupts and the timer T32/T96 interrupts. You can specify actions
to be taken on a cyclic basis using a timed interrupt. The cycle time is set in 1-ms increments from 1 ms
to 255 ms. You must write the cycle time in SMB34 for timed interrupt 0, and in SMB35 for timed
interrupt

The timed interrupt event transfers control to the appropriate interrupt routine each time the timer expires.
Typically, you use timed interrupts to control the sampling of analog inputs or to execute a PID loop at
regular intervals.

Nikini Automation Technology Training Center 247, High level Rd, Colombo 05. Tel: 2826894 / Fax: 2826252
Advanced Programmable Logic Controllers- Siemens S7-200 18
A timed interrupt is enabled and timing begins when you attach an interrupt routine to a timed interrupt
event. During the attachment, the system captures the cycle time value, so subsequent changes to SMB34
and SMB35 do not affect the cycle time. To change the cycle time, you must modify the cycle time value,
and then re-attach the interrupt routine to the timed interrupt event. When the re-attachment occurs, the
timed interrupt function clears any accumulated time from the previous attachment and begins timing
with the new value.

After being enabled, the timed interrupt runs continuously, executing the attached interrupt routine on
each expiration of the specified time interval. If you exit the RUN mode or detach the timed interrupt, the
timed interrupt is disabled. If the global disable interrupt instruction is executed, timed interrupts continue
to occur. Each occurrence of the timed interrupt is queued (until either interrupts are enabled or the queue
is full).

The timer T32/T96 interrupts allow timely response to the completion of a specified time interval. These
interrupts are only supported for the 1-ms resolution on-delay (TON) and off-delay (TOF) timers T32 and
T96. The T32 and T96 timers otherwise behave normally. Once the interrupt is enabled, the attached
interrupt routine is executed when the active timer's current value becomes equal to the preset time value
during the normal 1-ms timer update performed in the S7-200. You enable these interrupts by attaching
an interrupt routine to the T32/T96 interrupt events.

Interrupt Priority and Queuing


Interrupts are serviced by the S7-200 on a first-come-first-served basis within their respective priority
group. Only one user-interrupt routine is ever being executed at any point in time. Once the execution of
an interrupt routine begins, the routine is executed to completion. It cannot be pre-empted by another
interrupt routine, even by a higher priority routine. Interrupts that occur while another interrupt is being
processed are queued for later processing.

You can have a total of 128 interrupts in a program. Interrupts are serviced by the PLC on a first-come-
first-served basis within their respective priority assignments. Only one user-interrupt routine is ever
being executed at any point in time. Once the execution of an interrupt routine begins, the routine is
executed to completion. It cannot be pre-empted by another interrupt routine, even by a higher priority
routine. Interrupts that occur while another interrupt is being processed are queued for later processing.

Nikini Automation Technology Training Center 247, High level Rd, Colombo 05. Tel: 2826894 / Fax: 2826252
Advanced Programmable Logic Controllers- Siemens S7-200 19
Event Priority Priority
Number Interrupt Description Group in Group

0 Rising edge, I0.0 2


2 Rising edge, I0.1 3
4 Rising edge, I0.2 4
6 Rising edge, I0.3 5
1 Falling edge, I0.0 6
3 Falling edge, I0.1 7
5 Falling edge, I0.2 8
7 Falling edge, I0.3 9
10 Timed interrupt 0 Timed 0
11 Timed interrupt 1 (Lowest) 1
21 Timer T32 CT=PT 2
22 Timer T96 CT=PT 3

Position control

The EM 253 Position Module is an S7-200 special function module that generates the pulse trains used
for open-loop control of the speed and position for either stepper motors or servomotors. It communicates
with the S7-200 over the expansion I/O bus and appears in the I/O configuration as an intelligent module
with eight digital outputs.

Based upon configuration information that is stored in the V memory of the S7-200, the Position module
generates the pulse trains required to control movement.

- The PLC has two built it Pulse Train Output (PTO) / Pulse Width Modulation (PWM) generators
that can be configured to output pulse outputs. The maximum pulse rate supported is 20kHz.
- The EM 253 Position Module can be configured if you need more advanced high-speed position
control. The maximum pulse rate supported for the module is 200kHz.

Nikini Automation Technology Training Center 247, High level Rd, Colombo 05. Tel: 2826894 / Fax: 2826252
Advanced Programmable Logic Controllers- Siemens S7-200 20
The PTO Wizard creates a PTO_OUT subroutine and an empty profile mask in V memory. The PWM
Wizard creates a PWM_OUT subroutine. After you complete the wizard, open the Call Subroutines
folder at the bottom of the instruction tree. Then, insert a call instruction to the new subroutine in your
program.
Your program must be compiled and set to symbolic addressing mode before you use the Position
Wizard. If you have not compiled, the wizard prompts you to do so at the beginning of the configuration
process.

STEP 1 Specify a Pulse Generator


The S7-200 PLC has two pulse generators:

· one assigned to digital output point Q0.0


· one assigned to digital output point Q0.1
Specify the generator that you want to configure.

STEP 2 Edit an Existing PTO or PWM Configuration

If you have an existing configuration in your project, then you can either delete the configuration from
the project or move the existing configuration to another pulse generator.
If you have no existing configurations, then go to Step 3

STEP 3 Choose PTO or PWM and Select Timebase

- Choose to configure the pulse generator for pulse train output (PTO) or Pulse Width Modulation
(PWM).

- Choose a time base (microseconds or milliseconds) for cycle times and pulse widths.

If you choose to configure Pulse Train Output (PTO), you must configure the number of steps used in the
operation.

STEP 4 Set Starting V Memory Address for Profile Data

Nikini Automation Technology Training Center 247, High level Rd, Colombo 05. Tel: 2826894 / Fax: 2826252
Advanced Programmable Logic Controllers- Siemens S7-200 21
The PTO wizard generates PTO profile templates in V memory. An example of a single segment
profile is shown below. After the PTO wizard generates your project code, you must edit the PTO
template with the Data Block editor. In the example template, you would enter the pulse parameter values
for VW1, VW3, and VD5.

The PWM wizard does not use a V memory template. For PWM configuration, go to step 5.
//-------------------------------------------------------------------------
// PTO Profile table for output Q0.0
// This empty profile table was generated by the PTO wizard.
// To use this profile, enter the target values in the table below.
// Input a value of 0 to the P_Table input parameter of the 'PTO_OUTx' instruction.
//-------------------------------------------------------------------------

VB0 1 // Number of segments in profile


// Segment 0
VW1 0 // Initial cycle time (2 to 65535 units of the timebase)
VW3 0 // Cycle time delta per pulse (-32766 to 32767 units of the timebase)
VD5 0 // Pulse count (1 to 4294967295)

STEP 5 Generate Project Code


Back to Top

The wizard generates the project components for your selected configuration. The subroutine PTO_OUTx
is added to your project and an empty profile mask is added to the data block starting at address VB0. To
enable this configuration in your program, complete the profile table in the data block and call the
subroutine PTO_OUTx from your program. This subroutine should remain enabled while the PTO output
is active.

Analog Adjustment using SMB28-SMB29

Special Memory Bytes 28 and 29 contain the digital value corresponding to the shaft positions for analog
adjustments 0 and 1. The analog adjustment potentiometers are located behind the front access door of the

Nikini Automation Technology Training Center 247, High level Rd, Colombo 05. Tel: 2826894 / Fax: 2826252
Advanced Programmable Logic Controllers- Siemens S7-200 22
CPU. Use a small screwdriver to adjust the potentiometers (clockwise to increase or counter-clockwise
to decrease). These read-only values can be used by a program for a variety of functions, such as updating
the current value for a timer or counter, entering or changing the preset values, or setting limits. The
analog adjustment has a nominal range of 0 to 255 and a repeatability of ± 2 counts.

S7-200 Symbol Name SM Addr. User programs read SMB28-SMB29 to get potentiometer position
data
Pot0_Value SMB28 This byte stores the value entered with analog adjustment 0.
Pot1_Value SMB29 This byte stores the value entered with analog adjustment 1.

HMI (Human Machine Interface) TD 200


The Text Display 200 (TD 200) is a text display and operator interface for the S7-200 family of
programmable logic controllers.
The following is a list of TD 200 features:
- Displays messages read from the S7-200 CPU.
- Allows adjustment of designated program variables.
- Provides ability to force/unforce I/O points.
- Provides ability to set the time and date for CPUs that have real-time clocks.
- Provides menus and prompts in six languages (English, German, French, Spanish, Italian, and
Chinese)
- Provides multiple character sets to support English, Western European, Slavic, and Chinese
languages.

The TD 200 receives its power either from the S7-200 CPU through the TD/CPU cable or from a separate
power supply.

The TD 200 functions as a network master when it is connected to one or more S7-200 CPUs. The TD
200 is also designed to operate with other masters in a network. Multiple TD 200s can be used with one
or more S7-200 CPUs connected to the same network.

Use a one-to-one network configuration when you have just one S7-200 CPU to connect to one TD 200.
A one-to-one configuration consists of a TD 200, an S7-200 CPU, and a TD/CPU cable that is supplied
with the TD 200.

Nikini Automation Technology Training Center 247, High level Rd, Colombo 05. Tel: 2826894 / Fax: 2826252
Advanced Programmable Logic Controllers- Siemens S7-200 23

Configuring TD 200
The TD 200 is a text display device that displays messages enabled by the S7-200 CPU. You do not have
to configure or program the TD 200. The only operating parameters stored in the TD 200 are the address
of the TD 200, the address of the CPU, the baud rate, and the location of the parameter block. The
configuration of the TD 200 is stored in a TD 200 parameter block located in the variable memory (V
memory) of the CPU. The operating parameters of the TD 200, such as language, update rate, messages,
and message-enabled bits, are stored in the TD 200 parameter block in the CPU.

Upon power-up, the TD 200 reads the parameter block from the CPU. All of the parameters are checked
for legal values. If everything is acceptable, the TD 200 starts actively polling the message-enabled bits to
determine what message to display, reads the message from the CPU, and then displays the message.

STEP 7-Micro/WIN provides a “wizard” that makes it easy to configure the parameter block and the
messages in the data memory area of the S7-200 CPU. The TD 200 Configuration Wizard automatically
writes the parameter block and message texts to the data block editor after you finish choosing the options
and creating the messages. This data block can then be downloaded to the CPU.

Tips
How to control a three-phase induction motor with two possible rotational directions
Use the momentary contact switch at input I0.0 to start the motor counterclockwise. Use the momentary
contact switch at input I0.1 to start the motor clockwise. The prerequisites are that the motor circuit
breaker at input I0.3 and the OFF switch at input I0.2 are not activated. The rotational direction cannot be
changed until after the OFF switch is pressed and a waiting period of 5 s has elapsed. This allows the
motor to brake and start up in the opposite direction.

Nikini Automation Technology Training Center 247, High level Rd, Colombo 05. Tel: 2826894 / Fax: 2826252
Advanced Programmable Logic Controllers- Siemens S7-200 24

Program Flowchart

Set the Interlock


LD On_Clockwise // Load I0.1.
// If I0.1 is set
A On_CntrClockw // and I0.0 is set
O Wait_Time // or M2.3 is set,
S Interlock, 1 // set M2.0.

Nikini Automation Technology Training Center 247, High level Rd, Colombo 05. Tel: 2826894 / Fax: 2826252
Advanced Programmable Logic Controllers- Siemens S7-200 25
Clear the Interlock
LDN On_CntrClockw // Load input I0.0 as a Normally
// Closed contact.
// If input I0.0 is not set
AN On_Clockwise // and input I0.1 is not set
AN Wait_Time // and M2.3 is not set,
R Interlock, 1 // reset M2.0.

Enable Counterclockwise Rotation


LD Motor_Off // Load I0.2
// If I0.2 is set
A Circuit_Break // and I0.3 is set
AN Clockw_Status // and M1.1 is not set,
= Enable_CntrClockw // set M2.1.

Enable Clockwise Rotation


LD Motor_Off // Load I0.2
// If I0.2 is set
A Circuit_Break // and I0.3 is set
AN CntrClockw_Status // and M1.0 is not set,
= Enable_Clockw // set M2.2.

Run Counterclockwise
LD On_CntrClockw // Load input I0.0.
// If input I0.0 is set
O CntrClockw_Status // or memory bit M1.0 is set
AN Interlock // and memory bit M2.0 is not set,
A Enable_CntrClockw // and memory bit M2.1 is set,
= CntrClockw_Status // set memory bit M1.0,
= Start_CntrClockw // set motor starter output Q0.0,
= CntrClockw_Lamp // and set output Q0.4.

Run Clockwise

Nikini Automation Technology Training Center 247, High level Rd, Colombo 05. Tel: 2826894 / Fax: 2826252
Advanced Programmable Logic Controllers- Siemens S7-200 26
LD On_Clockwise // Load input I0.0.
// If input I0.0 is set
O Clockw_Status // or memory bit M1.1 is set
AN Interlock // and memory bit M2.0 is not set
A Enable_Clockw // and memory bit M2.2 is set,
= Clockw_Status // set memory bit M1.1,
= Start_Clock // set motor starter output Q0.1,
= Clockw_Lamp // and set output Q0.3.

Turn On "Off" Lamp When Status Bits Not Set


LDN CntrClockw_Status // If memory bit M1.0 is not set
AN Clockw_Status // and memory bit M1.1 is not set,
= Off_Lamp // set output Q0.2.

Set Waiting Period Timer Bit


LD Off_Lamp // Load output Q0.2.
EU // When there is a positive
// transition (Edge Up) at
// output Q0.2,
S Wait_Time, 1 // set memory bit M2.3.

Set Waiting Period and Start Timer


LD Wait_Time // Load memory bit M2.3.
MOVW +500, VW20 // Store the value to be used with
// timer T33.
TON T33, VW20 // Enable timer T33 with PT from
// VW20.
A T33 // When current timer value =
// Preset Time,
R Wait_Time, 1 // reset memory bit M2.3.

Flash Signal Lamp during Waiting Period


LD Wait_Time // Load memory bit M2.3

Nikini Automation Technology Training Center 247, High level Rd, Colombo 05. Tel: 2826894 / Fax: 2826252
Advanced Programmable Logic Controllers- Siemens S7-200 27
// If memory bit M2.3 is set
A Clock_1s // and special memory bit SM0.5
// is set,
= Wait_Lamp // turn on output Q0.5.

Main Program End

Introduction to Industrial communication


By complex systems with a large number of in-/output signals, it is no longer practical to realize the
automation task with a signal, central controller.
Then one has skipped the control tasks in order to distribute smaller automation devices. These devices
are coordinated from higher order controllers or mainframes, which are integrated over a bus system in
the whole process.
The in- and outputs are no longer connected to the central signal modules directly on the controller, but
are distributed in a process from location by I/O modules that are connected over a field bus with a signal
controller.

Hierarchy Level In Automations Technology

Nikini Automation Technology Training Center 247, High level Rd, Colombo 05. Tel: 2826894 / Fax: 2826252
Advanced Programmable Logic Controllers- Siemens S7-200 28

PROFIBUS-FMS

a) The AS-Interface

The Actuator-Sensor-Interface (AS-I) serves,as the information transmission in the lowest field area and
like the PROFIBUS, is an open standard. A multitude of manufactures offer products and interfaces to the
AS-Interface. The AS-Interface enables a simple and extremely cost efficient integration of sensors and
actors in the industrial communication and provides these sensors and actors simultaneously with the
important auxiliary power. With this system, predominately binary sensors and actors are operated with
the controllers. So far it is important for process signals that arise before a location to transfer with
conventional parallel wiring over in-/output modules into the controller. AS-I replaces the expensive
cable tree by a simple and complete unprotected 2 wire cable for all sensors and actors.
Through the robust design in a degree of protection IP65 or IP67, the AS-Interface increases straight in
the lowest field area of usual and hard operating conditions.

Technical data for an AS-Interface.


The technical data and transmission protocol of the AS-Interface are specified in the Norm EN 50 295.
The following performance data for the AS-Interface is specified here:
- Max. 31 AS-I nodes with 4 Bit I/O user data
- Max. 124 I/O sensors and actors
- Access processing with cyclic polling in the master/slave process

Nikini Automation Technology Training Center 247, High level Rd, Colombo 05. Tel: 2826894 / Fax: 2826252
Advanced Programmable Logic Controllers- Siemens S7-200 29
- Max. cycle time 5ms
- Error safe identification and iteration of faulty frames.
- Transmission medium is a usual 2 wire cable (2 x 1,5 mm2 ) for data and a max. of 2A
auxiliary power per AS-I pro AS-I cable. The power supply consists of 30 V DC. The
signal of the data transmission is modulated. An additional power supply of 24V DC
(auxiliary power) is possible.
- Connection and assembly of the AS-I components in an insulation displacement method.
- AS-I slave module with integrated circuit (AS-I chip) that requires no processor and no
software. This results in an approximate, delay free processing of the frames and a small
construction volume of the slave
- Special AS-I sensors and actors are directly integrated with the AS-I chips.
- Flexible configuration possibilities like in the conduit with cables, stars or tree structures
- Max. wire length of 100m or 300m (with repeaters)

b) The PROFIBUS
PROFIBUS is a bus system that is used in the field range as well as for cell networks with a small amount
of nodes.
There are three protocol profiles for the PROFIBUS that can be operated together on a circuit (RS 485
fiber-optic cable).
- PROFIBUS-FMS (Fieldbus Message Specification) is suited for the communication of
automation devices in small cell nets under one another and for the communication with field
devices with a FMS interface.
- PROFIBUS-DP (Distributed Peripheral) is the protocol profile for the connection of
distributed I/Os in the field area e.g. ET 200 modules with very fast reaction time.
- PROFIBUS-PA (Process Automation) is the communication compatible addition from the
PROFIBUS-DP about a transmission technology that allows the users into the EX-area. The
transmission technology of the PROFIBUS-PA corresponds to the international Standard IEC
1158-2.

c) Ethernet
The Ethernet is a worldwide spread and manufacturer-neutral technology for the transmission of data in a
LAN (Local Area Network) at a rate of 10, 100 or 1000 millon bit per second (MBps). LANs are
specified in IEEE 802 and are differing from other types of networks by:

Nikini Automation Technology Training Center 247, High level Rd, Colombo 05. Tel: 2826894 / Fax: 2826252
Advanced Programmable Logic Controllers- Siemens S7-200 30
- The total length of cabling or rather the extension of network (10-1000 m)
- The technology of transmission (coaxial cable, twisted pair and fibre-optic cable systems)
- The network topology (bus-, ring-, star- and tree structure)
Ethernet is a part of this specification and is defined in IEEE 802.3 resp. IEEE 802.3u for Fast Ethernet.

Industrial Ethernet
Communications requirements in an industrial environment differ significantly from those for a
conventional office environment. This is the case for almost all partial aspects of communications such as
active and passive network components, connected terminals, network designs and topologies,
availability, data emergence, and environmental conditions – to mention only a few.
Likewise network protocols are available which are especially optimized for industrial communications,
even though TCP/IP - a classical protocol from the office sector – has been used in the production and
process control field for a fairly long time. The basic idea of Industrial Ethernet is to exploit existing
standards and to extend them by necessary and useful details for industrial communication purposes.
Thus products are emerging for the special conditions of production or process environments: Industrial
Ethernet – Designed for Industry.

Nikini Automation Technology Training Center 247, High level Rd, Colombo 05. Tel: 2826894 / Fax: 2826252

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy