Twido Suite Programming Manual
Twido Suite Programming Manual
35011386 06/2011
TwidoSuite V2.3
Programming Guide
06/2011
35011386.05
www.schneider-electric.com
The information provided in this documentation contains general descriptions and/or
technical characteristics of the performance of the products contained herein. This
documentation is not intended as a substitute for and is not to be used for
determining suitability or reliability of these products for specific user applications. It
is the duty of any such user or integrator to perform the appropriate and complete
risk analysis, evaluation and testing of the products with respect to the relevant
specific application or use thereof. Neither Schneider Electric nor any of its affiliates
or subsidiaries shall be responsible or liable for misuse of the information contained
herein. If you have any suggestions for improvements or amendments or have found
errors in this publication, please notify us.
No part of this document may be reproduced in any form or by any means, electronic
or mechanical, including photocopying, without express written permission of
Schneider Electric.
All pertinent state, regional, and local safety regulations must be observed when
installing and using this product. For reasons of safety and to help ensure
compliance with documented system data, only the manufacturer should perform
repairs to components.
When devices are used for applications with technical safety requirements, the
relevant instructions must be followed.
Failure to use Schneider Electric software or approved software with our hardware
products may result in injury, harm, or improper operating results.
Failure to observe this information can result in injury or equipment damage.
© 2011 Schneider Electric. All rights reserved.
2 35011386 06/2011
Table of Contents
Safety Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
About the Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Part I Description of Twido Software . . . . . . . . . . . . . . . . . 15
Chapter 1 Introduction to TwidoSuite . . . . . . . . . . . . . . . . . . . . . . . 17
Introduction to TwidoSuite. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Introduction to Twido Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Chapter 2 Twido Language Objects . . . . . . . . . . . . . . . . . . . . . . . . 23
Language Object Validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Bit Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Word Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Floating Point and Double Word Objects . . . . . . . . . . . . . . . . . . . . . . . . . 30
Addressing Bit Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Addressing Word Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Addressing Floating Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Addressing Double Word Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Addressing Inputs/Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Network Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Function Block Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Structured Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Indexed Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Symbolizing Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Chapter 3 User Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
User Memory Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Backup and Restore without Backup Cartridge or Extended Memory . . . 53
Backup and Restore with a 32K Backup Cartridge . . . . . . . . . . . . . . . . . . 55
Using the 64K Extended Memory Cartridge . . . . . . . . . . . . . . . . . . . . . . . 58
Chapter 4 Event task management. . . . . . . . . . . . . . . . . . . . . . . . . . 61
Overview of Event Tasks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Description of Different Event Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Event Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
35011386 06/2011 3
Part II Special Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Chapter 5 Communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Presentation of the Different Types of Communication . . . . . . . . . . . . . . 70
TwidoSuite to Controller Communication. . . . . . . . . . . . . . . . . . . . . . . . . 72
Communication between TwidoSuite and a Modem . . . . . . . . . . . . . . . . 79
Remote Link Communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
ASCII Communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Modbus Communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Standard Modbus Requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
Modbus Function Codes 23 (MB FC) - Read/Write Multiple registers and
N Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Modbus Function Codes 43/14 (MB FC) - Read Device Identification . . 138
Transparent Ready Implementation Class (Twido Serial A05, Ethernet
A15) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Chapter 6 Built-In Analog Functions . . . . . . . . . . . . . . . . . . . . . . . . 143
Analog potentiometer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Analog Channel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
Chapter 7 Managing Analog Modules . . . . . . . . . . . . . . . . . . . . . . . 149
Analog Module Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
Addressing Analog Inputs and Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Configuring Analog Inputs and Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Analog Module Status Information. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Example of Using Analog Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Chapter 8 Twido Extreme Input/Output Configuration . . . . . . . . . 165
8.1 An Introduction to Twido Extreme Inputs and Outputs . . . . . . . . . . . . . . 166
Twido Extreme Addressing Inputs/Outputs (I/O) . . . . . . . . . . . . . . . . . . 166
8.2 Twido Extreme Input Configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
Twido Extreme Discrete Input Configuration . . . . . . . . . . . . . . . . . . . . . 170
Twido Extreme Analog Input Configuration . . . . . . . . . . . . . . . . . . . . . . 175
Twido Extreme PWM Input Configuration. . . . . . . . . . . . . . . . . . . . . . . . 179
Twido Extreme PWM Input Configuration Example . . . . . . . . . . . . . . . . 181
8.3 Twido Extreme Output Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Twido Extreme Discrete Output Configuration . . . . . . . . . . . . . . . . . . . . 188
Twido Extreme Pulse (PLS) Generator Output Configuration . . . . . . . . . 191
Twido Extreme PWM Output Configuration in Standard Mode. . . . . . . . 197
Twido Extreme PWM Output Configuration in Hydraulic Mode . . . . . . . 206
Twido Extreme Hydraulic PWM Output Configuration Example . . . . . . . 214
Chapter 9 Installing the AS-Interface V2 bus . . . . . . . . . . . . . . . . . . 217
Presentation of the AS-Interface V2 Bus . . . . . . . . . . . . . . . . . . . . . . . . . 218
General Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
Software Set up Principles. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
Description of the Configuration Screen for the AS-Interface Bus. . . . . . 224
Configuration of the AS-Interface Bus . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
Description of the AS-Interface Window in Online Mode . . . . . . . . . . . . . 231
4 35011386 06/2011
Modification of Slave Address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Updating the AS-Interface Bus Configuration in Online Mode . . . . . . . . . 237
Automatic Addressing of an AS-Interface V2 Slave . . . . . . . . . . . . . . . . . 241
How to insert a Slave Device into an Existing AS-Interface V2
Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
Automatic Configuration of a Replaced AS-Interface V2 Slave . . . . . . . . 243
Addressing I/Os Associated with Slave Devices Connected to the AS-
Interface V2 Bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Programming and Diagnostics for the AS-Interface V2 Bus . . . . . . . . . . . 246
AS-Interface V2 Bus Interface Module Operating Mode: . . . . . . . . . . . . . 251
Chapter 10 Installing and Configuring the CANopen Fieldbus . . . . 253
10.1 CANopen Fieldbus Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
CANopen Knowledge Base. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
About CANopen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
CANOpen Boot-Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
Process Data Object (PDO) Transmission . . . . . . . . . . . . . . . . . . . . . . . . 262
Access to Data by Explicit Exchanges (SDO) . . . . . . . . . . . . . . . . . . . . . . 264
"Node Guarding" and "Life Guarding" . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
Internal Bus Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
10.2 Implementing the CANopen Bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
Hardware Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
CANOpen Configuration - Default Parameter . . . . . . . . . . . . . . . . . . . . . . 272
Configuration Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
Declaration of a CANopen Master. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
CANopen Configuration Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
CANopen Network Slave Declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
CANopen Objects Mapping (Slaves). . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
CANopen Objects Linking (Master). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
CANopen Objects Symbols. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
Addressing PDOs of the CANopen master . . . . . . . . . . . . . . . . . . . . . . . . 298
Programming and diagnostics for the CANopen fieldbus . . . . . . . . . . . . . 300
CANopen Hot Swap for Twido Controllers . . . . . . . . . . . . . . . . . . . . . . . . 308
Chapter 11 Installing and Configuring the CANJ1939 Fieldbus . . . 309
11.1 CANJ1939 Fieldbus Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
CANJ1939 Knowledge Base . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
CANJ19139 Parameter Group Number and Suspect Parameter Number 313
CANJ1939 Identifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
Communication on a CANJ1939 Network. . . . . . . . . . . . . . . . . . . . . . . . . 316
11.2 Implementing the CANJ1939 Bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
CANJ1939 Implementation Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
Hardware Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
CANJ1939 Configuration Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . 320
CANJ1939 Configuration Dialog Boxes (Element, Network, Port) . . . . . . 323
Creating or Deleting CANJ1939 Transmit/Receive Objects . . . . . . . . . . . 326
35011386 06/2011 5
Viewing CANJ1939 Transmit/Receive objects. . . . . . . . . . . . . . . . . . . . . 333
CANJ1939 Broadcast Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
CANJ1939 Peer-to Peer Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . 338
CANJ1939 Configuration in Expert Mode . . . . . . . . . . . . . . . . . . . . . . . . 340
CANJ1939 Input/Output Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
Request a PGN Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
Chapter 12 Configuring the TwidoPort Ethernet Gateway . . . . . . . . 351
12.1 Normal Configuration and Connection of TwidoPort . . . . . . . . . . . . . . . . 352
Normal Configuration with TwidoSuite. . . . . . . . . . . . . . . . . . . . . . . . . . . 353
BootP Configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
12.2 TwidoPort’s Telnet Configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
Introducing Telnet Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362
Telnet Main Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
IP/Ethernet Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
Serial Parameter Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
Configuring the Gateway . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
Security Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
Ethernet Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
Serial Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
Saving the Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370
Restoring Default Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
Upgrading the TwidoPort Firmware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372
Forgot Your Password and/or IP Configuration? . . . . . . . . . . . . . . . . . . . 374
12.3 Communication Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
Ethernet Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376
Modbus/TCP Communications Protocol . . . . . . . . . . . . . . . . . . . . . . . . . 377
Locally Supported Modbus Function Codes . . . . . . . . . . . . . . . . . . . . . . 378
Chapter 13 Operator Display Operation . . . . . . . . . . . . . . . . . . . . . . . 379
Operator Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380
Controller Identification and State Information. . . . . . . . . . . . . . . . . . . . . 383
System Objects and Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
Serial Port Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392
Time of Day Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393
Real-Time Correction Factor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
Part III Description of Twido Languages . . . . . . . . . . . . . . 397
Chapter 14 Ladder Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399
Introduction to Ladder Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400
Programming Principles for Ladder Diagrams . . . . . . . . . . . . . . . . . . . . . 402
Ladder Diagram Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
Ladder Language Graphic Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407
Special Ladder Instructions OPEN and SHORT . . . . . . . . . . . . . . . . . . . 410
6 35011386 06/2011
Programming Advice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412
Ladder/List Reversibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417
Guidelines for Ladder/List Reversibility . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
Program Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
Chapter 15 Instruction List Language . . . . . . . . . . . . . . . . . . . . . . . . 423
Overview of List Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424
Operation of List Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426
List Language Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427
Using Parentheses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430
Stack Instructions (MPS, MRD, MPP). . . . . . . . . . . . . . . . . . . . . . . . . . . . 433
Chapter 16 Grafcet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435
Description of Grafcet Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436
Description of Grafcet Program Structure . . . . . . . . . . . . . . . . . . . . . . . . . 441
Actions Associated with Grafcet Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . 444
Part IV Description of Instructions and Functions . . . . . . . 447
Chapter 17 Basic Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449
17.1 Boolean Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450
Boolean Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451
Understanding the Format for Describing Boolean Instructions . . . . . . . . 453
Load Instructions (LD, LDN, LDR, LDF) . . . . . . . . . . . . . . . . . . . . . . . . . . 455
Assignment instructions (ST, STN, R, S) . . . . . . . . . . . . . . . . . . . . . . . . . 457
Logical AND Instructions (AND, ANDN, ANDR, ANDF) . . . . . . . . . . . . . . 459
Logical OR Instructions (OR, ORN, ORR, ORF). . . . . . . . . . . . . . . . . . . . 461
Exclusive OR, instructions (XOR, XORN, XORR, XORF). . . . . . . . . . . . . 463
NOT Instruction (N) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465
17.2 Basic Function Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467
Basic Function Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468
Standard function blocks programming principles. . . . . . . . . . . . . . . . . . . 470
Timer Function Block (%TMi) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472
TOF Type of Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474
TON Type of Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475
TP Type of Timer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476
Programming and Configuring Timers . . . . . . . . . . . . . . . . . . . . . . . . . . . 477
Up/Down Counter Function Block (%Ci) . . . . . . . . . . . . . . . . . . . . . . . . . . 480
Programming and Configuring Counters. . . . . . . . . . . . . . . . . . . . . . . . . . 483
Shift Bit Register Function Block (%SBRi) . . . . . . . . . . . . . . . . . . . . . . . . 485
Step Counter Function Block (%SCi) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488
17.3 Numerical Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491
Introduction to Numerical Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492
Assignment Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493
Comparison Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498
Arithmetic Instructions on Integers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500
35011386 06/2011 7
Logic Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 503
Shift Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505
Conversion Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507
Single/Double Word Conversion Instructions . . . . . . . . . . . . . . . . . . . . . 509
17.4 Program Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511
END Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512
NOP Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514
Jump Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515
Subroutine Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517
Chapter 18 Advanced Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . 519
18.1 Advanced Function Blocks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 520
Bit and Word Objects Associated with Advanced Function Blocks . . . . . 521
Programming Principles for Advanced Function Blocks . . . . . . . . . . . . . 523
LIFO/FIFO Register Function Block (%Ri). . . . . . . . . . . . . . . . . . . . . . . . 525
LIFO Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527
FIFO Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528
Programming and Configuring Registers. . . . . . . . . . . . . . . . . . . . . . . . . 529
Pulse Width Modulation Function Block (%PWM) . . . . . . . . . . . . . . . . . . 532
Pulse Generator Output Function Block (%PLS) . . . . . . . . . . . . . . . . . . . 536
Drum Controller Function Block (%DR) . . . . . . . . . . . . . . . . . . . . . . . . . . 539
Drum Controller Function Block %DRi Operation . . . . . . . . . . . . . . . . . . 541
Programming and Configuring Drum Controllers. . . . . . . . . . . . . . . . . . . 543
Fast Counter Function Block (%FC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545
Very Fast Counter Function Block (%VFC) . . . . . . . . . . . . . . . . . . . . . . . 548
Transmitting/Receiving Messages - the Exchange Instruction (EXCH). . 559
Exchange Control Function Block (%MSGx) . . . . . . . . . . . . . . . . . . . . . . 560
18.2 Clock Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564
Clock Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565
Schedule Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566
Time/Date Stamping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569
Setting the Date and Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 571
18.3 Twido PID Quick Start Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 575
Purpose of Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 576
Step 1 - Configuration of Analog Channels Used for Control . . . . . . . . . 578
Step 2 - Prerequisites for PID Configuration . . . . . . . . . . . . . . . . . . . . . . 580
Step 3 – Configuring the PID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 582
Step 4 - Initialization of Control Set-Up . . . . . . . . . . . . . . . . . . . . . . . . . . 588
Step 5 - Control Set-Up AT + PID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 592
Step 6 - Debugging Adjustments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596
18.4 PID Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 598
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 599
Principal of the Regulation Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 600
Development Methodology of a Regulation Application . . . . . . . . . . . . . 601
Compatibilities and Performances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 602
Detailed Characteristics of the PID Function . . . . . . . . . . . . . . . . . . . . . . 603
8 35011386 06/2011
How to Access the PID Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607
PID Screen Elements of PID Function . . . . . . . . . . . . . . . . . . . . . . . . . . . 608
General Tab of PID function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 613
Input Tab of the PID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 616
PID Tab of PID function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 618
AT Tab of PID Function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 621
Output Tab of the PID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 626
How to Access PID Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 629
Animation Tab of PID Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 630
Trace Screen of PID Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 633
PID States and Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 635
PID Tuning with Auto-Tuning (AT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 639
PID Parameter Adjustment Method. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 647
Role and Influence of PID Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . 650
Appendix 1: PID Theory Fundamentals . . . . . . . . . . . . . . . . . . . . . . . . . . 654
Appendix 2: First-Order with Time Delay Model . . . . . . . . . . . . . . . . . . . . 656
18.5 Floating point instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 658
Arithmetic Instructions on Floating Point . . . . . . . . . . . . . . . . . . . . . . . . . . 659
Trigonometric Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 663
Conversion instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 665
Integer Conversion Instructions <-> Floating . . . . . . . . . . . . . . . . . . . . . . 667
18.6 ASCII instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 670
ROUND Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 671
ASCII to Integer Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 673
Integer to ASCII Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 675
ASCII to Float Conversion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 677
Float to ASCII Conversion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 679
18.7 Instructions on Object Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681
Table Summing Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682
Table Comparison Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 684
Table Search Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 686
Table Search Functions for Maximum and Minimum Values . . . . . . . . . . 688
Number of Occurrences of a Value in a Table . . . . . . . . . . . . . . . . . . . . . 689
Table Rotate Shift Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690
Table Sort Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 692
Floating Point Table interpolation Function . . . . . . . . . . . . . . . . . . . . . . . . 694
Mean Function of the Values of a Floating Point Table . . . . . . . . . . . . . . 699
Chapter 19 System Bits and System Words . . . . . . . . . . . . . . . . . . . 701
System Bits (%S) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 702
System Words (%SW). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 710
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 725
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 741
35011386 06/2011 9
10 35011386 06/2011
Safety Information
§
Important Information
NOTICE
Read these instructions carefully, and look at the equipment to become familiar with
the device before trying to install, operate, or maintain it. The following special
messages may appear throughout this documentation or on the equipment to warn
of potential hazards or to call attention to information that clarifies or simplifies a
procedure.
35011386 06/2011 11
PLEASE NOTE
Electrical equipment should be installed, operated, serviced, and maintained only by
qualified personnel. No responsibility is assumed by Schneider Electric for any
consequences arising out of the use of this material.
A qualified person is one who has skills and knowledge related to the construction
and operation of electrical equipment and its installation, and has received safety
training to recognize and avoid the hazards involved.
12 35011386 06/2011
About the Book
At a Glance
Document Scope
This is the Software Reference manual for Twido programmable controllers and
consists of the following major parts:
z Description of the Twido programming software and an introduction to the
fundamentals needed to program Twido controllers.
z Description of communications, managing analog I/O, installing the AS-Interface
bus interface module, the CANopen fieldbus master module and other special
functions.
z Description of the software languages used to create Twido programs.
z Description of instructions and functions of Twido controllers.
Validity Note
The information in this manual is applicable only for Twido programmable
controllers. This documentation is valid for TwidoSuite Version 2.3.
User Comments
We welcome your comments about this document. You can reach us by e-mail at
[email protected].
35011386 06/2011 13
14 35011386 06/2011
TwidoSuite V2.3
Twido Software
35011386 06/2011
I
Subject of this Part
This part provides an introduction to the software languages and the basic
information required to create control programs for Twido programmable controllers.
35011386 06/2011 15
Twido Software
16 35011386 06/2011
TwidoSuite V2.3
TwidoSuite Languages
35011386 06/2011
Introduction to TwidoSuite
1
Subject of this Chapter
This chapter provides a brief introduction to TwidoSuite, the programming and
configuration software for Twido controllers, and to the List, Ladder, and Grafcet
programming languages.
35011386 06/2011 17
TwidoSuite Languages
Introduction to TwidoSuite
Introduction
TwidoSuite is a full-featured, graphical development environment for creating,
configuring, and maintaining automation applications for Schneider Electric Twido
programmable controllers. TwidoSuite allows you to create programs with different
types of languages (see page 19), and then transfer the application to run on a
controller.
TwidoSuite
TwidoSuite is a 32-bit Windows-based program for a personal computer (PC)
running Microsoft Windows 2000/XP Professional/Vista operating systems.
The main software features of TwidoSuite:
z Project-oriented, intuitive user-interface
z Menu-free software design. All tasks and functions of a selected project step
show at all times.
z Programming and configuration support
z Communication with controller
z Task-level, first-hand help providing relevant links to the online help
NOTE: The Controller-PC link uses the TCP/IP protocol. It is essential for this
protocol to be installed on the PC.
Minimum configuration
The minimum configuration for using TwidoSuite is:
z PC-compatible computer with
z processor Pentium 466 MHz or higher recommended,
z 128 MB of RAM or higher recommended,
z 100 MB of hard disk space.
18 35011386 06/2011
TwidoSuite Languages
Introduction
A programmable controller reads inputs, writes to outputs, and solves logic based
on a control program. Creating a control program for a Twido controller consists of
writing a series of instructions in one of the Twido programming languages.
Twido Languages
The following languages can be used to create Twido control programs:
z Instruction List Language:
An Instruction List program is a series of logical expressions written as a
sequence of Boolean instructions.
z Ladder Diagrams:
A Ladder diagram is a graphical means of displaying a logical expression.
z Grafcet Language:
Grafcet language is made up of a series of steps and transitions. Twido supports
the use of Grafcet list instructions, but not graphical Grafcet.
You can use a personal computer (PC) to create and edit Twido control programs
using these programming languages.
A List/Ladder reversibility feature allows you to conveniently reverse a program from
Ladder to List and from List to Ladder.
35011386 06/2011 19
TwidoSuite Languages
Ladder Diagrams
Ladder diagrams are similar to relay logic diagrams that represent relay control
circuits. Graphic elements such as coils, contacts, and blocks represent instructions.
The following is an example of a Ladder diagram.
20 35011386 06/2011
TwidoSuite Languages
Grafcet Language
The Grafcet analytical method divides any sequential control system into a series of
steps, with which actions, transitions, and conditions are associated. The following
illustration shows examples of Grafcet instructions in List and Ladder programs
respectively.
35011386 06/2011 21
TwidoSuite Languages
22 35011386 06/2011
TwidoSuite V2.3
Twido Language Objects
35011386 06/2011
2
Subject of this Chapter
This chapter provides details about the language objects used for programming
Twido controllers.
35011386 06/2011 23
Twido Language Objects
Introduction
Word and bit objects are valid if memory space has been allocated in the controller.
To do this, they must be used in the application before they are downloaded to the
controller.
Example
The range of valid objects is from zero to the maximum reference for that object type.
For example, if your application’s maximum references for memory words is %MW9,
then %MW0 through %MW9 are allocated space. %MW10 in this example is not
valid and can not be accessed either internally or externally.
24 35011386 06/2011
Twido Language Objects
Bit Objects
Introduction
Bit objects are bit-type software variables that can be used as operands and tested
by Boolean instructions. The following is a list of bit objects:
z I/O bits
z Internal bits (memory bits)
z System bits
z Step bits
z Bits extracted from words
35011386 06/2011 25
Twido Language Objects
Legends:
1. Written by the program or by using the Animation Tables Editor.
2. See I/O Addressing.
3. Number is determined by controller model.
4. Where, x = address of the expansion module (0..7); y = AS-Interface address
(0A..31B); z = channel number (0..3). (See Addressing I/Os Associated with
Slave Devices Connected to the AS-Interface V2 Bus, page 244.)
5. Except for %SBRi.j and %SCi.j, these bits can be read and written.
26 35011386 06/2011
Twido Language Objects
Word Objects
Introduction
Word objects that are addressed in the form of 16-bit words that are stored in data
memory and can contain an integer value between -32768 and 32767 (except for
the fast counter function block which is between 0 and 65535).
Examples of word objects:
z Immediate values
z Internal words (%MWi) (memory words)
z Constant words (%KWi)
z I/O exchange words (%IWi, %QWi%)
z AS-Interface analog I/O words (IWAi, %QWAi)
z System words (%SWi)
z Function blocks (configuration and/or runtime data)
Word Formats
The contents of the words or values are stored in user memory in 16-bit binary code
(two’s complement) using the following convention:
In signed binary notation, bit 15 is allocated by convention to the sign of the coded
value:
z Bit 15 is set to 0: the content of the word is a positive value.
z Bit 15 is set to 1: the content of the word is a negative value (negative values are
expressed in two’s complement logic).
Words and immediate values can be entered or retrieved in the following format:
z Decimal
Min.: -32768, Max.: 32767 (1579, for example)
z Hexadecimal
Min.: 16#0000, Max.: 16#FFFF (for example, 16#A536)
Alternate syntax: #A536
z ASCII format rules as follows:
z The function always reads the Most Significant Byte first.
z Any ASCII character that is not in the interval [’0’ - ’9’] ([16#30 - 16#39]) is
considered to be an end character, except for a minus sign ’-’ (16#2D ) when
it is placed as the first character.
35011386 06/2011 27
Twido Language Objects
28 35011386 06/2011
Twido Language Objects
NOTE:
1. Written by the program or by using the Animation Tables Editor.
2. Where, x = address of the expansion module (0..7); y = AS-Interface address
(0A..31B); z = channel number (0..3). (See Addressing I/Os Associated with
Slave Devices Connected to the AS-Interface V2 Bus, page 244.)
3. Number is determined by the configuration.
35011386 06/2011 29
Twido Language Objects
Introduction
TwidoSuite allows you to perform operations on floating point and double integer
word objects.
A floating point is a mathematical argument which has a decimal in its expression
(examples: 3.4E+38, 2.3 or 1.0).
A double integer word consists of 4 bytes stored in data memory and containing a
value between -2147483648 and +2147483647.
The value as expressed in the above format is determined by the following equation:
30 35011386 06/2011
Twido Language Objects
Hardware compatibility
Floating point and double word operations are not supported by all Twido
controllers.
The following table shows hardware compatibility:
35011386 06/2011 31
Twido Language Objects
Validity Check
When the result is not within the valid range, the system bit %S18 is set to 1.
The status word %SW17 bits indicate the cause of a detected error in a floating
operation:
Different bits of the word %SW17:
This word is reset to 0 by the system on cold start, and also by the program for re-
usage purposes.
32 35011386 06/2011
Twido Language Objects
The following table shows how floating and double internal words overlap:
The following table shows how floating and double constants overlap:
Example:
%MF0 corresponds to %MW0 and %MW1. %KF543 corresponds to %KW543 and
%KW544.
35011386 06/2011 33
Twido Language Objects
Syntax
Use the following format to address internal, system, and step bit objects:
Description
The following table describes the elements in the addressing format.
Examples:
z %MW5:X6 = bit number 6 of internal word %MW5
z %QW5.1:X10 = bit number 10 of output word %QW5.1
34 35011386 06/2011
Twido Language Objects
Introduction
Addressing word objects, except for input/output addressing (see Addressing
Inputs/Outputs, page 38) and function blocks (see Function Block Objects,
page 41), follows the format described below.
Syntax
Use the following format to address internal, constant and system words:
Description
The following table describes the elements in the addressing format.
35011386 06/2011 35
Twido Language Objects
Introduction
Addressing floating objects, except for input/output addressing (see Addressing
Inputs/Outputs, page 38) and function blocks (see Function Block Objects,
page 41), follows the format described below.
Syntax
Use the following format to address internal and constant floating objects:
Description
The following table describes the elements in the addressing format.
36 35011386 06/2011
Twido Language Objects
Introduction
Addressing double word objects, except for input/output addressing (see
Addressing Inputs/Outputs, page 38) and function blocks (see Function Block
Objects, page 41), follows the format described below.
Syntax
Use the following format to address internal and constant double words:
Description
The following table describes the elements in the addressing format.
35011386 06/2011 37
Twido Language Objects
Addressing Inputs/Outputs
Introduction
Each input/output (I/O) point in a Twido configuration has a unique address: For
example, the address "%I0.0.4" is assigned to input 4 of a controller.
I/O addresses can be assigned for the following hardware:
z Controller configured as Remote Link Master
z Controller configured as Remote I/O
z Expansion I/O modules
The TWDNOI10M3 AS-Interface bus interface module and the TWDNCO1M
CANopen fieldbus module each uses its own special address system for addressing
the I/Os of slave devices connected to its bus:
z For TWDNOI10M3, refer Addressing I/Os associated with slave devices
connected to the AS-Interface V2 bus (see page 244).
z For TWDNCO1M, refer Addressing PDOs of the CANopen Master
(see page 298).
CAUTION
UNINTENDED EQUIPMENT OPERATION
Be sure that you are certain that duplicate outputs or coils will not result in
undesired behaviour of your controller.
Failure to follow these instructions can result in injury or equipment damage.
Format
Use the following format to address inputs/outputs.
38 35011386 06/2011
Twido Language Objects
Description
The table below describes the I/O addressing format.
Examples
The table below shows some examples of I/O addressing.
35011386 06/2011 39
Twido Language Objects
Network Addressing
Introduction
Application data is exchanged between peer controllers and the master controller on
a Twido Remote Link network by using the network words %INW and %QNW. See
Communications, page 69 for more details.
Format
Use the following format for network addressing.
Description of Format
The table below describes the network addressing format.
Examples
The table below shows some examples of networking addressing.
40 35011386 06/2011
Twido Language Objects
Introduction
Function blocks provide bit objects and specific words that can be accessed by the
program.
Bit Objects
Bit objects correspond to the block outputs. These bits can be accessed by Boolean
test instructions using either of the following methods:
z Directly (for example, LD E) if they are wired to the block in reversible
programming (see Standard function blocks programming principles, page 470).
z By specifying the block type (for example, LD %Ci.E).
Inputs can be accessed in the form of instructions.
Word Objects
Word objects correspond to specified parameters and values as follows:
z Block configuration parameters: some parameters are accessible by the program
(for example, pre-selection parameters), and some are inaccessible by the
program (for example, time base).
z Current values: for example, %Ci.V, the current count value.
35011386 06/2011 41
Twido Language Objects
42 35011386 06/2011
Twido Language Objects
Structured Objects
Introduction
Structured objects are combinations of adjacent objects. Twido supports the
following types of structured objects:
z Bit Strings
z Tables of words
z Tables of double words
z Tables of floating words
Bit Strings
Bit strings are a series of adjacent object bits of the same type and of a defined
length (L).
Example:Bit string %M8:6
Key:
1. Only I/O bits 0 to 16 can be read in bit string. For controllers with 24 inputs and
32 I/O modules, bits over 16 cannot be read in bit string.
35011386 06/2011 43
Twido Language Objects
Tables of words
Word tables are a series of adjacent words of the same type and of a defined length
(L).
Example:Word table %KW10:7
Word tables can be used with the Assignment instruction (see Assignment
Instructions, page 493).
Double word tables can be used with the Assignment instruction (see Assignment
Instructions, page 493).
44 35011386 06/2011
Twido Language Objects
Floating point tables can be used with the Assignment instruction (see Advanced
instructions).
35011386 06/2011 45
Twido Language Objects
Indexed Objects
Introduction
An indexed word is a single or double word or floating point with an indexed object
address. There are two types of object addressing:
z Direct addressing
z Indexed addressing
Direct Addressing
A direct address of an object is set and defined when a program is written.
Example: %M26 is an internal bit with the direct address 26.
Indexed Addressing
An indexed address of an object provides a method of modifying the address of an
object by adding an index to the direct address of an object. The content of the index
is added to the object’s direct address. The index is defined by an internal word
%MWi. The number of "index words" is unlimited.
Example: %MW108[%MW2] is a word with an address consisting of the direct
address 108 plus the contents of word %MW2.
If word %MW2 has a value of 12, writing to %MW108[%MW2] is equivalent to writing
to %MW120 (108 plus 12).
46 35011386 06/2011
Twido Language Objects
Indexed objects can be used with the assignment instructions (see Assignment
Instructions, page 493 for single and double words) and in comparison instructions
(see Comparison Instructions, page 498 for single and double words). This type of
addressing enables series of objects of the same type (such as internal words and
constants) to be scanned in succession, by modifying the content of the index object
via the program.
35011386 06/2011 47
Twido Language Objects
Symbolizing Objects
Introduction
You can use Symbols to address TwidoSuite language objects by name or
customized mnemonics. Using symbols allows for quick examination and analysis
of program logic, and greatly simplifies the development and testing of an
application.
Example
For example, WASH_END is a symbol that could be used to identify a timer function
block that represents the end of a wash cycle. Recalling the purpose of this name
should be easier than trying to remember the role of a program address such as
%TM3.
Editing Symbols
Symbols are defined and associated with language objects in the Symbol Editor.
Symbols and their comments are stored with the application on the PC hard drive,
but are not stored on the controller. Therefore, they can not be transferred with the
application to the controller.
48 35011386 06/2011
TwidoSuite V2.3
User Memory
35011386 06/2011
User Memory
3
Subject of this Chapter
This chapter describes the structure and usage of Twido user memory.
35011386 06/2011 49
User Memory
Introduction
The controller memory accessible to your application is divided into two distinct sets:
z Bit values
z Word values (16-bit signed values) and double word values (32-bit signed values)
Bit Memory
The bit memory is located in the controller’s built-in RAM. It contains the map of 128
bit objects.
Word Memory
The word memory (16 bits) supports:
z Dynamic words: runtime memory (stored in RAM only).
z Memory words (%MW) and double words (%MD): dynamic system data and
system data.
z Program: descriptors and executable code for tasks.
z Configuration data: constant words, initial values, and input/output
configuration.
50 35011386 06/2011
User Memory
Saving Memory
Your controller’s program and memory words can be saved in the following:
z RAM (for up to 30 days with good battery)
z EEPROM (maximum of 32 kB)
Transferring the program from the EEPROM memory to the RAM memory is done
automatically when the program is lost in RAM (or if there is no battery). The
Twido Extreme TWDLEDCK1 has no internal battery.
Manual transfer can also be performed using TwidoSuite.
Compact Controllers
Memory Type 10DRF 16DRF 24DRF 40DRF 40DRF**
(32 kB) (64 kB)
Internal RAM 10 kB 10 kB 10 kB 10 kB 10 kB
Mem 1*
External RAM 16 kB 32 kB 32 kB 64 kB
Mem 2*
Internal EEPROM 8 kB 16 kB 32 kB 32 kB 32 kB***
External EEPROM 32 kB 32 kB 32 kB 32 kB 64 kB
Maximum program size 8 kB 16 kB 32 kB 32 kB 64 kB
Maximum external 8 kB 16 kB 32 kB 3 2kB 64 kB
backup
Modular Controllers
Memory Type 20DUK 20DRT 20DRT
20DTK 40DUK 40DUK
40DTK (32 kB) 40DTK** (64 kB)
Internal RAM 10 kB 10 kB 10 kB
Mem 1*
External RAM 32 kB 32 kB 64 kB
Mem 2*
Internal EEPROM 32 kB 32 kB 32 kB***
35011386 06/2011 51
User Memory
Modular Controllers
Memory Type 20DUK 20DRT 20DRT
20DTK 40DUK 40DUK
40DTK (32 kB) 40DTK** (64 kB)
External EEPROM 32 kB 32 kB 64 kB
Maximum program size 32 kB 32 kB 64 kB
Maximum external 32 kB 32 kB 64 kB
backup
52 35011386 06/2011
User Memory
Introduction
The following information details backup and restore memory functions in modular
and compact controllers without a backup cartridge or extended memory plugged in.
This section does not apply to the Twido Extreme PLC (TWDLEDCK1) which also
has no backup cartridge. This is described in Twido Extreme User Memory.
At a Glance
Twido programs, memory words and configuration data can be backed up using the
controllers internal EEPROM. Because saving a program to the internal EEPROM
clears any previously backed up memory words, the program must be backed up
first, then the configured memory words. Dynamic data can be stored in memory
words then backed up to the EEPROM. If there is no program saved to the internal
EEPROM you cannot save memory words to it.
Memory Structure
Here is a diagram of a controller’s memory structure. The arrows show what can be
backed up to the EEPROM from RAM:
35011386 06/2011 53
User Memory
Program Backup
Here are the steps for backing up your program into EEPROM.
Step Action
1 The following must be true:
There is a valid program in RAM.
2 From the TwidoSuite window, select See Memory Information from Program
→Debug →Check PLC and click Save.
Note: Check PLC can only be used in connected mode.
Program Restore
During power up there is one way the program will be restored to RAM from the
EEPROM (assuming there is no cartridge or extended memory in place):
z The RAM program is not valid
Step Action
1 For this to work the following must be true:
A valid program in RAM (%SW96:X6=1).
The same valid program already backed up into the EEPROM.
Memory words configured in the program.
2 Set %SW97 to the length of the memory words to be saved.
Note: Length cannot exceed the configured memory word length, and it must be
greater than 0 but not greater than 512.
3 Set %SW96:X0 to 1.
54 35011386 06/2011
User Memory
Introduction
The following information details backup and restore memory functions in modular
and compact controllers using a 32K backup cartridge.
This section does not apply to the Twido Extreme PLC (TWDLEDCK1) which has
no backup cartridge. This is described in Twido Extreme User Memory.
At a Glance
The backup cartridge is used to save a program and transfer that program to other
Twido controllers. It should be removed from a controller and set aside once the
program has been installed or saved. Only program and configuration data can be
saved to the cartridge (%MWs cannot be saved to the 32K backup cartridge).
Dynamic data can be stored in memory words then backed up to the EEPROM.
When program installation is complete any %MWs that were backed up to the
internal EEPROM prior to installation will be lost.
35011386 06/2011 55
User Memory
Memory Structure
Here is a diagram of a controller’s memory structure with the backup cartridge
attached. The arrows show what can be backed up to the EEPROM and cartridge
from RAM:
Program Backup
Here are the steps for backing up your program into the backup cartridge:
Step Action
1 Power down the controller.
2 Plug in the backup cartridge.
3 Powerup the controller.
4 From the TwidoSuite window, select Memory Cartridge Commands from
Program →Debug, select a connection and click Backup.
5 Power down the controller.
6 Remove backup cartridge from controller.
56 35011386 06/2011
User Memory
Program Restore
To load a program saved on a backup cartridge into a controller do the following:
Step Action
1 Power down the controller.
2 Plug in the backup cartridge.
3 Powerup the controller.
(If Auto Start is configured you must power cycle again to get to run mode.)
4 Power down the controller.
5 Remove backup cartridge from controller.
Step Action
1 For this to work the following must be true:
A valid program in RAM.
The same valid program already backed up into the EEPROM.
Memory words configured in the program.
2 Set %SW97 to the length of the memory words to be saved.
Note Length cannot exceed the configured memory word length, and it must be
greater than 0 but not greater than 512.
3 Set %SW96:X0 to 1.
35011386 06/2011 57
User Memory
Introduction
The following information details using the memory functions in modular controllers
using a 64K extended memory cartridge.
At a Glance
The 64K extended memory cartridge is used to extend the program memory
capability of your Twido controller from 32K to 64K. It must remain plugged into the
controller as long as the extended program is being used. If the cartridge is removed
the controller will enter the stopped state. Memory words are still backed up into the
EEPROM in the controller. Dynamic data can be stored in memory words then
backed up to the EEPROM. The 64K extended memory cartridge has the same
power up behavior as the 32K backup cartridge.
58 35011386 06/2011
User Memory
Memory Structure
Here is a diagram of a controller’s memory structure using an extended memory
cartridge. The arrows show what is backed up into the EEPROM and the 64K
extended memory cartridge from RAM:
Step Action
1 Under the Hardware option menu on you TwidoSuite window enter
‘TWDXCPMFK64’.
2 Power down the controller.
3 Plug in the 64K extended memory cartridge.
4 Powerup the controller.
35011386 06/2011 59
User Memory
Step Action
1 For this to work the following must be true:
A valid program is present
Memory words are configured in the program.
2 Set %SW97 to the length of the memory words to be saved.
Note: Length cannot exceed the configured memory word length, and it must be
greater than 0 but not greater than 512.
3 Set %SW96:X0 to 1.
60 35011386 06/2011
TwidoSuite V2.3
Event task management
35011386 06/2011
4
Subject of this Chapter
This chapter describes event tasks and how they are executed in the controller.
NOTE: Event tasks are not managed by the Twido Brick 10 controller
(TWDLCAA10DRF).
35011386 06/2011 61
Event task management
Introduction
The previous chapter presented periodic and cyclic tasks in which objects are
updated at the start and end of the task. Event sources may cause a certain task to
be stopped while higher priority (event) tasks are executed to allow objects to be
updated more quickly.
An event task:
z is a part of a program executed when a given condition is met (event source),
z has a higher priority than the main program,
z produces a rapid response time enabling the overall response time of the system
to be reduced.
Description of an Event
An event is composed of:
z an event source which can be defined as a software or hardware interrupt
condition to interrupt the main program (see page 63),
z a section which is an independent programmed entity related to an event,
z an event queue which can be used to store a list of events until they are executed,
z a priority level which specifies the order of event execution.
62 35011386 06/2011
Event task management
An event source can only be attached to a single event, and must be immediately
detected by TwidoSuite. Once it is detected, the software executes the
programming section attached to the event: each event is attached to a subroutine
labeled SRi: defined on configuration of the event sources.
35011386 06/2011 63
Event task management
Periodic event
This event periodically executes a single programming section. This task has higher
priority than the main task (master).
However, this event source has lower priority than the other event sources.
The period of this task is set on configuration, from 5 to 255 ms. Only one periodic
event can be used.
For further details on configuring this event, refer to the section entitled "Configuring
Program Parameters -> Scan Mode" in the "TwidoSuite Operation Guide" on-line
help.
64 35011386 06/2011
Event task management
Event Management
Step Description
1 Interrupt management:
z recognition of the physical interrupt,
z event stored in the suitable event queue,
z verification that no event of the same priority is pending (if so the event
stays pending in the queue).
2 Save context.
3 Execution of the programming section (subroutine labeled SRi:) linked to the
event.
4 Updating of output
5 Restore context
Before the context is re-established, all the events in the queue must be executed.
Event check
System bits and words are used to check the events (see page 701):
z %S31: used to execute or delay an event,
z %S38: used to decide whether or not to place events in the events queue,
z %S39: used to find out if events are lost,
z %SW48: shows how many events have been executed since the last cold start
(counts all events except periodic events.)
35011386 06/2011 65
Event task management
The value of bit %S39 and word %SW48 is reset to zero and that of %S31 and %S38
is set to its initial state 1 on a cold restart or after an application is loaded, but
remains unchanged after a warm restart. In all cases, the events queue is reset.
66 35011386 06/2011
TwidoSuite V2.3
Special Functions
35011386 06/2011
Special Functions
II
Subject of this Part
This part describes communications, built-in analog functions, managing analog I/O
modules, installing the AS-Interface V2 bus and the CANopen fieldbus for Twido
controllers.
35011386 06/2011 67
Special Functions
68 35011386 06/2011
TwidoSuite V2.3
Communications
35011386 06/2011
Communications
5
Subject of this Chapter
This chapter provides an overview of configuring, programming, and managing
communications available with Twido controllers.
35011386 06/2011 69
Communications
At a Glance
Twido provides one or two serial communications ports used for communications to
remote I/O controllers, peer controllers, or general devices. Either port, if available,
can be used for any of the services, with the exception of communicating with
TwidoSuite, which can only be performed using the first port. Three different base
protocols are supported on each Twido controller: Remote Link, ASCII, or Modbus
(modbus master or modbus slave).
Moreover, the TWDLC•E40DRF compact controllers provide one RJ45 Ethernet
communications port. They support the Modbus TCP/IP client/server protocol for
peer-to-peer communications between controllers over the Ethernet network.
The TWDLEDCK1 Twido Extreme controller has only one serial port and supports
Modbus, ASCII, Ethernet and BlueTooth communications.
Remote Link
The remote link is a high-speed master/slave bus designed to communicate a small
amount of data between the master controller and up to seven remote (slave)
controllers. Application or I/O data is transferred, depending on the configuration of
the remote controllers. A mixture of remote controller types is possible, where some
can be remote I/O and some can be peers.
Remote link is not supported (neither serial RS485 nor CANJ1939) by the
TWDLEDCK1 Twido Extreme controller.
ASCII
The ASCII protocol is a simple half-duplex character mode protocol used to transmit
and/or receive a character string to/from a simple device (printer or terminal). This
protocol is supported only via the "EXCH" instruction.
For the TWDLEDCK1 Twido Extreme controller, if ASCII is used then 0V must be
applied to the communication strap contact (pin 22) to enable communication.
Modbus
The Modbus protocol is a master/slave protocol that allows for one, and only one,
master to request responses from slaves, or to act based on the request. The master
can address individual slaves, or can initiate a broadcast message to all slaves.
Slaves return a message (response) to queries that are addressed to them
individually. Responses are not returned to broadcast queries from the master.
70 35011386 06/2011
Communications
Modbus master - The modbus master mode allows the Twido controller to send a
modbus query to a slave and await its reply. The modbus master mode is supported
only via the "EXCH" instruction. Both Modbus ASCII and RTU are supported in
modbus master mode.
NOTE: It is possible to send a Modbus request to an IP slave that would not be
declared in the IP Slave List.
Modbus Slave - The modbus slave mode allows the Twido controller to respond to
modbus queries from a modbus master, and is the default communications mode if
no other type of communication is configured. The Twido controller supports the
standard modbus data and control functions and service extensions for object
access. Both Modbus ASCII and RTU are supported in modbus slave mode.
Furthermore, il is possible to change the IP address / IP sub mask and IP gateway
through some %SW without modifying the application.
NOTE: 32 devices (without repeaters) can be installed on an RS485 network (1
master and up to 31 slaves), the addresses of which can be between 1 and 247.
Modbus TCP/IP
NOTE: Modbus TCP/IP is solely supported by TWDLC•E40DRF series of compact
controllers with built-in Ethernet network interface.
The following information describes the Modbus Application Protocol (MBAP).
The Modbus Application Protocol (MBAP) is a layer-7 protocol providing peer-to-
peer communication between programmable logic controllers (PLCs) and other
nodes on a LAN.
The current Twido controller TWDLC•E40DRF implementation transports Modbus
Application Protocol over TCP/IP on the Ethernet network. Modbus protocol
transactions are typical request-response message pairs. A PLC can be either client
or server depending on whether it is querying or answering messages.
35011386 06/2011 71
Communications
At a Glance
Each Twido controller has a built-in EIA RS485 terminal port, with its own internal
power supply, on Port 1. (The TWDLEDCK1 Twido Extreme controller has only one
serial port). Port 1 must be used to communicate with the TwidoSuite programming
software.
No optional cartridge or communication module can be used for this port. A modem,
however, can be used on this port.
There are several ways to connect the PC to the Twido controller RS485 Port 1:
z By TSX PCX cable,
z By telephone line: Modem connection,
z By Bluetooth for the TWDLEDCK1 Twido Extreme controller using a Bluetooth
adapter (dongle) VW3 A8114.
Moreover, the TWDLC•E40DRF compact controllers have a built-in RJ45 Ethernet
network connection port that can be used to communicate with the Ethernet-capable
PC running the TwidoSuite programming software.
There are two ways for the Ethernet-capable PC to communicate with a
TWDLC•E40DRF Twido controller RJ45 port:
z By direct cable connection via a UTP Cat5 RJ45 Ethernet crossover cable (not
recommended),
z By connection to the Ethernet network via a SFTP Cat5 RJ45 Ethernet cable
available from the Schneider Electric catalog (cable reference: 490NTW000••).
The TWDLEDCK1 Twido Extreme controller can also be connected to the Ethernet
network using a OSITRACK XGS Z33ETH Modbus-Ethernet connection box.
WARNING
UNINTENDED EQUIPMENT OPERATION
Use TwidoSuite to properly disconnect a TSX PCX1031, TSX CRJMD25, or
Ethernet communication cable before physically removing a cable from one
controller and rapidly reinserting into another, as TwidoSuite may not sense the
disconnection if done rapidly.
Failure to follow these instructions can result in death, serious injury, or
equipment damage.
72 35011386 06/2011
Communications
NOTE: For this cable, the DPT signal on pin 5 is not tied to 0V. This indicates to the
controller that the current connection is a TwidoSuite connection. The signal is
pulled up internally, informing the firmware executive that this is a TwidoSuite
connection.
For the TWDLEDCK1 Twido Extreme controller, if the ASCII protocol is used then
0V must be applied to the communication strap contact (pin 22) to enable
communication.
35011386 06/2011 73
Communications
NOTE: For this cable, the DPT signal on pin 5 is not tied to 0V. This indicates to the
controller that the current connection is a TwidoSuite connection. The signal is
pulled up internally, informing the firmware executive that this is a TwidoSuite
connection.
For the TWDLEDCK1 Twido Extreme controller, if the ASCII protocol is used then
0V must be applied to the communication strap contact (pin 22) to enable
communication.
74 35011386 06/2011
Communications
The following figure shows the pin outs of a SubD female 9-pin connector for the
TSX PCX1031.
35011386 06/2011 75
Communications
76 35011386 06/2011
Communications
The Twido TWDLC•E40DRF bases feature a RJ45 connector to connect to the 100
BASE-TX network Ethernet with auto negotiation. It can accomodate both 100Mbps
and 10 Mbps network speeds.
NOTE: It is also possible to use an ConneXium TwidoPort Ethernet interface module
499TWD01100 for Ethernet connection. Configuring the TwidoPort
(see page 353)explains how to declare and configure this module in TwidoSuite.
An Ethernet connection example for the Twido Extreme TWDLEDCK1 is provided
below.
The following figure shows the RJ45 connector of the Twido controller:
The eight pins of the RJ45 connector are arranged vertically and numbered in order
from bottom to top. The pinout for the RJ45 connector is described in the table
below:
NOTE:
z The same connector and pinout is used for both 10Base-T and 100Base-TX.
z When connecting the Twido controller to a 100Base-TX network, you should use
at least a category 5 Ethernet cable.
35011386 06/2011 77
Communications
78 35011386 06/2011
Communications
General
A PC executing TwidoSuite can be connected to a Twido controller for transferring
applications, animating objects and executing operator mode commands. It is also
possible to connect a Twido controller to other devices, such as another Twido
controller, for establishing communication with the application process.
35011386 06/2011 79
Communications
Bluetooth Connection
Bluetooth connection is also possible for Twido controllers, via a Bluetooth adapter
(dongle) VW3 A8114. PCs not fitted with integrated Bluetooth can be used with the
Bluetooth PC adapter VW3 A8115.
Establishing Connection
The default communication connection between TwidoSuite and the Twido
controller is made by a serial communication port, using the TSX PCX1031 cable
and a crossed adapter. For more details, refer Appendix 1 (see page 88). For the
Twido Extreme TWDLEDCK1 the VW3 A8106 cable is required for serial
connection.
If a modem is used to connect the PC, this must be indicated in the TwidoSuite
software.
80 35011386 06/2011
Communications
35011386 06/2011 81
Communications
In this case, 2 serial ports are displayed (Com1 and Com2), as well as a modem
connection showing a TOSHIBA V.90 model configured to compose the number:
xxxxxxxxxx (modem number).
NOTE: Compose the number in adjacent number format.
You can change the name of each connection for application maintenance purposes
(COM1 or COM2 cannot be changed).
This is how you define and select the connection you wish to use for connecting your
PC to a modem.
However, this is just part of the process for making an overall connection between
the computer and the Twido controller.
The next step involves the Twido controller. The remote Twido must be connected
to a modem.
All modems need to be initialized to establish a connection. The Twido controller
containing at least version V2.0 firmware is capable, on power-up, of sending an
adapted string to the modem, if the modem is configured in the application.
82 35011386 06/2011
Communications
The selected configuration corresponds to the one read in the controller: the Hayes
initialization command, then read, is displayed in Hayes standard format.
NOTE: The modem is completely managed by the Twido controller through port 1.
This means you can connect a modem to communication port 2, but in this case all
of the modem’s operating modes and its initialization sequence must be performed
manually, and cannot be performed in the same way as with communication port 1.
(The Twido Extreme TWDLEDCK1 controller has only one serial port.)
You can select a previously-defined modem, or create a new one by clicking "New".
Illustration of the Add/Modify Modem dialog box:
35011386 06/2011 83
Communications
Then give the new profile a name and complete the Hayes initialization commands
as described in the modem documentation.
In the figure above, "xxxxxx" represents the initialization sequence you must enter
to prepare the modem for suitable communication, i.e. the baud rate, parity, stop bit,
and receive mode.
To complete the sequence, please refer to your modem documentation.
The maximum string length is: 127 characters.
When your application is complete, or at least when communication port 1 is fully
described, transfer the application using a "point to point connection".
The Twido controller is now ready to be connected to a PC executing TwidoSuite via
modems.
NOTE:
For the modem SR2 MOD03, configure the DTE RS 232 port as follows:
z Data rate: 19200 bauds
z Data size: 8 bits
z Parity: No Parity
z Stop bits: 1 stop bit
z Flow control: hardware flow control deactivated
Connection Sequence
Once TwidoSuite and the Twido controller are ready, establish connection as
follows:
Step Action
1 Power-up the Twido controller and modem.
2 Start your computer and run TwidoSuite.
3
Select Preferences, and select a modem connection from the "Connection
Management" table, (for example, "My modem" or the name you have given to
your modem connection – see "creation of a connection").
4 Connect TwidoSuite
NOTE: If you want to use your modem connection all the time, click "file",
"preferences", and select "my modem" (or the name you have given it). TwidoSuite
will now memorize this preference.
Operating Modes
The Twido controller sends the initialization string to the connected, powered-up
modem. When a modem is configured in the Twido application, the controller first
sends an "AT&F" command to establish whether the modem is connected. If the
controller receives an answer, the initialization string is sent to the modem.
84 35011386 06/2011
Communications
If you are using an internal switchboard to dial telephone numbers outside your
company and you have to first press "0" or "9" before the number, use this syntax:
0,xxxxxxxxxx or 9,xxxxxxxxxx
For international calls, the syntax is: +1xxxxxxxxxx, for example. And if you are using
a switchboard: 0,+ 1xxxxxxxxxx
35011386 06/2011 85
Communications
Preferences. Click on the "timeout" field, then click the modification button and
enter a new, higher value. The default value is "5000", in milliseconds.
Try again with a new connection. Adjust the value until your connection stabilizes.
86 35011386 06/2011
Communications
Examples
z Example 1: TwidoSuite connected to a TWD LMDA 20DRT (Windows 98 SE).
z PC: Toshiba Portege 3490CT running Windows 98,
z Modem (internal on PC): Toshiba internal V.90 modem,
z Twido Controller: TWD LMDA 20DRT version 2.0,
z Modem (connected to Twido): Schneider reference SR2 MOD01, available
from the new Twido catalog. For more details, refer Appendix 2 (see page 89).
(Europe Bands: 900/1800 MHz and US Bands: 850/1900MHz)
z Cable: TSX PCX1031, connected to Twido communication port 1, and an
adaptor: 9 pin male / 9 pin male, in order to cross Rx and Tx during connection
between the modem and the Twido controller. For more details, refer
Appendix 1 (see page 88). You can also use the TSX PCX1130 cable
(RS485/232 conversion and Rx/Tx crossing).
The first test involves using 2 analog telephone lines internal to the company, and
not using the entire number – just the extension (hence only 4 digits for the internal
Toshiba V.90 modem telephone number).
For this test, the connection parameters (TwidoSuite "preferences" then
"Connection management") were established with their default value, with a timeout
of 5000 and break timeout of 20.
z Example 2: TwidoSuite connected to TWD LMDA 20DRT (windows XP Pro)
z PC: Compaq Pentium 4, 2.4GHz,
z Modem: Lucent Win modem, PCI bus,
z Twido Controller: TWD LMDA 20DRT version 2.0,
z Modem (connected to Twido): Schneider reference SR2 MOD01, available
from the new Twido catalog. For more details, refer Appendix 2 (see page 89).
(Europe Bands: 900/1800 MHz and US Bands: 850/1900MHz)
35011386 06/2011 87
Communications
The first test involves using two analog telephone lines internal to the company, and
not using the entire number – just the extension (hence only 4 digits for the internal
Toshiba V.90 modem telephone number).
For this test, the connection parameters (TwidoSuite "preferences" then
"Connection management") were established with their default value, with a timeout
of 5000 and break timeout of 20.
Appendix 1
Crossed adaptor for cable TSX PCX1031 and SR2 MOD0X modem:
88 35011386 06/2011
Communications
Appendix 2
Schneider reference number SR2 MOD0X(1) (Europe Bands: 900/1800 MHz and
US Bands: 850/1900MHz)
NOTE:
1. Certain products may not be compatible and/or available in all areas. Please
contact your local Schneider representative for availability.
Appendix 3
Reference numbers of the products used in this document:
z Twido product: TWD LMDA 20DRT,
z TwidoSuite software: TWD SPU 1002 V10M,
z TSX PCX1031 cable,
z TSX PCX1130 cable,
z RTU modem: SR2 MOD01(1),
z GSM modem: SR2 MOD03(1).
NOTE:
1. Certain products may not be compatible and/or available in all areas. Please
contact your local Schneider representative for availability.
35011386 06/2011 89
Communications
Introduction
The remote link is a high-speed master/slave bus designed to communicate a small
amount of data between the master controller and up to seven remote (slave)
controllers. Application or I/O data is transferred, depending on the configuration of
the remote controllers. A mixture of remote controller types is possible, where some
can be remote I/O and some can be peers.
NOTE: Remote Link communications are not supported by the TWDLEDCK1
Twido Extreme controller.
NOTE: The master controller contains information regarding the address of a
remote I/O. It does not know which specific controller is at the address. Therefore,
the master cannot validate that all the remote inputs and outputs used in the user
application actually exist. Take care that these remote inputs or outputs actually
exist.
NOTE: The remote I/O bus and the protocol used is proprietary and no third party
devices are allowed on the network.
WARNING
UNINTENDED EQUIPMENT OPERATION
z Be sure that there is only one master controller on a remote link.
z Be sure that all slaves have unique addresses. No two slaves should have the
same address.
Failure to follow these instructions can result in death, serious injury, or
equipment damage.
NOTE: The remote link requires an EIA RS485 connection and can only run on one
communications port at a time.
Hardware Configuration
A remote link must use a minimum 3-wire EIA RS485 port. It can be configured to
use either the first or an optional second port if present.
NOTE: Only one communication port at time can be configured as a remote link.
90 35011386 06/2011
Communications
NOTE: You can only check the presence and configuration (RS232 or RS485) of
port 2 at power-up or reset by the firmware executive program.
35011386 06/2011 91
Communications
The cable connections made to each remote device are shown below.
Software Configuration
There must be only one master controller defined on the remote link. In addition,
each remote controller must maintain a unique slave address. Multiple masters or
slaves using identical addresses can either corrupt transmissions or create
ambiguity.
CAUTION
UNEXPECTED EQUIPMENT OPERATION
Be sure that there is only one master controller on a remote link and that each
slave has a unique address.
Failure to follow these instructions can result in injury or equipment damage.
92 35011386 06/2011
Communications
35011386 06/2011 93
Communications
94 35011386 06/2011
Communications
To communicate with remote I/O, the master controller uses the standard input and
output notation of %I and %Q. To access the third output bit of the remote I/O
configured at address 2, instruction %Q2.0.2 is used. Similarly, to read the fifth input
bit of the remote I/O configured at location 7, instruction %I7.0.4 is used.
NOTE: The master is restricted to accessing only the discrete I/O that is part of the
remote’s local I/O. No analog or expansion I/O can be transferred, unless you use
peer communications.
35011386 06/2011 95
Communications
Illustration
96 35011386 06/2011
Communications
There is no peer-to-peer messaging within the remote link. The master application
program can be used to manage the network words, in order to transfer information
between the remote controllers, in effect using the master as a bridge.
35011386 06/2011 97
Communications
Status Information
In addition to the system bits explained earlier, the master maintains the presence
and configuration status of remote controllers. This action is performed in system
words %SW111 and %SW113. Either the remote or the master can acquire the
value of the last detected error that occurred while communicating on the remote link
in system word %SW112.
System Use
Words
%SW111 Remote link status: two bits for each remote controller (master only)
x0-6 0-Remote controller 1-7 not present
1-Remote controller 1-7 present
x8-14 0-Remote I/O detected at Remote controller 1-7
1-Peer controller detected at Remote controller 1-7
%SW112 Remote Link configuration/operation error code
00: successful operations
01 - timeout detected (slave)
02 - checksum error detected (slave)
03 - configuration mismatch (slave)
04 - (for port 1 only) Port unavailable, punit connected or punit mode
%SW113 Remote link configuration: two bits for each remote controller (master only)
x0-6 0-Remote controller 1-7 not configured
1-Remote controller 1-7 configured
x8-14 0-Remote I/O configured as remote controller 1-7
1-Peer controller configured as remote controller 1-7
98 35011386 06/2011
Communications
The diagrams below illustrate the use of the remote link with remote I/O and a peer
controller.
Step 1: Configure the Hardware:
The hardware configuration is three base controllers of any type. Port 1 is used for
two communication modes. One mode is to configure and transfer the application
program with TwidoSuite. The second mode is for the Remote Link network. If
available, an optional Port 2 on any of the controllers can be used, but a controller
only supports a single Remote Link.
NOTE: In this example, the two first inputs on the Remote I/O are hard wired to the
first two outputs.
Step 2: Wire the controllers
Connect the A(+) and B(-) signal wires together. And at each controller, the DPT
signal is tied to ground. Although tying the signal to the ground is not required for
use with a remote link on Port 2 (optional cartridge or communication module), it is
good practice.
35011386 06/2011 99
Communications
Configure the remote controller on the master by adding a "Remote I/O" at address
"1" and a "Peer PLC" at address "2".
For the controller configured as a remote I/O, verify that the controller
communication setup is set to "Remote Link" and the address is set to "1".
For the controller configured as peer, verify that the controller communication setup
is set to "Remote Link" and the address is set to "2".
For the controller configured as a remote I/O, do not write any application program.
In this example, the master application increments an internal memory word and
communicates this to the peer controller using a single network word. The peer
controller takes the word received from the master and echoes it back. In the master,
a different memory word receives and stores this transmission.
For communication with the remote I/O controller, the master sends its local inputs
to the remote I/O’s outputs. With the external I/O hard wiring of the remote I/O, the
signals are returned and retrieved by the master.
ASCII Communications
Introduction
ASCII protocol provides Twido controllers a simple half-duplex character mode
protocol to transmit and/or receive data with a simple device. This protocol is
supported using the EXCHx instruction and controlled using the %MSGx function
block.
Three types of communications are possible with the ASCII Protocol:
z Transmission Only
z Transmission/Reception
z Reception Only
The maximum size of frames transmitted and/or received using the EXCHx
instruction is 256 bytes.
Hardware Configuration
An ASCII link (see system bits %S103 and %S104 (see page 702)) can be
established on either the EIA RS232 or EIA RS485 port and can run on as many as
two communications ports at a time.
The table below lists the devices that can be used:
NOTE: You can only check the presence and configuration (RS232 or RS485) of
port 2 at power-up or reset by the firmware executive program. (The Twido Extreme
TWDLEDCK1 controller has only one serial port.)
Nominal Cabling
Nominal cable connections are illustrated below for both the EIA RS232 and the EIA
RS485 types.
NOTE: If port 1 is used on the Twido controller, the DPT signal on pin 5 must be tied
to 0V on pin 7. This signifies to the Twido controller that the communications through
port 1 is ASCII and is not the protocol used to communicate with the TwidoSuite
software.
NOTE: For the TWDLEDCK1 Twido Extreme controller, if ASCII is used then 0V
must be applied to the communication strap contact (pin 22) to enable
communication. This indicates to the Twido controller that communication through
port 1 is not the protocol used to communicate with the TwidoSuite software.
Software Configuration
To configure the controller to use a serial connection to send and receive characters
using the ASCII protocol, you must:
Step Description
1 Configure the serial port for ASCII using TwidoSuite1.
2 Create in your application a transmission/reception table that will be used by
the EXCHx instruction.
1
The following configuration options are not possible for the Twido Extreme TWDLEDCK1
PLC:
z 7 bit, no parity, 1 stop bit
z 8 bit, even parity, 2 stop bits
z 8 bit, odd parity, 2 stop bits
Step Action
1 Define any additional communication adapters or modules configured to the
base.
2 Declare the ASCII network in the Describe step of TwidoSuite (see and for
ASCII).
3 Select Port 1 (or Port 2 if installed) to configure in the Describe window (see ).
4 To configure the ASCII element, use any of the two methods:
z Click the Configure icon from the toolbar then select the ASCII element in
the describe graphic,
z Double click the ASCII element in the describe graphic.
5 To bring up the Feature dialog box associated to the ASCII link hardware
parameters, use any of the two methods:
z Click the Configure icon from the toolbar then select the ASCII link in the
describe graphic,
z Double click the ASCII link in the describe graphic.
6 Configure the Feature dialog box that appears, as explained in the subsequent
steps:.
Control table
The Length byte contains the length of the transmission table in bytes (250 max.),
which is overwritten by the number of characters received at the end of the
reception, if reception is requested.
The Command byte must contain one of the following:
z 0: Transmission only
z 1: Send/receive
z 2: Reception Only
Transmission/reception tables
When in Transmit Only mode, the Control and Transmission tables are filled in prior
to executing the EXCHx instruction, and can be of type %KW or %MW. No space is
required for the reception of characters in Transmission only mode. Once all bytes
are transmitted, %MSGx.D is set to 1, and a new EXCHx instruction can be
executed.
When in Transmit/Receive mode, the Control and Transmission tables are filled in
prior to executing the EXCHx instruction, and must be of type %MW. Space for up
to 256 reception bytes is required at the end of the Transmission table. Once all
bytes are transmitted, the Twido controller switches to reception mode and waits to
receive any bytes.
When in Reception only mode, the Control table is filled in prior to executing the
EXCHx instruction, and must be of type %MW. Space for up to 256 reception bytes
is required at the end of the Control table. Twido controller immediately enters the
reception mode and waits to receive any bytes.
Reception ends when end of frame bytes used have been received, or the
Reception table is full. In this case, an error code (receive table overflowed) appears
in the word %SW63 and %SW64. If a non-zero timeout is configured, reception ends
when the timeout is completed. If a zero timeout value is selected, there is no
reception timeout. Therefore to stop reception, %MSGx.R input must be activated.
Message Exchange
The language offers two services for the communication:
z EXCHx instruction: to transmit/receive messages
z %MSGx Function Block: to control the message exchanges.
Twido controller uses the protocol configured for that port when processing an
EXCHx instruction.
NOTE: Each communications port can be configured for different protocols or the
same. The EXCHx instruction or %MSGx function block for each communications
port is accessed by appending the port number (1 or 2).
EXCHx Instruction
The EXCHx instruction allows the Twido controller to send and/or receive
information to/from ASCII devices. The user defines a table of words (%MWi:L or
%KWi:L) containing control information and the data to be sent and/or received (up
to 256 bytes in transmission and/or reception). The format for the word table is
described earlier.
A message exchange is performed using the EXCHx instruction:
The Twido controller must finish the exchange from the first EXCHx instruction
before a second can be launched. The %MSGx function block must be used when
sending several messages.
The processing of the EXCHx list instruction occurs immediately, with any
transmissions started under interrupt control (reception of data is also under
interrupt control), which is considered background processing.
Limitations
It is important to note the following limitations:
z Port 2 availability and type (see %SW7) is checked only at power-up or reset
z Any message processing on Port 1 is aborted when the TwidoSuite is connected
z EXCHx or %MSG can not be processed on a port configured as Remote Link
z EXCHx aborts active Modbus Slave processing
z Processing of EXCHx instructions is not re-tried in the event of an error
z Reset input (R) can be used to abort EXCHx instruction reception processing
z EXCHx instructions can be configured with a time out to abort reception
z Multiple messages are controlled via %MSGx.D
System Use
Words
%SW63 EXCH1 error code:
0 - operation was successful
1 – number of bytes to be transmitted is too great (> 250)
2 - transmission table too small
3 - word table too small
4 - receive table overflowed
5 - time-out elapsed
6 - transmission error
7 - bad command within table
8 - selected port not configured/available
9 - reception error
10 - cannot use %KW if receiving
11 - transmission offset larger than transmission table
12 - reception offset larger than reception table
13 - controller stopped EXCH processing
%SW64 EXCH2 error code: See %SW63.
The diagram below illustrates the use of the ASCII communications with a Terminal
Emulator on a PC.
Use a simple Terminal Emulator application on the PC to configure the COM2 port
and to ensure that there is no flow control.
Use TwidoSuite to configure the controller’s port. First, the hardware option is
configured. In this example, the TWDNOZ232D is added to the Modular base
controller.
Second, the Controller Communication Setup is initialized with all of the same
parameter settings as the Terminal Emulator on the PC. In this example, capital
letter "A" is chosen for "1st end character", in order to terminate character reception.
A 10 second timeout is chosen for "Response Timeout" parameter. Only one of
these two parameters will be invoked, depending on whichever happens first.
Use TwidoSuite to create an application program with three primary parts. First,
initialize the Control and Transmission tables to use for the EXCH instruction. In this
example, a command is set up to both send and receive data. The amount of data
to send will be set to 4 bytes, as defined in the application, followed by the end of
frame character used (in this case, the first end character "A"). Start and end
characters do not display in the Animation table, where only data characters show
up. Anyway, those characters are automatically transmitted or checked at reception
(by %SW63 and %SW64), when used.
Next, check the status bit associated with %MSG2 and issue the EXCH2 instruction
only if the port is ready. For the EXCH2 instruction, a value of 8 words is specified.
There are 2 Control words (%MW10 and %MW11), 2 words to be used for transmit
information (%MW12 and %MW13), and 4 words to receive data (%MW14 through
%MW16).
Finally, the error status of the %MSG2 is sensed and stored on the first output bit on
the local base controller I/O. Additional error checking using %SW64 could also be
added to make this more accurate.
The final step is to download this application controller and run it. Initialize an
Animation Table Editor to animate and display the %MW10 through %MW16 words.
On the Terminal Emulator, characters "O- K - CR - LF - A" can be displayed as many
times as the EXCH block response timeout has elapsed. On the Terminal Emulator,
type in "T - W - I - D - O - A". This information is exchanged with Twido controller and
displayed in the Animation Table Editor.
Modbus Communications
Introduction
The Modbus protocol is a master-slave protocol that allows for one, and only one,
master to request responses from slaves, or to act based on the request. Each slave
must have a unique address. The master can address individual slaves, or can
initiate a broadcast message to all slaves. Slaves return a message (response) to
queries that are addressed to them individually. Responses are not returned to
broadcast queries from the master.
CAUTION
UNEXPECTED EQUIPMENT OPERATION
z Be sure that there is only one Modbus master controller on the bus and that
each Modbus slave has a unique address.
z Be sure that all Modbus slaves have unique addresses.
Failure to follow these instructions can result in injury or equipment damage.
Hardware Configuration
A Modbus link can be established on either the EIA RS232 or EIA RS485 port and
can run on as many as two communications ports at a time. Each of these ports can
be assigned its own Modbus address, using system bit %S101 and system words
%SW101 and %SW102 (see page 702).
The table below lists the devices that can be used:
Nominal Cabling
Nominal cable connections are illustrated below for both the EIA RS232 and the EIA
RS485 types.
NOTE: If port 1 is used on the Twido controller, the DPT signal on pin 5 must be tied
to the circuit common (COM) on pin 7. This signifies to the Twido controller that the
communications through port 1 is Modbus and is not the protocol used to
communicate with the TwidoSuite software.
NOTE: For the TWDLEDCK1 Twido Extreme controller, if Modbus is used for
programming then the communication strap contact (pin 22) must be disconnected.
If 0V is applied to this contact (pin 22) this indicates to the Twido controller that
communication through port 1 is not the protocol used to communicate with the
TwidoSuite software.
The cable connections made to each remote device are shown below.
Software Configuration
To configure the controller to use a serial connection to send and receive characters
using the Modbus protocol, you must:
Step Description
1 Configure the serial port for Modbus using TwidoSuite.1
2 Create in your application a transmission/reception table that will be used by
the EXCHx instruction.
1
The following configuration options are not possible for the Twido Extreme PLC
(TWDLEDCK1):
z 7 bit, no parity, 1 stop bit
z 8 bit, even parity, 2 stop bits
z 8 bit, odd parity, 2 stop bits
Step Action
1 Define any additional communication adapters or modules configured to the
base.
2 Declare the Modbus network in the Describe step of TwidoSuite (refer How to
Create a Network (Modbus example).
3 Select Port 1 (or Port 2 if installed) to configure in the Describe window (refer
Configure an Object.
4 To configure the Modbus element, use any of the two methods:
z Click the Configure icon from the toolbar then select the Modbus element in
the describe graphic,
z Double click the Modbus element in the describe graphic.
5 To bring up the Feature dialog box associated to the Modbus link hardware
parameters, use any of the two methods:
z Click the Configure icon from the toolbar then select the Modbus link in the
describe graphic,
z Double click the Modbus link in the describe graphic.
6 Configure the Feature dialog box that appears, as explained in the subsequent
steps:.
Modbus Master
Modbus master mode allows the controller to send a Modbus query to a slave, and
to wait for the response. The Modbus Master mode is only supported via the EXCHx
instruction. Both Modbus ASCII and RTU are supported in Modbus Master mode.
The maximum size of the transmitted and/or received frames is 250 bytes.
Moreover, the word table associated with the EXCHx instruction is composed of the
control, transmission and reception tables.
NOTE: In addition to queries to invidual slaves, the Modbus master controller can
initiate a broadcast query to all slaves. The command byte in case of a boradcast
query must be set to 00, while the slave address must be set to 0.
Control table
The Length byte contains the length of the transmission table (maximum 250
bytes), which is overwritten by the number of characters received at the end of the
reception, if reception is requested.
This parameter is the length in bytes of the transmission table. If the Tx Offset
parameter is equal to 0, this parameter will be equal to the length of the transmission
frame. If the Tx Offset parameter is not equal to 0, one byte of the transmission table
(indicated by the offset value) will not be transmitted and this parameter is equal to
the frame length itself plus 1.
The Command byte in case of Modbus RTU request (except for broadcast) must
always equal to 1 (Tx and Rx).
The Tx Offset byte contains the rank (1 for the first byte, 2 for the second byte, and
so on) within the Transmission Table of the byte to ignore when transmitting the
bytes. This is used to handle the issues associated with byte/word values within the
Modbus protocol. For example, if this byte contains 3, the third byte would be
ignored, making the fourth byte in the table the third byte to be transmitted.
The Rx Offset byte contains the rank (1 for the first byte, 2 for the second byte, and
so on) within the Reception Table to add when transmitting the packet. This is used
to handle the issues associated with byte/word values within the Modbus protocol.
For example, if this byte contains 3, the third byte within the table would be filled with
a ZERO, and the third byte which was actually received would be entered into the
fourth location in the table.
Transmission/reception tables
When using either mode (Modbus ASCII or Modbus RTU), the Transmission table
is filled with the request prior to executing the EXCHx instruction. At execution time,
the controller determines what the Data Link Layer is, and performs all conversions
necessary to process the transmission and response. Start, end, and check
characters are not stored in the Transmission/Reception tables.
Once all bytes are transmitted, the controller switches to reception mode and waits
to receive any bytes.
Reception is completed in one of several ways:
z timeout on a character or frame has been detected,
z end of frame character(s) received in ASCII mode,
z the Reception table is full.
Transmitted byte X entries contain Modbus protocol (RTU encoding) data that is to
be transmitted. If the communications port is configured for Modbus ASCII, the
correct framing characters are appended to the transmission. The first byte contains
the device address (specific or broadcast), the second byte contains the function
code, and the rest contain the information associated with that function code.
NOTE: This is a typical application, but does not define all the possibilities. No
validation of the data being transmitted will be performed.
Received Bytes X contain Modbus protocol (RTU encoding) data that is to be
received. If the communications port is configured for Modbus ASCII, the correct
framing characters are removed from the response. The first byte contains the
device address, the second byte contains the function code (or response code), and
the rest contain the information associated with that function code.
NOTE: This is a typical application, but does not define all the possibilities. No
validation of the data being received will be performed, except for checksum
verification.
Modbus Slave
Modbus slave mode allows the controller to respond to standard Modbus queries
from a Modbus master.
When TSX PCX1031 cable is attached to the controller, TwidoSuite
communications are started at the port, temporarily disabling the communications
mode that was running prior to the cable being connected.
The Modbus protocol supports two Data Link Layer formats: ASCII and RTU. Each
is defined by the Physical Layer implementation, with ASCII using 7 data bits, and
RTU using 8 data bits.
When using Modbus ASCII mode, each byte in the message is sent as two ASCII
characters. The Modbus ASCII frame begins with a start character (’:’), and can end
with two end characters (CR and LF). The end of frame character defaults to 0x0A
(line feed), and the user can modify the value of this byte during configuration. The
check value for the Modbus ASCII frame is a simple two’s complement of the frame,
excluding the start and end characters.
Modbus RTU mode does not reformat the message prior to transmitting; however,
it uses a different checksum calculation mode, specified as a CRC.
The Modbus Data Link Layer has the following limitations:
z Address 1-247
z Bits: 128 bits on request
z Words: 125 words of 16 bits on request
Message Exchange
The language offers two services for communication:
z EXCHx instruction: to transmit/receive messages
z %MSGx Function Block: to control the message exchanges.
The Twido controller uses the protocol configured for that port when processing an
EXCHx instruction.
NOTE: Each communications port can be configured for different protocols or the
same. The EXCHx instruction or %MSGx function block for each communications
port is accessed by appending the port number (1 or 2).
EXCHx Instruction
The EXCHx instruction allows the Twido controller to send and/or receive
information to/from Modbus devices. The user defines a table of words (%MWi:L)
containing control information and the data to be sent and/or received (up to 250
bytes in transmission and/or reception). The format for the word table is described
earlier.
A message exchange is performed using the EXCHx instruction:
The Twido controller must finish the exchange from the first EXCHx instruction
before a second can be launched. The %MSGx function block must be used when
sending several messages.
The processing of the EXCHx list instruction occurs immediately, with any
transmissions started under interrupt control (reception of data is also under
interrupt control), which is considered background processing.
Limitations
It is important to note the following limitations:
z Port 2 presence and configuration (RS232 or RS485) is checked at power-up or
reset
z Any message processing on Port 1 is aborted when the TwidoSuite is connected
z EXCHx or %MSG can not be processed on a port configured as Remote Link
z EXCHx aborts active Modbus Slave processing
z Processing of EXCHx instructions is not re-tried in the event of an error
z Reset input (R) can be used to abort EXCHx instruction reception processing
z EXCHx instructions can be configured with a time out to abort reception
z Multiple messages are controlled via %MSGx.D
System Use
Words
%SW63 EXCH1 error code:
0 - operation was successful
1 – number of bytes to be transmitted is too great (> 250)
2 - transmission table too small
3 - word table too small
4 - receive table overflowed
5 - time-out elapsed
6 - transmission
7 - bad command within table
8 - selected port not configured/available
9 - reception error
10 - can not use %KW if receiving
11 - transmission offset larger than transmission table
12 - reception offset larger than reception table
13 - controller stopped EXCH processing
%SW64 EXCH2 error code: See %SW63.
1Thefollowing configuration options are not possible for the Twido Extreme PLC
(TWDLEDCK1):
z 7 bit, no parity, 1 stop bit
z 8 bit, even parity, 2 stop bits
z 8 bit, odd parity, 2 stop bits
Step 1: Configure the Hardware:
The hardware configuration is two Twido controllers. One will be configured as the
Modbus Master and the other as the Modbus Slave.
NOTE: In this example, each controller is configured to use EIA RS485 on Port 1
and an optional EIA RS485 Port 2. On a Modular controller, the optional Port 2 can
be either a TWDNOZ485D or a TWDNOZ485T, or if you use TWDXCPODM, it can
be either a TWDNAC485D or a TWDNAC485T. On a Compact controller, the
optional Port 2 can be either a TWDNAC485D or a TWDNAC485T. The
Twido Extreme TWDLEDCK1 controller has only one serial port and thus does not
have a Port 2.
To configure each controller, connect the TSX PCX1031 cable to Port 1 of the
controller.
NOTE: The TSX PCX1031 can only be connected to one controller at a time, on
RS485 EIA port 1 only.
Next, connect the cable to the COM 1 port of the PC. Be sure that the cable is in
switch position 2. Download and monitor the application. Repeat procedure for
second controller.
The wiring in this example demonstrates a simple point to point connection. The
three signals D1(A+), D0(B-), and COM(0V) are wired according to the diagram.
If using Port 1 of the Twido controller, the DPT signal (pin 5) must be tied to circuit
common (pin 7). This conditioning of DPT determines if TwidoSuite is connected.
When tied to the ground, the controller will use the port configuration set in the
application to determine the type of communication.
For the TWDLEDCK1 Twido Extreme controller, if Modbus is used for programming
then the communication strap contact (pin 22) must be disconnected. If 0V is applied
to this contact (pin 22) this indicates to the Twido controller that communication
through port 1 is not the protocol used to communicate with the TwidoSuite software.
Step 3: Port Configuration1:
1Thefollowing configuration options are not possible for the Twido Extreme PLC
(TWDLEDCK1):
z 7 bit, no parity, 1 stop bit
z 8 bit, even parity, 2 stop bits
z 8 bit, odd parity, 2 stop bits
In both master and slave applications, the optional EIA RS485 ports are configured.
Ensure that the controller’s communication parameters are modified in Modbus
protocol and at different addresses.
In this example, the master is set to an address of 1 and the slave to 2. The number
of bits is set to 8, indicating that we will be using Modbus RTU mode. If this had been
set to 7, then we would be using Modbus-ASCII mode. The only other default
modified was to increase the response timeout to 1 second.
NOTE: Since Modbus RTU mode was selected, the "End of Frame" parameter was
ignored.
Step 4: Write the application:
Using TwidoSuite, an application program is written for both the master and the
slave. For the slave, we simply write some memory words to a set of known values.
In the master, the word table of the EXCHx instruction is initialized to read 4 words
from the slave at Modbus address 2 starting at location %MW0.
NOTE: Notice the use of the RX offset set in %MW1 of the Modbus master. The
offset of three will add a byte (value = 0) at the third position in the reception area of
the table. This aligns the words in the master so that they fall correctly on word
boundaries. Without this offset, each word of data would be split between two words
in the exchange block. This offset is used for convenience.
Before executing the EXCH2 instruction, the application checks the communication
bit associated with %MSG2. Finally, the error status of the %MSG2 is sensed and
stored on the first output bit on the local base controller I/O. Additional error checking
using %SW64 could also be added to make this more accurate.
After downloading and setting each controller to run, open an animation table on the
master. Examine the response section of the table to check that the response code
is 3 and that the correct number of bytes was read. Also in this example, note that
the words read from the slave (beginning at %MW7) are aligned correctly with the
word boundaries in the master.
Using TwidoSuite, an application program is created for both the master and the
slave. For the slave, write a single memory word %MW18. This will allocate space
on the slave for the memory addresses from %MW0 through %MW18. Without
allocating the space, the Modbus request would be trying to write to locations that
did not exist on the slave.
In the master, the word table of the EXCH2 instruction is initialized to read 4 bytes
to the slave at Modbus address 2 at the address %MW16 (10 hexadecimal).
NOTE: Notice the use of the TX offset set in %MW1 of the Modbus master
application. The offset of seven will suppress the high byte in the sixth word (the
value 00 hexadecimal in %MW5). This works to align the data values in the
transmission table of the word table so that they fall correctly on word boundaries.
Before executing the EXCH2 instruction, the application checks the communication
bit associated with %MSG2. Finally, the error status of the %MSG2 is sensed and
stored on the first output bit on the local base controller I/O. Additional error checking
using %SW64 could also be added to make this more accurate.
After downloading and setting each controller to run, open an animation table on the
slave controller. The two values in %MW16 and %MW17 are written to the slave. In
the master, the animation table can be used to examine the reception table portion
of the exchange data. This data displays the slave address, the response code, the
first word written, and the number of words written starting at %MW8 in the example
above.
Introduction
These requests are used to exchange memory words or bits between remote
devices. The table format is the same for both RTU and ASCII modes.
(*) This byte also receives the length of the string transmitted after response
(*) This byte also receives the length of the string transmitted after response
NOTE: The Rx offset of three will add a byte (value = 0) at the third position in the
reception table. This ensures a good positioning of the number of bytes read and of
the read words’ values in this table.
(*) This byte also receives the length of the string transmitted after response
NOTE:
z This request does not need the use of offset.
z The response frame is the same as the request frame here (in a normal case).
z For a bit to write 1, the associated word in the transmission table must contain the
value FF00H, and 0 for the bit to write 0.
(*) This byte also receives the length of the string transmitted after response
NOTE:
z This request does not need the use of offset.
z The response frame is the same as the request frame here (in a normal case).
NOTE:
z The Tx Offset=7 will suppress the 7th byte in the sent frame. This also allows a
good correspondence of words’ values in the transmission table.
NOTE: The Tx Offset = 7 will suppress the 7th byte in the sent frame. This also
allows a good correspondence of words’ values in the transmission table.
Modbus Function Codes 23 (MB FC) - Read/Write Multiple registers and N Words
Description
The Read/Write Multiple Registers function code performs a combination of one
read operation and one write operation in a single Modbus transaction.
NOTE: The write operation is performed before the read operation.
Holding registers are addressed starting at zero. Therefore, holding registers 1 to 16
are addressed in the PDU as 0 to 15.
Request Parameters
The request specifies the starting address and the number of holding registers to be
read as well as the starting address, the number of holding registers and the data to
be written.
The byte count specifies the number of bytes that will be written in the write date
field.
The following tables gives the Read/Write Multiple Registers request parameter
values:
Response Parameters
The standard response contains the data from the group of registers that were read.
The byte count parameter specifies the quantity of bytes that will be contained in the
read data field.
The following tables gives the Read/Write Multiple Registers response parameter
values:
Error Parameters
The following table gives the values for the returned errors.
Transmission/Reception table
The following tables give the significant byte parameters for transmission/reception:
NOTE: This request code 23 is only avaible with Twido base TWDLCxx40DRF.
Description
The Read Device Indentification function code retrieves the identification of a
remote device as well as additional information relative its physical and functional
description.
The Read Device Identification interface is modeled as an address space composed
of a set of addressable data elements. The data elements are called objects
identified by an object ID.
Request Parameters
The request for Read Device Identification function code is composed of the
following parameters:
Parameter Description
Function Code Function code 43 (decimal), 20x2B (hex).
Modbus Modbus Encapsulated Interface is assigned number 14 which
Encapsulated identifies the read identification request interface.
Interface (MEI) type
Read Device ID Code Read Device ID Code: this parameter defines four access types:
z 01 - request to retrieve the basic device identification (stream
access)
z 02 - request to retrieve regular device identification (stream
access)
z 03 - request to retrieve extended device identification (stream
access)
z 04 - request to retrieve one specific identification object
(individual access)
An exception code 03 is returned in the response if the Read Device
ID Code is illegal.
Note: If the server is asked for a description level (Read Device ID
code) higher than its conformity level, it must respond in
accordance with its actual conformity level.
Object ID For Read Device ID Codes 01, 02 or 03 - stream access
This parameter is used if a response cannot fit in a single response
and several transactions (requests/responses) need to be
generated in order to get the full response.
The Object ID byte gives the identification of the first object to be
retrieved.
For the first transaction, the Object ID must be set to 0 to obtain the
beginning of the device identification data.
For the following transactions, the Object ID must be set to the
value returned by the server in its previous response.
If the Object ID does not match any known object, the server
responds as though the Object ID had been set to 0 and restarts at
the beginning.
For Read Device ID Code 04 - individual access
The object ID identifies the object to be returned.
If the Object ID does not match any known objects, the server
returns an exception response with exception code 02 (illegal data
address).
Response Parameters
The table below describes the response parameters returned for Read Device
Identification request:
Parameter Description
Function Code Function code 43 (decimal), 20x2B (hex).
Modbus MEI is assigned number 14 which identifies the read identification
Encapsulated request interface.
Interface (MEI) type
Read Device ID Code The Read Device ID codes returned are the same as the ones
included in the request: 01, 02, 03 or 04.
Conformity Level Identification conformity level of the device and type of access
supported:
z 01 - basic identification (stream access only)
z 02 - regular identification (stream access only)
z 03 - extended identification (stream access only)
z 81 - basic identification (stream access and individual access)
z 82 - regular identification (stream access and individual access)
z 83 - extended identification (stream access and individual
access)
More follows For Read Device ID Codes 01, 02 or 03 - stream access
If the response returned does not fit into a single response, several
transactions may be required to send the response. The following
applies:
z 00 : no more objects are available
z FF : other identification objects are available and further Modbus
transactions are required.
For Read Device ID Code 04 - individual access
This parameter must be set to 00.
Next Object ID If More Follows is set to FF, this contains the identification of the
next object to be requested.
If More Follows is set to 00, this must be set to 00 (the parameter
becomes useless).
Parameter Description
Number of Objects Number of identification objects returned in the response.
Note: In the case of an individual access, Number of Objects is
always set to 1.
Object0.Id Identification of the first object returned in the PDU (stream access)
or the requested object (individual access).
Object0.Length Length of the first object in bytes.
Object0.Value Value of the first object (Object0.Length bytes).
......... .........
ObjectN.Id Identification of the last object returned within the response.
ObjectN.Length Length of the last object in bytes.
ObjectN.Value Value of the last object (ObjectN.Length bytes).
Overview
The following Modbus Function codes are supported by both serial Modbus and
TCP/IP Modbus. For detailed information about Modbus protocol, please refer to
document Modbus Application Protocol which is available at http://www.modbus-
ida.org
6
Subject of this Chapter
This chapter describes how to manage the built-in analog channel and
potentiometers.
Analog potentiometer
Introduction
Twido controllers have:
z An analog potentiometer on TWDLC•A10DRF, TWDLC•A16DRF controllers and
on all modular controllers (TWDLMDA20DTK, TWDLMDA20DUK,
TWDLMDA20DRT, TWDLMDA40DTK and TWDLMDA40DUK,
z Two potentiometers on the TWDLC•A24DRF and TWDLC••40DRFcontrollers.
Programming
The numerical values, from 0 to 1023 for analog potentiometer 1, and from 0 to 1023
for analog potentiometer 2, corresponding to the analog values provided by these
potentiometers are contained in the following two input words:
z %IW0.0.0 for analog potentiometer 1 (on left)
z %IW0.0.1 for analog potentiometer 2 (on right)
These words can be used in arithmetic operations. They can be used for any type
of adjustment, for example, presetting a time-delay or a counter, adjusting the
frequency of the pulse generator or machine preheating time.
Example
Adjusting the duration of a time-delay from 5 to 10 s using analog potentiometer 1:
The following parameters are selected at configuration for the time-delay block
%TM0:
z Type TON
z Timebase: 10 ms
The preset value of the time-delay is calculated from the adjustment value of the
potentiometer using the following equation %TM0.P := (%IW0.0.0/2)+500.
Analog Channel
Introduction
All Modular controllers (TWDLMDA20DTK, TWDLMDA20DUK, TWDLMDA20DRT,
TWDLMDA40DTK, and TWDLMDA40DUK) have a built-in analog channel. The
voltage input ranges from 0 to 10 V and the digitized signal from 0 to 1023
. The analog channel takes advantage of a simple averaging scheme that takes
place over eight samples.
Principle
An analog to discrete converter samples an input voltage from 0 to 10 V to a discrete
value from 0 to 1023. This value is stored in system word %IW0.0.1. The value is
linear through the entire range, so that each increment is approximately 20 mV (10
V/512). Once the system detects value 1023, the channel is considered saturated.
Programming Example
Controlling the temperature of an oven: The cooking temperature is set to 350° C.
A variation of +/- 2.5° C results in tripping of output %Q0.0 and %Q0.2, respectively.
Practically all of the possible setting ranges of the analog channel from 0 to 1023 is
used in this example. Analog setting for the temperature set points are:
7
Subject of this Chapter
This chapter provides an overview of managing analog modules for Twido
controllers.
Introduction
In addition to the built-in 10-bit potentiometer and 9-bit analog channel, all the Twido
controllers that support expansion I/O are also able to configure and communicate
with analog I/O modules.
These analog modules are:
WARNING
UNINTENDED EQUIPMENT OPERATION
Be aware of the output default values when the controller is in STOP mode.
z The analog output is set to its fall-back position.
z The discrete output is set to zero.
Failure to follow these instructions can result in death, serious injury, or
equipment damage.
Introduction
Addresses are assigned to the analog channels depending on their location on the
expansion bus.
Introduction
This section provides information on configuring analog module inputs and outputs.
The following example shows the hardware configuration pane for the TM2AMI2LT
module.
The table shows: Address, Symbol, Type, Range, Minimum, Maximum and
Units
z In TM2AMI4LT and TM2AMI8HT, the table is preceded by an Input type list box.
z In TM2AVO2HT and TM2AMI8HT, the Type column is replaced by a Configured
column with check boxes.
z In TM2ARI8HT, each channel (0-7) is configured individually within a tab, in
which you can choose either the Chart or Formula configuration method. The
table can be seen in a Recap tab.
Description
The Description zone displays a short summary of the module.
Address
Each row of the spreadsheet represents either an input or output channel of the
module.
The addresses of each of these are identified in the following table, where "i" is the
location of the module on the expansion bus.
Symbol
This is a read-only display of a symbol, if assigned, for the address.
Type
Not in use
0 - 10 V
4 – 20 mA
For the TM2AMM6HT, you can configure the 4 input and the 2 output channel types
as:
Input type
0 - 10 V
4 – 20 mA
For the TM2AMI2HT and TM2AMM3HT, you can configure the 2 input channel types
as:
Type
Not in use
0 - 10 V
4 – 20 mA
For the TM2AMI2LT*, you can configure the 2 input channel types as:
Type
Not in use
Thermocouple K
Thermocouple J
Thermocouple T
NOTE: *In order to use the TM2AMI2LT module, make sure your PLC firmware is
version 4.0 or later.
For the TM2ALM3LT, you can configure the 2 input channel types as:
Type
Not in use
Thermocouple K
Thermocouple J
Thermocouple T
PT 100
For the TM2AMI8HT, you can configure the 8 input types as:
Input type
0 - 10 V
0 - 20 mA
For the TM2ARI8HT, you can configure each input channel (0-7) individually, from
the Operation field in the lower part of the window. Directly choose a Mode, and a
Range, if needed. You can then view a summary of all information in the Recap tab,
with a Type column showing:
Type
Not in use
NTC / CTN
PTC / CTP
CAUTION
INCORRECT EQUIPMENT OPERATION
Be sure that the wiring is in agreement with the TwidoSuite configuration. If you
have wired your input for a voltage measurement, and you configure TwidoSuite
for a current type of configuration, you may permanently damage the analog
module.
Failure to follow these instructions can result in injury or equipment damage.
Range
This identifies the range of values for a channel. The choices depend on the specific
type of channel and module.
Once the Type is configured, you can set the corresponding Range. A table shows
the Minimum and Maximum values accepted - either fixed or user-defined -
together with the Unit, if needed.
In both Chart and Formula windows, you can import values from another channel in
the currently configured channel:
1. Select a channel number out of the Channel No box.
2. Press the Import values button.
Some error messages can be associated with these windows.
NOTE: If you start setting values then decide to switch from Chart to Formula or from
Formula to Chart, a message pops up, explaining that it will revert to default values
and that any modified values will be lost.
Status Table
The following table has the information you need to monitor the status of Analog I/O
modules.
Introduction
This section provides an example of using Analog modules available with Twido.
Introduction
The Twido Extreme base has a single 70-pin connector which includes the power
supply, inputs, outputs and communication bus. This section provides an overview
of the inputs and outputs and their addresses.
I/O Addresses
Each input/output (I/O) point in a Twido configuration has a unique address. For
example, the address "%I0.0.4" is assigned to input 4 of the PLC.
The address format is as follows:
%I is used for discrete input, %IW for analog (and PWM) input and %Q is used for
discrete (and PWM) output.
Types of Input/Output
The following table provides a summary of the type and number of Twido Extreme
inputs and outputs and their addresses:
For further information on the specification and pin position for these inputs and
outputs see .
Key Switch
The key switch is a special (physical) input which is used to:
z turn the Twido Extreme on and off
z set the Twido Extreme in standby mode.
NOTE: To enable WARM restart from standby mode, the Twido Extreme must not
be disconnected from the power supply. If the power supply is not maintained, the
controller performs a COLD restart and date and time information is lost.
In standby mode the Twido Extreme keeps RAM alive and RTC data intact but this
implies that the PLC must be connected to the power supply (as it has no internal
battery). To illustrate this further an analogy to a car ignition switch can be made.
The key switch works like a car ignition switch which is linked to the car radio. When
the engine is switched off, the car radio is also switched off, but the radio channels,
time and other data are preserved in memory. As long as the radio is not
disconnected from the car battery, when the motor is restarted the radio is restarted
with all the data intact.
The key switch has not been allocated an address in the above table as this is a
special type of input that cannot be configured in TwidoSuite and therefore has no
dedicated address.
I/O Updates
Input bits (%I for discrete), input words (%IW for analog) and output (%Q) bits are
used to exchange data between the user application and the discrete or analog
channels. These objects are updated synchronously with the controller scan during
RUN mode.
Introduction
This section describes the configuration of discrete inputs.
Discrete Input
There are two main types of discrete input:
z Switch to Ground input
z Switch to Battery input (+)
Discrete input consist of Input Values, Rising Edge Values, and Falling Edge Values.
The Rising and the Falling Edge values are computed from the current image and
the previous image data from two consecutive scans.
Each input can be filtered, forced or latched
Input Filtering
Input filters reduce the effect of noise on the PLC input . Setting a filter value of 3 (or
12) ms ensures that sudden changes of input levels (due to noise) are ignored
unless this new input level persists for 3 (or 12) ms.
Input Forcing
Forced values may be assigned to input (and output) values in a user-defined
list/ladder program. This maybe useful for debugging purposes. This is described in
forcing input/output values.
Input Latching
Input latching is a special function that can be assigned to all or any one of the four
inputs (%I0.0 to %I0.3) on a Twido Extreme.This function is used to memorize (or
latch) any pulse with a duration less than the controller scan time. When a pulse is
shorter than one scan and has a value greater than or equal to 1 ms, the controller
latches the pulse, which is then updated in the next scan. Due to noise consider-
ations, a latched input must persist for more than 1ms in order to be recognised as
a rising edge. This latching mechanism only recognises rising edges. Falling edges
cannot be latched. Assigning inputs to be latched is done via the discrete input
configuration screen presented below.
To ensure proper detection of a pulse signal when the latching input option is
selected, the pulse width (TON) and the period (P) must meet the following two
requirements:
z TON ≥1 ms
z The input signal period (P) must be at least twice the maximum program scan
time (%SW31):
P ≥ 2 x %SW31
NOTE: If this condition is not fulfilled, some pulses may be missed
The following figure shows the input signal requirements when latching input is
used:
The key switch has not been included in the above table as this is a special type of
input that cannot be configured in TwidoSuite and has no dedicated address. For
more information (see Twido Extreme Addressing Inputs/Outputs (I/O), page 166).
NOTE: In ladder programs the I/O address syntax is %I0.i (i=0...19) and %Q0.j
(j=0...18) as is displayed in the configuration tables. In list programs however, the
syntax %IW0.0.i and %Q0.0.j is used to refer to these same addresses. Inputs
%I0.13-%I0.19 are discrete mappings of analog inputs.
Latch? Check box selected or not. Latching allows incoming pulses with
This applies to only the first 4 inputs %I0.0 to %I0.3. amplitude widths shorter than the PLC scan
Inputs with filters cannot be latched. time to be captured and recorded.
Inputs associated with events cannot be latched.
Selected relates to latched.
Cleared relates to not latched.
Run/Stop? Check box selected or not. To run or stop a PLC program.
This applies to only the first 13 inputs %I0.0 - %I0.12.
Selected relates to RUN.
Cleared relates to STOP.
Deactivation Drop-down list box with following options: To configure whether an event is triggered
z Not used by an input.
z Rising edge
z Falling edge
z Both edges
Introduction
This section describes the configuration of analog inputs and provides an example.
Analog Input
There are three types of analog input :
z Active (Sensor) Analog input
z Passive (Sensor) Analog input
z PWM input
Active sensors use external power to provide signals.
Passive sensors use part of the signal energy.
PWM inputs are described in the next section.
Scrolling down in the Module Configuration Input tab lists the analog inputs used and
available, as shown below :
Overview
This section describes the configuration of PWM inputs.
PWM Input
Pulse Width Modulation (PWM) input is a special type of input that converts a
rectangular signal input into a parameter (calculating it from the signal).
This is particularly useful in creating a more stable environment which is less
sensitive to noise disturbance.
For example, a single axis lever (see Twido Extreme PWM Input Configuration
Example, page 181) can be used with more precision with less risk of erratic
behavior caused by noise. This is a distinctive feature of the Twido Extreme PLC.
Introduction
This section illustrates how to configure a Twido Extreme PWM input by means of
an application example.
In this example you will learn how to:
z configure a PWM input to accept a single-axis lever, and
z use this input to control the speed and direction of a motor.
The direction and speed of the motor depend on the PWM duty cycle provided by
the lever output signal:
Condition Result
If duty cycle > 52% Motor turns clockwise, speed = (duty cycle - 50)*30 rpm,
green signal unit lights up
If 48% ≤duty cycle ≤52% Motor stops, red signal unit lights up
If duty cycle < 48% Motor turns anticlockwise, speed = (50 - duty cycle )*30 rpm,
yellow signal unit lights up
A CANopen network is used between the PLC and the Altivar drive. The
Twido Extreme has an integrated CANopen field bus so no additional CANopen
module is required.
The Altivar drive is controlled by the DRIVE macro that is used in the PLC program.
Step Action
1 Declare the Twido Extreme in the Describe window using drag and drop from
the describe catalog and create a CANopen network with an ATV31 drive to
control the motor speed and direction.
Note: Implementing a CANopen bus (see page 268) describes how to create
CANopen networks . For Twido Extreme a CANopen master module is not
required as this is integrated in the Twido Extreme. Other CANopen features
for the Twido Extreme are presented in CANopen Fieldbus Overview,
page 254.
2 Configure the PWM input using TwidoSuite, to convert the PWM signal
generated by the single axis lever to a ratio.
Step Action
3 Write a program to activate Twido Extreme outputs depending on the ratio
value calculated from the input signal.
4 Physically connect the hardware components previously listed to the
Twido Extreme PLC.
5 Transfer the program from the PC to the PLC.
NOTE: Further details on these configuration fields are provided in PWM Input
Configuration (see page 179).
Input/Output Connections
Connect the hardware inputs and outputs:
z Connect the output of the lever to the %IW0.7 Twido Extreme input.
z Connect the Altivar drive input via the junction box to the Twido Extreme
CANopen port.
z Connect the Twido Extreme outputs %Q0.5, %Q0.6 and %Q0.7 to the signalling
units to enable the system to be monitored.
z Connect the Altivar drive to the motor.
z Connect the BlueTooth dongle to the Twido Extreme for program transfer.
NOTE: For more information about the single-axis lever and I/O connections (see ).
Introduction
This section describes the configuration of discrete outputs.
Discrete Output
Discrete output is the only type of output for the Twido Extreme.
Discrete outputs may be standard discrete outputs or relate to function blocks (such
as PWM or PLS) or provide information concerning the PLC status (such an output
is limited to 50 mA). One output performs in reverse logic: a value of 1 relates to a
0 (or low) voltage and a value of 0 relates to a high voltage. This can be useful for
certain applications, such as relays.
Scrolling down in the Module Configuration Output tab lists the discrete outputs used
and available, as shown below:
Introduction
This section describes the configuration of PLS output for the Twido Extreme PLC.
A %PLS function block has several variables which are summarized in the following
table Configuring a %PLS Function Block (see page 194) describes how to
configure these variables.
The %PLSi (i = 0...2) function block has the following variables:
PLSi.ND1 Total No. of pulses (double word format) 0 ≤PLSi.ND ≤4 294 967 295 Y
to be generated.
Note
1 The variable PLSi.N (or ND
for double word) defines the total number of pulses desired. This must be defined in the
user’s ladder/list program using, for example, an operator block, as shown below in step 1.
The following illustration shows a pulse diagram for the PLS function block.
Step Action
1 Create a %PLSi function block in the ladder/list editor (i = 0..2) Ladder Diagram
Blocks (see page 404).
2 Example: Ladder program with function block in section 2 and %PLSi.N
variable configured in section 1 (1).
(1) The variable PLSi.N (or ND for double word) defines the total number of
pulses desired. This must be defined in the ladder/list program using, for
example, an operator block, as shown in step 1.
The default value is set to 0. To produce an unlimited number of pulses, set
%PLSi.N or %PLSi.ND to zero.
Step Action
3 Example: The same example is shown below as a List program (1).
(1) The variable PLSi.N (or ND for double word) defines the total number of
pulses desired. This must be defined in the ladder/list program using, for
example, an operator block, as shown in step 1.
The default value is set to 0. To produce an unlimited number of pulses, set
%PLSi.N or %PLSi.ND to zero.
4 Open the PLS Configuration table (see page 196)
Result:
The %PLSi address that you previously defined for your function block in the
ladder editor will be displayed here (shown as selected in the Used check box).
You can define up to 3 %PLS function blocks.
5 Click the row in the left hand side pane that corresponds to the %PLSi that you
wish to configure. If you have already used the dedicated output Q0.i elsewhere
in the program you will get an error message telling you that you cannot
configure this %PLS. In this case, return to your program and assign another
%PLS or %Q.
Step Action
6 Only the General tab applies to %PLS function blocks. The other tabs (Hydraulic
and Inputs) relate only to %PWM function blocks and are not available for
%PLS.
In the right hand side pane (General tab),
z select Type %PLS
z enter a Frequency (2) (3)
For %PLS0 and %PLS1 : Frequency 10 ... 1000 Hz => Period 100 ... 10 000
For %PLS2: Frequency 10 ... 5000 Hz => Period 20 ... 10 000
z select or clear Double word
z select or clear Adjustable
Step Action
1 To open the %PLS configuration table from the Program window:
Double click the %PLS function block in the Ladder editor.
2 To open the %PLS configuration table from elsewhere In TwidoSuite:
1. Select Program →Configure →Configure the data
2. Select I/O Objects from Object Categories
3. Select %PLS/%PWM from I/O Objects
Introduction
This section describes the configuration of PWM output in standard mode.
PWM Output
The PWM is a special function that can be assigned to an output. This rectangular
signal has a constant (user-configurable) period P with the possibility of varying the
pulse width TON and thus the duty cycle (TON / P).
Illustration of PWM duty cycle:
The outputs %Q0.0 - %Q0.2 are dedicated to either a %PWM or a %PLS function
block. For example, creating the function block %PWMi (i=0...2) automatically
assigns the output %Q0.i to this function block. Once this output has been used for
%PWMi it cannot be reused by a %PLSi function block or elsewhere in the program.
A %PWM function block has several variables which are summarized in the
following table Configuring a %PWM Function Block (see page 201) describes how
to configure these variables.
The %PWMi (i = 0...2) function block has the following variables:
In the following programming example, the signal width is modified by the program
according to the state of controller inputs %I0.0 and %I0.1.
If %I0.1 and %I0.2 are set to 0 and the %PWM0.R ratio is set at 20%, the duration
of the signal at state 1 is then: 20 % x 500 ms = 100 ms.
If %I0.0 is set to 0, %I0.1 is set to 1 and the %PWM0.R ratio is set at 50%, the
duration is then 250 ms.
If %I0.0 and %I0.1 are set to 1 and the %PWM0.R ratio is set at 80% (duration 400
ms).
Programming Example:
Step Action
1 Create a %PWMi function block in the ladder/list editor (i = 0..2) Ladder Diagram
Blocks (see page 404).
Example: Ladder program with function block in section 2 and duty cycle
%PWM0.R variable configured in section 1.
Step Action
2 Open the PMW Configuration table (see page 203)
Result:
The %PWMi address that you previously defined for your function block in the
ladder editor will be displayed here (shown as selected in the Used check box).
You can define up to 3 %PWM function blocks.PMW Output Configuration
describes these fields (see page 197).
3 Click the row in the left hand side pane that corresponds to the %PWMi that you
wish to configure. If you have already used the dedicated output Q0.i elsewhere
in the program you will get an error message telling you that you cannot
configure this %PWM. In this case, return to your program and assign another
%PWM or %Q.
4 The General tab with PWM selected relates to %PWM output. The Hydraulic tab
relates to %PWM output in hydraulic mode (see page 206).
In the right hand side pane (General tab),
z select Type %PWM
z enter a Frequency (1) (2)
For %PLS0 and %PLS1 : Frequency 10 ... 1000 Hz => Period 100 ... 10 000
For %PLS2: Frequency 10 ... 5000 Hz => Period 20 ... 10 000
z select or clear Adjustable
z selecting Relative Hydraulic or Progressive Hydraulic enables the
hydraulic mode.
The duty cycle cannot be configured in this window. This must be defined in the
ladder/list program using, for example, an operator block, as shown in step 1.
(1) Entering a frequency value that is outside the range will result in an error
message.
(2)The period P (given in 10 μs) is calculated from the frequency value F that
you enter (P=1/F). A frequency of 10 results in a period of 10 000; a frequency
of 1000 gives a period of 100.
5 To configure all other required PWM outputs (including those not yet used in the
program), repeat steps 3 and 4.
When selecting another %PWM you will be asked whether or not you wish to
apply changes, to which you reply "yes"
Step Action
6 Click Apply (or change window and you will be asked whether or not you wish
to apply changes).
7
If you return to previous screen using the button, previous windows are
displayed in their prior state.
Step Action
1 To open the %PWM configuration table from the Program window:
Double click the %PWM function block in the Ladder editor.
2 To open the %PWM configuration table from elsewhere In TwidoSuite:
1. Select Program →Configure →Configure the data
2. Select I/O Objects from Object Categories
3. Select %PLS/%PWM from I/O Objects
Used Check box selected or not. For display purposes only. Displays PWM
Selected relates to used. outputs used by the program. This field cannot
Cleared relates to unused. be edited.
Address PWM Output Addresses: Address of each PWM output.
z %PWM0
z %PWM1
z %PWM2
Symbol User defined value: alphanumeric max 32 To provide name for PWM output. This field
characters. can be edited. When applied, this name is then
displayed in the Ladder/List program.
Type 3 options, to choose: To choose PLS or PWM generation.
PLS/PWM z Not Used
z %PLS
z %PWM
Frequency User defined value in the following range: Frequency of the PWM output signal.
z For %PLS0 and %PLS1 : 10 ... 1000 Hz in
standard mode.
For %PLS2: 10 ... 5000 Hz in standard mode.
z 50 Hz ... 400 Hz in hydraulic mode
(see page 206).
Period Derived from the frequency (P=1/F). Period (in10 μs) of the PWM output signal.
Note: The period can be modified in the application
program by using the %PLSi.P parameter.
Adjustable Check box selected or not This defines whether or not the preset period
If selected, it is possible to modify the period via the value can be modified.
TwidoSuite program or Animation Tables Editor
using the %PLSi.P parameter.
If not selected it is not possible to modify the period
using the %PLSi.P parameter.
Relative Check boxes (see Twido Extreme PWM Output Enable/Disable the Hydraulic Mode.
Hydraulic Configuration in Hydraulic Mode, page 206)
Progressive Note: Checking these boxes enables the Hydraulic
Hydraulic and Input tabs.
Duty Cycle
You can set and modify the duty cycle (R) in the user program using the %PWMi.R
parameter.
For Q0.0 and Q0.1, duty cycle values must be between 5% and 95%.
For Q0.2, duty cycle values must be between 20% and 80%.
Introduction
This section describes the configuration of the PWM output in hydraulic mode.
Fields in the Hydraulic tab are only enabled if you first select PWM and Relative
Hydraulic or Progressive Hydraulic in the General tab displayed below:
Displacement Ramp mode: Set the value in the range [0 s...9 s] for: To set the duration of the rising and the
z slow ramp falling of the ramp (ramp mode) or to
z fast ramp set the dither frequency (dither mode).
Dither mode: Set the value in the range [2 Hz...400 Hz]
for:
z slow dither
z fast dither
Frequency/Period User defined value in the following range: To modify the frequency value set in the
z [50 Hz...400 Hz in hydraulic mode] General tab. The period is calculated
from the user entered frequency and
cannot be directly modified.
Apply/Cancel Click: To save or discard changes to
z Apply to confirm and save changes TwidoSuite project
z Cancel to discard changes
Definition of Dither
Stiction and hysteresis can make controlling a hydraulic valve seem erratic and
unpredictable:
z stiction can prevent the valve spool from moving when input signal changes are
small, and
z hysteresis can cause the spool shift to be different for the same command signal
input, depending on whether the change is increasing or decreasing
There are 2 definitions for dither:
z In the constant zone (see page 212), a rapid, small movement of the spool about
the desired position is intended to keep the spool moving to avoid stiction. This is
limited to a movement of 5% of the total displacement value around the desired
position.
z In a rising or falling ramp (see page 212), the valve position changes frequency.
For example, for a dither with a frequency of 100 Hz, the valve changes its
position every 10 ms.
NOTE: Dither amplitude must be large enough and the frequency slow enough to
enable the spool to respond. The dither amplitude must not, however, be too large
and the frequency not too slow to not cause a resulting pulsation in the hydraulic
output.
Definition of Ramp
Ramps are used to slow down the response of a valve driver to a changing input
command. This results in a smooth transition when a rapid change of command
input signal occurs.
Ramps have no effect if the input signal change is slower than the ramp setting.
Ramps can be fixed or adjustable. For fast (or slow) settings the slope of the ramp
is the same for both rising and falling.
In Relative Hydraulic mode, Twido Extreme permits you to configure a total of four
ramps (2 slow/fast rising and 2 slow/fast falling ramps) with a PWM ratio varying
between 5% and 95% . Independent ramps will have separate ramp commands for
rising and falling (See below). You must set at least one rising and one falling ramp.
Symmetrical ramps have the same slope for rising and and falling. Independent
control of acceleration and deceleration can be achieved with separate ramp
commands for each ramp. If dual coil bi-directional valve drivers are used with four
potentiometers you can control 4 ramps (slow/fast rising and slow/fast falling).
In Progressive Hydraulic mode, Twido Extreme permits you to configure two
ramps (slow and fast) whilst defining a setpoint value that you wish the PWM ratio
to reach.
The PWM Configuration Table, Input tab obtained after selecting Progressive
Hydraulic mode in the General tab is displayed below:
Ramp Priority
In the event that both slow and fast triggers are set simultaneously for the same
ramp, the following defined order of prioirity exists to protect the valve:
z fast falling
z slow falling
z slow rising
z fast rising
Duty Cycle
You can set and modify the duty cycle(R) in the user (ladder or list) program using
the %PWMi.R parameter. For hydraulic applications, the duty cycle must lie in the
range: 5% ≤R ≤95%.
For Q0.0 and Q0.1the duty cycle values must be between 5% and 95%.
For Q0.2, the duty cycle values must be between 20% and 80%.
There are 6 different states in the PWM signal in online mode, as shown below:
4 Constant zone
Overview
This section explains how to configure PWM output in hydraulic mode through an
application example
Stage Description
1 Configure the PWM output General tab
2 Configure the PWM output Hydraulic tab
3 Configure the PWM output Input tab
Step Action
1 Select %PWM in the Type PLS/PWM field.
2 Set the frequency to 150 Hz
Result: The period in x10 μs is calculated from the frequency (P=1/F)
3 Select the one of the Hydraulic check boxes (Progressive or Relative) to enable
access to hydraulic and input tabs
4 Result:
Step Action
1 Select Ramp in the Command field.
2 Set the Slow Displacement to 6 s.
3 Set the Fast Displacement to 1 s.
4 If needed, modify the frequency previously set.
5 Result:
Step Action
1 Set the slow rising ramp.
2 Set the fast rising ramp.
3 Set the slow falling ramp.
4 Set the fast falling ramp.
5 Set the current ratio (optional)
6 Click apply to save the changes in all tabs.
7 Result:
9
Subject of this Chapter
This chapter provides information on the software installation of the AS-Interface
Master module TWDNOI10M3 and its slaves.
Introduction
The AS-Interface Bus (Actuator Sensor-Interface) allows the interconnection on a
single cable of sensor devices/actuators at the lowest level of automation.
These sensors/actuators will be defined in the documentation as slave devices.
To implement the AS-Interface application you need to define the physical context
of the application into which it will integrated (expansion bus, supply, processor,
modules, AS-Interface slave devices connected to the bus) then ensure its software
implementation.
This second aspect will be carried out from the different TwidoSuite editors:
z either in local mode,
z or in online mode.
AS-Interface V2 Bus
The AS-interface Master module TWDNOI10M3 includes the following
functionalities:
z M3 profile: This profile includes all the functionalities defined by the AS-Interface
V2 standard, but does not support the S7-4 analog profiles
z One AS-Interface channel per module
z Automatic addressing for the slave with the address 0
z Management of profiles and parameters
z Protection from polarity reversion on the bus inputs
The AS-Interface bus then allows:
z Up to 31 standard address and 62 extended address slaves
z Up to 248 inputs and 186 outputs
z Up to 7 analog slaves (Max of four I/0 per slave)
z A cycle time of 10 ms maximum
A maximum of 2 AS-Interface Master modules can be connected to a Twido modular
controller, a TWDLC•A24DRF or a TWDLC••40DRFcompact controller.
General Introduction
For the AS-Interface configuration, TwidoSuite software allows the user to:
z Manually configure the bus (declaration of slaves and assignment of addresses
on the bus)
z Adapt the configuration according to what is present on the bus
z Acknowledge the slave parameters
z Control bus status
For this reason, all data coming from or going to the AS-Interface Master are stored
in specific objects (words and bits).
Key:
Key:
Note: The operating parameters, address, configuration and identification data are saved
in a non-volatile memory.
At a Glance
To respect the philosophy adopted in TwidoSuite, the user should adopt a step-by-
step approach when creating an AS-Interface application.
Set up Principle
The user must know how to functionally configure his AS-Interface bus
(see page 242).
The following table shows the different software implementation phases of the AS-
Interface bus.
NOTE: The declaration and deletion of the AS-Interface Master module on the
expansion bus is the same as for another expansion module. However, once two
AS-Interface Master modules have been declared on the expansion bus,
TwidoSuite will not permit another one to be declared.
At a Glance
The configuration screen of the AS-Interface master module gives access to the
parameters associated with the module and the slave devices.
It can be used to display and modify parameters in offline mode.
NOTE: In order to access to the AS-Interface master module configuration screen :
double click on the AS-Interface master module, or go to program\ configure\
configure the hardware page and click on AS-Interface master module.
Blocks Description
AS-interface configuration Bus image desired by the user: view of standard and extended
address setting slaves expected on the bus. Move the cursor
down the vertical bar to access the following addresses.
Inaccessible addresses correspond to addresses not available
here for slave configuration. If, for example, a new standard
address setting slave is declared with the address 1A, the
address 1B is automatically made inaccessible.
Slave xxA/B Configuration of the selected slave:
z Characteristics: IO code, ID code, ID1 and ID2 codes
(profiles), and comments on the slave,
z Parameters: list of parameters (modifiable), in binary (4
check boxes) or decimal (1 check box) form, at the discretion
of the user,
z Inputs/Outputs: list of available I/Os and their respective
addresses.
Master mode Activation or deactivation is possible for the two functionalities
available for this AS-Interface module (for example, automatic
addressing).
"Network down" allows you to force the AS-Interface bus to
enter the offline mode.
"Automatic addressing" mode is checked by default.
Note: The "Data exchange activation" function is not yet
available.
Buttons Description
Apply Saves the AS-Interface Bus current configuration data.
The configuration can then be transferred to the Twido
controller.
Cancel Discard all changes in progress.
NOTE: Changes in the configuration screen can only be made in offline mode.
Introduction
AS-Interface bus configuration takes place in the configuration screen in local mode.
Once the AS-Interface Master and the master modes have been selected,
configuration of the AS-Interface bus consists of configuring the slave devices.
Step Action
1 Select the desired address cell (from those available) in the bus image:
Step Action
2 In the slave configuration screen, enter or modify:
z the name of the new profile (limited to 13 characters),
z a comment (optional).
Or click Insert from catalog button in the function quick access bar and
select a slave from the pre-configured AS-Interface profile family.
Illustration of a Configuration Screen for a slave:
Note:
z For a new slave, a new screen for configuring the slave is displayed, the
"Address" field shows the selected address, the "Profile" fields are set to F
by default and all other fields in the screen are blank
z For a modification, the slave configuration screen is displayed with fields
containing the values previously defined for the selected slave
3 Enter:
z the IO code (corresponds to the input/output configuration),
z the ID code (identifier), (plus ID1 and for an extended type).
Note:
The "Inputs" and "Outputs" fields show the number of input and output
channels. They are automatically implemented when the IO code is entered.
4 For each parameter define:
z the system’s acknowledgement (box checked in "Bits" view, or decimal
value between 0 and 15 in "Decimal" view),
z a name that is more meaningful than "Parameter X" (optional).
Note:
The selected parameters are the image of permanent parameters to be
provided to the AS-Interface Master.
Step Action
5 If needed, modify "Address" (within the limit of available addresses on the bus),
by clicking the up/down arrows to the left of the address (access is then given
to authorized addresses) or by entering the address using the keyboard.
6 Confirm the slave configuration by clicking on the Apply button.
The result is the check that:
z the IO and ID are authorized,
z the slave address is authorized (if keyboard entry is used) according to the
ID code ("bank" /B slaves are only available if the ID code is equal to A).
If a detected error occurs, an error message warns the user (for example: "The
slave cannot have this address") and the screen is displayed again with the
initial values (in the profile or address, depending on the condition itself).
AS-Interface Catalog
button
The drop-down menu gives you access to all product families of the Schneider AS-
Interface catalog:
After you have selected a product, the list of corresponding slaves appears. Click on
the required slave and validate by clicking "Insert"
NOTE:
z Click the product name in the AS-Interface catalog to display its characteristics in
the right pane.
z You can add and configure slaves that are not part of the Schneider catalog.
Simply select the private family and configure the new slave.
Shortcut menu
When you right click, a shortcut menu appears:
At a Glance
When the PC is connected to the controller (after uploading the application to the
controller), the AS-Interface Window displays online features.
In online mode, the AS-Interface Window dynamically provides an image of the
physical bus that includes the:
z List of expected slaves (entered) during configuration with their name, and the list
of detected slaves (with unknown names, but otherwise expected),
z Status of the AS-Interface module and the slave devices,
z Image of the profile, parameters and input/output values of the selected slaves.
It also enables the user:
z To obtain diagnostics of the slaves on which an error is detected (see page 233),
z To modify the address of a slave in online mode (see page 235),
z To transmit the image of the slaves to the configuration screen (see page 237),
z To address all the slaves with the desired addresses (during the first debugging).
Schedule Description
AS-interface V2 Image of the physical bus.
configuration Includes slave status:
z Green indicator lamp: the slave with this address is active.
z Red indicator lamp: an error is detected on the slave at this
address, and the message informs you of the error type in the
"Error on the network" window.
Slave xxA/B Image of the configuration of the selected slave:
z Characteristics: image of the profile detected (unavailable, non-
modifiable),
z Parameters: image of the parameters detected. The user can
select only the parameter display format,
z Inputs/Outputs: the input/output values detected are displayed,
non-modifiable.
Error on the network Informs you of the detected error type, if an error is detected on the
selected slave.
AS-Interface Bus Information resulting from an implicit "Read Status" command.
z Shows bus status: for example, "Configuration OK = OFF"
indicates that the configuration specified by the user does not
correspond to the physical configuration of the bus,
z Shows the authorized functionalities for the AS-Interface Master
module: for example, "Automatic addressing active = ON"
indicates that the automatic addressing Master mode is
authorized.
At a Glance
From the AS-Interface Window, the user can modify the address of a slave in online
mode.
The following table shows the procedure for modifying a slave address:
Step Description
1 Access the AS-Interface Window.
2 Select a slave in the "AS-interface V2 Configuration" zone.
3 Drag and drop the slave to the cell corresponding to the desired address.
Illustration: Dragging and dropping slave 3B to address 15B
Step Description
Result:
All the slave parameters are automatically checked to see if the operation is possible.
Illustration of result:
After performing this operation, the diagnostics for the slave at address 3B indicate "slave
not detected" meaning that the slave expected at this address is no longer there. By
selecting the address 15B, the profile and the parameters of the moved slave can be re-
located, but the name of the slave remains unknown as it was not expected at this address.
NOTE: The profile and parameters of a slave are not associated with a name.
Several slaves with different names can have the same profiles and parameters.
At a Glance
In online mode, no modification of the configuration screen is authorized and the
physical configuration and software configuration can be different. Any difference in
profile or parameters for a configured or non-configured slave can be taken into
account in the configuration screen; in fact, it is possible to transmit any modification
to the configuration screen before transferring the new application to the controller.
The procedure to follow in order to take the physical configuration into account is the
following:
Step Description
1 Transfer of the desired slave configuration to the configuration screen.
2 Acceptance of the configuration in the configuration screen.
3 Confirmation of the new configuration.
4 Transfer of the application to the module.
Step Description
1 Access the AS-Interface window.
2 Select the desired slave in the "AS-interface V2 Configuration" zone.
Step Description
3 Right click on the mouse to select "Transfer Conf".
Illustration:
Result:
The image of the selected slave (image of the profile and parameters) is then
transferred to the configuration screen.
4 Repeat the operation for each of the slaves whose image you would like to
transfer to the configuration screen.
Key:
z The cross signifies that there are differences between the image of the profile of
the transferred slave, and the profile initially desired in the configuration screen.
z The exclamation mark signifies that a new profile was added to the configuration
screen.
Explanation:
The configuration screen always shows the permanent image of the desired
configuration (this is why the slave is still present as 3B in spite of the change of
address (see page 235)), completed by the current image of the bus.
The profiles and parameters of the expected slaves displayed correspond to those
which were expected. The profiles and parameters of the unknown slaves displayed
correspond to the images of those detected.
The following table describes the steps to follow to confirm and transfer the definitive
configuration to the module:
Step Action
1 Via the software, disconnect the PC from the module.
Note:
No modification can be carried out in the configuration screen if the PC is
connected to the module.
2 Right click on the desired slave.
3 2 choices:
z Select "Accept Conf" to accept the detected profile of the selected slave.
Illustration:
For each of the slaves marked with a cross, a message will warn the user that
this operation will overwrite the initial profile (displayed on-screen) of the slave.
z Select the other choices in the right click menu to configure the selected
slave manually.
4 Repeat the operation for each of the desired slaves in the configuration.
5 Press the "OK" button to confirm and create the new application.
Result: Automatic return to the main screen.
6 Transfer the application to the module.
At a Glance
Each slave on the AS-Interface bus must be assigned (via configuration) a unique
physical address. This must be the same as the one declared in TwidoSuite.
TwidoSuite software offers an automatic slave addressing utility so that an AS-
Interface console does not have to be used.
The automatic addressing utility is used for:
z replacing an inoperative slave,
z inserting a new slave.
Procedure
The table below shows the procedure for setting the Automatic addressing
parameter.
Step Action
1 Access the AS-Interface V2 master module’s configuration screen.
2 Click on the Automatic addressing check box found in the Master mode
zone.
Result: The Automatic addressing utility will be activated (box checked) or
disabled (box not checked.
Note: By default, the Automatic addressing parameter has been selected in
the configuration screen.
At a Glance
It is possible to insert a device into an existing AS-Interface V2 configuration without
having to use the pocket programmer.
This operation is possible once:
z the Automatic addressing utility of configuration mode is active (see page 241),
z a single slave is absent in the physical configuration,
z the slave which is to be inserted is specified in the configuration screen,
z the slave has the profile expected by the configuration,
z the slave has the address 0 (A).
The AS-Interface V2 module will therefore automatically assign to the slave the
value predefined in the configuration.
Procedure
The following table shows the procedure for making the automatic insertion of a new
slave effective.
Step Action
1 Add the new slave in the configuration screen in local mode.
2 Carry out a configuration transfer to the PLC in connected mode.
3 Physically link the new slave with address 0 (A) to the AS-Interface V2 bus.
Principle
When a slave has been declared inoperative, it can be automatically replaced with
a slave of the same type.
This happens without the AS-Interface V2 bus having to stop, and without requiring
any manipulation since the configuration mode’s Automatic addressing utility is
active (see page 241).
Two options are available:
z The replacement slave is programmed with the same address using the pocket
programmer, and has the same profile and sub-profile as the inoperative slave. It
is thus automatically inserted into the list of detected slaves (LDS) and into the
list of active slaves (LAS),
z The replacement slave is blank (address 0 (A), new slave) and has the same
profile as the inoperative slave. It will automatically assume the address of the
replaced slave, and will then be inserted into the list of detected slaves (LDS) and
the list of active slaves (LAS).
At a Glance
This page presents the details relating to the addressing of discrete or analog I/Os
of slave devices.
To avoid confusion with Remote I/Os, new symbols are available with an AS-
Interface syntax: %IA for example.
Illustration
Reminder of the principles of addressing:
Specific Values
The table below gives specific values to AS-Interface V2 slave objects:
Examples
The table below shows some examples of I/O addressing:
Implicit Exchanges
The objects described below are exchanged implicitly, in other words they are
exchanged automatically on each PLC cycle.
Explicit Exchanges
Objects (words and bits) associated with the AS-Interface bus contribute data (for
example: bus operation, slave status, etc.) and additional commands to carry out
advanced programming of the AS-Interface function.
These objects are exchanged explicitly between the Twido controller and the AS-
Interface Master by the expansion bus:
z At the request of the program user by way of the instruction: ASI_CMD (see
"Presentation of the ASI_CMD" instruction below)
z Via the AS-Interface window or the animation table.
Symbol Description
n Address of AS-Interface expansion module (1 to 7).
x Number of the first internal word (memory word) passed in parameter.
l Length of the instruction in number of words (2).
NOTE: Bus status is updated on each PLC scan.. But the result of the ASI_CMD bus
reading instruction is available only at the end if the following PLC scan.
%MWx %MWx+1
value most significant byte least significant byte
bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
4, 8, 12 15A 14A 13A 12A 11A 10A 9A 8A 7A 6A 5A 4A 3A 2A 1A 0A
5, 9, 13 31A 30A 29A 28A 27A 26A 25A 24A 23A 22A 21A 20A 19A 18A 17A 16A
6, 10, 14 15B 14B 13B 12B 11B 10B 9B 8B 7B 6B 5B 4B 3B 2B 1B 0B
7, 11, 15 31B 30B 29B 28B 27B 26B 25B 24B 23B 22B 21B 20B 19B 18B 17B 16B
To read whether slave 20B is active, the ASI_CMD instruction must be executed
with the %MWx internal word having a value of 7. The result is returned in the
%MWx+1 internal word; the status of slave 20B is given by the value of bit 4 of the
least significant byte: If bit 4 is equal to 1, then slave 20B is active.
At a Glance
The AS-Interface bus interface module TWDNOI10M3 has three operating modes,
each of which responds to particular needs. These modes are:
z Protected mode,
z Offline mode,
z Data Exchange Off mode.
Using the ASI_CMD (see page 246) instruction in a user program allows you to
enter or exit these modes.
Protected Mode
The protected operating mode is the mode generally used for an application which
is running. It assumes that the AS-Interface V2 module is configured in TwidoSuite.
This:
z continually checks that the list of detected slaves is the same as the list of
expected slaves,
z monitors the power supply.
In this mode, a slave will only be activated if it has been declared in the configuration
and been detected.
At power up or during the configuration phase, the Twido controller forces the AS-
Interface module into protected mode.
Offline Mode
When the module is put into Offline mode, it first resets all the slaves present to zero
and stops exchanges on the bus. When in Offline mode, the outputs are forced to
zero.
In addition to using the PB2 button on the TWDNOI10M3 AS-Interface module,
Offline mode can also be accessed via the software by using the ASI_CMD
(see page 249) instruction, which also allows you to exit the mode and return to
protected mode.
Introduction
The following describes useful technical terms and acronyms for CANopen network
communication.
EDS file
EDS (Electronic Data Sheet)
An EDS file describes the communication properties of a device on the CAN network
(baudrates, transmission types, I/O features, ...). It is provided by the device
manufacturer. It is used in the configuration tool to configure a node (like a driver in
an operating system).
PDO
PDO (Process Data Object)
CANopen frame containing I/O data.
We distinguish between:
z Transmit-PDOs (TPDOs with data provided by a node) and
z Receive-PDOs (RPDOs with data to be consumed by a node).
The transmission direction is always seen from a node’s point of view. A PDO (either
TPDO or RPDO) does not necessarily contain the whole data image of a node.
Normally, analog input data and discrete input data are divided into different TPDOs.
The same is true for outputs.
SDO
SDO (Service Data Object)
CANopen frames containing parameters.
SDOs are typically used to read or write parameters while the application is running.
COB-ID
COB-ID (Communication Object Identifier)
Each CANopen frame starts with a COB-ID working as the Identifier in the CAN
frame. During the configuration phase, each node receives the COB-ID(s) of the
frame(s) for which it is the provider (or consumer).
About CANopen
Introduction
CANopen is a standard fieldbus protocol for industrial control systems. It is
particularly well suited to real-time PLCs, as it provides an effective, low-cost
solution for integrated and transportable industrial applications.
Physical Layer
CAN uses a differentially driven two-wire bus line (common return). A CAN signal is
the difference between the voltage levels of the CAN-high and CAN-low wires. (See
figure below.)
The following diagram shows the components of the physical layer of a two-wire
CAN bus:
1 CAN-high wire
2 CAN-low wire
3 potential difference between CAN-high/CAN-low signals
4 120Ω resistance jack
5 node
The bus wires can be routed in parallel, twisted or shielded form in accordance with
electromagnetic compatibility requirements. A single line structure minimizes
reflection.
CANopen Profiles
The communication profile
The CANopen profile family is based on a "communication profile", which specifies
the main communication mechanisms and their description (DS301).
CAN Standards
CANopen specifications are defined by the CiA group and can be accessed (subject
to some restrictions) on the group site at http://www.can-cia.com. The sourcecodes
for master and slave devices are available from the various suppliers.
NOTE: To find out more about CANopen standard specifications and mechanisms,
please visit CiA’s home page (http://www.can-cia.de/).
CANOpen Boot-Up
Boot-up Procedure
A minimum device configuration specifies a shortened boot procedure. This
procedure is illustrated in the following diagram:
Legend
Number Description
1 Module power up
2 After initialization, the module automatically goes into PRE-
OPERATIONAL state.
3 NMT service indication: START REMOTE NODE
4 NMT service indication: PRE-OPERATIONAL
Number Description
5 NMT service indication: STOP REMOTE NODE
6 NMT service indication: RESET NODE
7 NMT service indication: RESET COMMUNICATION
Reset Application
The device goes into the "Reset Application" state:
z after the device starts up,
z or by using the "Reset Node" Network management (NMT) service.
In this state, the device profile is initialized, and all the device profile information is
reset to default values. When initialization is complete, the device automatically
goes into the "Reset Communication" state.
Reset Communication
The device goes into the "Reset Communication" state:
z after the "Reset Application" state,
z or by using the "Reset Communication" Network management (NMT) service.
In this state, all the parameters (standard values, depending on the device
configuration) of the supported communication objects (objects pertaining to device
identification such as device type, heartbeat, etc.: 1000H - 1FFFH) are saved in the
object directory. The device then automatically goes into the "Init" state.
Init
The device goes into "Init" mode after being in the "Reset Communication" state.
This state enables you to:
z define the required communication objects (SDO, PDO, Emergency),
z install the corresponding CAL services
z configure the CAN-Controller.
Initialization of the device is complete and the device automatically goes into the
"Pre-Operational" state.
NOTE: The TWDNCO1M CANopen master module and the Twido Extreme
integrated CANopen bus master does not support SYNC mode.
Pre-Operational
The device goes into "Pre-Operational" state:
z after the "Init" state, or
z on receiving the "Enter Pre-Operational" NMT indication if it was in Operational
state.
When the device is in this state, its configuration can be modified. However, only
SDOs can be used to read or write device-related data.
When configuration is complete, the device goes into one of the following states on
receiving the corresponding indication:
z "Stopped" on receiving the "STOP REMOTE NODE" NMT indication,
z "Operational" on receiving the "START REMOTE NODE" NMT indication.
Stopped
The device goes into the "Stopped" state on receiving the "Node stop" indication
(NMT service) if it was in "Pre-Operational" or "Operational" state.
In this state, the device cannot be configured. No service is available to read and
write device-related data (SDO). Only the slave monitoring function ("Node
guarding") remains active.
Operational
The device goes into the "Operational" state if it was in the "Pre-Operational" state
on receiving the "Start Remote Node" indication.
When the CANopen network is started using the "Node start" NMT services in
"Operational" state, all device functionalities can be used. Communication can use
PDOs or SDOs.
NOTE: Modifications to the configuration in "Operational" mode may have
unexpected consequences and should therefore only be made in "Pre-Operational"
mode.
Definition of PDO
PDOs are objects which provide the communication interface with process data and
enable them to be exchanged in real time. A CANOpen device’s PDO set describes
the implicit exchanges between this device and its communication partners on the
network.
The exchange of PDOs is authorized when the device is in "Operational" mode.
Types of PDO
There are two types of PDO:
z PDOs transmitted by the device (often labeled:Transmit PDO or Tx-PDO or
TPDO),
z PDOs received by the device (often labeled:Receive PDO or Rx-PDO or RPDO).
What is an SDO?
Service Data Objects (SDOs) allow a device’s data to be accessed by using explicit
requests.
The SDO service is available when the device is in an "Operational" or "Pre-
Operational" state.
Types of SDO
There are two types of SDO:
z read SDOs (Download SDOs),
z write SDOs (Upload SDOs).
Client/Server Model
The SDO protocol is based on a ’Client / Server’ model.
For a Download SDO
The client sends a request indicating the object to be read.
The server returns the data contained within the object.
For an Upload SDO
The client sends a request indicating the object to be written to and the desired
value.
After the object has been updated, the server returns a confirmation message.
For an unprocessed SDO
In both cases, if an SDO could not be processed, the server returns an error code
(abort code).
Definition of Life-Time
The "Life time" parameter is calculated as follows:
Life Time = Guard Time x Life Time Factor
The object 100CH contains the ’’Guard Time’’ parameter expressed in milliseconds.
The object 100DH contains the "Life Time Factor" parameter.
Activation of Monitoring
If one of these two parameters is set to "0" (default configuration) the module does
not perform monitoring (no "Life Guarding").
To activate monitoring over time, you must at least enter the value 1 in the object
100DH and specify a time in ms in the object 100CH.
Importance of Monitoring
These two monitoring mechanisms are particularly important to the CANopen
system, given that devices do not usually operate in event-controlled mode.
Slave Monitoring
Monitoring is performed in the following way:
Phase Description
1 The master sets "Remote Frames" (remote transmit requests) on the
"Guarding COB-IDs" of the slaves to be monitored.
2 The slaves concerned respond by sending the "Guarding" message. It
contains the "Status Code" of the slave and the "Toggle Bit", which must
change after each message.
3 The master compares the "Status" and "Toggle Bit" information:
If they are not in the state expected by the NMT master or if no response is
received, the master considers that an error is detected on the slave.
Master Monitoring
If the master requests "Guarding" messages on a strictly cyclical basis, the slave
can detect if a master is inoperative.
If the slave does not receive a request from the master within the defined "Life Time"
interval (Guarding error), it considers that the master is inoperative ("Watchdog"
function).
In this case, the corresponding outputs go into an error state and the slave switches
back into "Pre-Operational" mode.
NOTE: The "Remote" request from the master obtains a response, even if there are
no values entered in the "Guard Time" and "Life Time Factor" objects. Time
monitoring is only activated when the values in the two objects are greater than 0.
Typical values for the "Guard Time" parameter are between 250 ms and 2 seconds.
"Guarding" Protocol
The value of the ’’Toggle Bit’’ (t) sent in the first ’’Guarding’’ message is ’’0’’.
Then, the bit changes (’’toggles’’) in each subsequent ’’Guarding’’ message, which
makes it possible to indicate if a message has been lost.
The bus head indicates its network state (s) in the seven remaining bits:
Introduction
This section describes how to implement the CANopen fieldbus on the Twido PLC
system, using either the TWDNCO1M CANopen master module or the
Twido Extreme integrated CANopen bus.
Overview
Hardware Requirements
Twido PLC compact or modular Compact base:
base controller z TWDLC•24DRF
z TWDLC••40DRF
Modular base:
z TWDLMDA20•••
z TWDLMDA40•••
Software Requirements
Twido PLC configuration TwidoSuite
software
Hardware Requirements
Twido Extreme base TWDLEDCK1
controller
CANopen slave devices 16 CANopen slaves maximum
CANopen connectors and See Twido Extreme Hardware Guide.
cables
Programming cable for the z Serial cable: VW3 A8106
Twido Extreme z USB cables: TSX CUSB485 and TWD XCAFJ010
z PLC BlueTooth adapter: VW3 A8114
Software Requirements
Twido PLC configuration TwidoSuite
software
Step Description
1 Hardware Setup
2 Configuration Methodology
3 Declaration of the CANopen Master
4 Network CANopen Slave Declaration
5 CANopen Objects Mapping
6 CANopen Objects Linking
7 CANopen Objects Symbolization
8 Network CANopen Diagnostics
The following sub-sections will provide a detailed description of each step of this procedure.
Hardware Setup
Overview
This functionality allows the user to configure the reset of CANOpen slaves.
User functionality
To reset the CANOpen slaves three configurations exist:
z Default Reset (Default Value):
CANOpen Master choose which Reset is sent to slave (Reset Com only for
Lexium 05, Reset All for all other slaves).
z Reset All Parameters:
CANOpen Master forces the Reset All on the slave (even Lexium 05).
z Reset Communication Only (recommended for customers):
CANOpen Master resets only communication of the slave.
Each configuration can be used for each slave.
Modes of Operation
To configure CANOpen network, add CANOpen Master expansion Describe tab
of TwidoSuite. Next, add its CANOpen Slaves for the Describe list and link them
each other.
Step Action
1 Double click on CAN Open network to link the PDOs of the slave.
Step Action
2 Right click on the slave to configure the CAN Open (slave’s mapping) and to configure the slave
NOTE: It is possible to configure the Reset Parameter. Default is the default value. It is also possible to
delete the slave.
Step Action
3 Double click on the CAN Open master to see the global configuration of the module on Configuration Part of
TwidoSuite.
Compatibility
To implement this functionality, the functional level must be increased to 5.2. For
more information on functional levels, refer to Functional Levels Description.
NOTE: New applications generated with TwidoSuite V2.20 won’t be open with an
oldest version of TwidoSuite. The Firmware is also impacted, a new version must be
synchronized with TwidoSuite.
Configuration Methodology
Overview
The CANopen configuration is performed via the CANopen Configuration tools
accessible from the Describe window in TwidoSuite.
NOTE:
1. CANopen network, master and slave configuration, as well as configuration of
communication parameters is performed only in Offline mode.
2. No change to the CANopen configuration is allowed in Online mode.
3. In Online mode, only certain parameters can be adjusted, such as %IWC and
%QWC PDO addressing parameters.
Configuration Methodology
The following table describes the different software implementation phases of the
CANopen bus:
NOTE: The declaration and deletion of the TWDNCO1M CANopen master module
on the expansion bus is the same as for any other expansion module. However, only
one CANopen master module is allowed on the Twido expansion bus. The
TwidoSuite user interface program will not permit another CANopen module to be
added.
Overview
This section explains how to declare a CANopen bus master module on your
compact or modular controller internal bus.
NOTE: The information in the section is not applicable to Twido Extreme
TWDLDCK1 base controller which has an integrated CANopen bus master module.
Procedure
The table below shows the different steps when declaring the master CANopen.
Overview
This section describes how to access the CANopen configuration tool.
CANopen Configurator
The CANopen configuration tool is accessed from the Describe window by clicking
on the appropriate CANopen element as follows:
The Master CANopen configuration screen can also be viewed (but not edited) by
selecting Program →Configure →Configure the Hardware task.
z for Twido Extreme TWDLEDCK1, select the CANopen tab and click Configure.
z for other compact and modular base controllers, select the TWDNCO1M module
in the upper graphical pane and click Configure in the lower configuration pane
(there are no tabs for compact and modular PLCs).
NOTE: You can deactivate the Twido Extreme integrated CANopen bus master by
clearing the Activate CANopen network check box in the CANopen tab of the
configuration pane. This will free CANopen dedicated memory. Deactivating the
Twido Extreme integrated CANopen bus master will delete the CANopen network
configuration.
Overview
The network CANopen slave declaration is a three-stage process that consists of:
1. importing the CANopen slave devices’ EDS files into the Twido Describe catalog,
2. building the CANopen network by adding up to 16 slave devices from the catalog
to the network,
3. configuring the network management parameters (network speed and error
control protocol parameters.)
Step Action
1 Right click on CANopen Elements in the Catalog of the Describe window and
select Import as shown below.
Step Action
3 Choose an EDS file ("filename".EDS) from the list and click Open.
Result: The CANopen Configuration Tool loads the object dictionary for the
selected device.
Note: This process may take several minutes, depending on the size of the
selected EDS file. A progress bar indicates the state of completion of the loading
process, as shown in the example below:
4 Wait till the loading process is complete, then repeat steps 2 to 3 for any new
slave profile you want to add to the catalog.
Note: You only need to perform this process once, for all device profiles and
object dictionaries listed in the loaded catalog are stored by TwidoSuite.
Step Action
5 To display the device properties of a CANopen slave, expand the CANopen
Elements tree structure in the catalog of the Describe window by double clicking
the type of element (or the plus sign to its left)to the lowest level and then, clicking
the slave device, as shown below:
Note: The device properties of the selected CANopen slave are shown in the
lower half of the Catalog area, these are:
z the vendor’s name (for example, Schneider Electric),
z the slave profile (for example, EDS file for ATV 31 CANopen Slave),
z the author’s name (for example, Author S.T.I.E.),
z the creation date for that profile (for example, 01-14-2004.)
Step Action
6 Note: Basic slaves, for example BASIC_ATV371, are slaves that when included
in your CANopen configuration (Describe workspace) are preconfigured. Other
profiles in the catalog, for example, ATV71_V1.1 (V1.1) provide you with
unconfigured slaves that can be later customized.
In order to add OTB or FTB slaves, right click on Advantys OTB (or Advantys
FTB) and select Configure. This launches the external configuration tool
Advantys Lite which should be already installed on your computer.
7 To delete a slave profile from the Catalog, right click on the profile, in the Catalog
and select Delete as shown below.
Note: You may store in the CANopen Elements Catalog more device profiles than
you actually need for your current CANopen bus configuration. Profiles that are
already loaded in the Catalog may be stored for future use.
Step Action
1 Expand the CANopen Elements tree structure in the Catalog of the Describe
window to display the appropriate slave device and its properties as previously
described in step 5 of Importing Slave Profiles.
Step Action
2 Drag and drop the desired number of slave devices from the Catalog. (See
Positioning Methods and Rules)
Result: The devices appear unconfigured in the graphical workspace of the
Describe window.
Notes:
z If you drag and drop a BASIC element from the catalog tree, for example:
BASIC_ATV371, the device placed in the Describe workspace is
preconfigured (PDO mappings defined) and requires only an address and
an optional name to be assigned. If you select a non basic element, for
example: ATV71_V1.1 (V1.1), the device placed in the Describe workspace
can be customized, for more information refer to Objects Mapping
(see page 292).
z A maximum of 16 slaves can be declared on a Twido CANopen network.
Step Action
4 You can connect slaves to other slaves by Creating a Link. If the slaves are
unconfigured they will remain unconfigured until they are connected to a
CANopen master.
5 Connect the slaves to the CANopen master by Creating a Link.
Result: The connected slave (if previously unconfigured) now displays a
configuration with a name and node address. If the slave was previously
configured it retains it configuration when it is connected to the master.
The newly connected (previously unconfigured) slave device takes the node
address with the lowest available index. (For example, if slave devices are
declared at node addresses 1, 2 and 4, then a newly added slave device will
take the available node address 3, as default.
6 You can change a slave’s name and assign it to any available node address (1
to 16) by configuring it as described in step 2.
7 Repeat steps 1 to 5 for any new slave device you want to declare on the
CANopen network.
8 To delete a slave device or network link from the CANopen network, right click
the object in the graphical workspace and select Delete.
9 To configure network management parameters, right click on the network
link and select Configure (see Configuring the Network Management
Parameters (see page 283)below).
Note: The network management parameters can only be configured if the
CANopen master is linked. If the CANopen master is not linked only the name
of the network can be modified. (Default: my network x)
Supervision Options
The error control protocol you wish to use to manage communications between the
TWDNCO1M master module or the Twido Extreme integrated CANopen bus master
and the selected slave device is defined in the slave configuration with the following
options:
z Node Guarding
z Heartbeat
z None
If the supervision option is set to None in the network slaves table, the outputs will
not return to their fallback values in the event of a break in connection (*) between
this slave and the TWDNCO1M master module or the Twido Extreme integrated
CANopen bus master.
(*) this disconnection can be caused by:
z disconnection of the expansion TWDNCO1M CANopen master module from the
Twido PLC base controller (not applicable to Twido Extreme controller),
z disconnection of this CANopen slave from the Twido CANopen bus,
z an inoperative bus cable,
z a TwidoSuite "Reset" command (Online →Firmware / Reset),
Step Action
1 To configure network management parameters, right click on the network
link and select Configure.
Result:
2 Select the Baudrate (network speed) from the drop-down list: 125, 250 (default
value), 500.
3 Configure the Life-time period. This takes values in the range [300, 32,767]
with default value 300 ms. This parameter defines the communications cycle-
time period that will be implemented in the supervision field of each slave
device.
In the Supervision field, enter the consumer time in ms.
The CANopen master calculates the producer time from this value using the
following formula:
Producer time = 2/3 Consumer time
Note: Do not enter 0 in this field.
Overview
The Mapping dialog box of a slave CANopen configuration allows you to consult the
slave dictionary and configure the PDOs of each slave device (for slaves without
default PDOs) declared on the network.
Objects Mapping
To find out how to use the Mapping dialog box to configure the TPDOs and RPDOs
of each slave device, follow these guidelines:
Step Action
1 Double click (or right click and select CANopen Configuration) on the slave for you
wish to configure. (The slave must be linked to a CANopen Master for this option to
be available).
Result:
All CANopen objects supported by the selected slave are displayed on the left under
Available Objects.
Predefined default PDOs - Transmit-PDOs (PDO TX) for the selected slave are
displayed on the right. Use the Type toggle list to display the predefined default
Receive-PDOs (PDO RX).
Mapped Objects on the lower right shows the predefined mapping of each selected
PDO.
2 You may choose to customize the PDO mapping for "non BASIC" slaves, for
example: ATV71_V1.1 (V1.1), that you dragged and dropped into the Describe
graphical workspace. The "BASIC" slaves are already configured and cannot
therefore be customized. Customization is possible using these Mapped Objects.
A RPDO or TPDO is a 64-byte object that can contain up to eight 8-byte word objects
or four 16-byte word objects or any combination of those two types of word objects,
not too exceed the overall 64-byte limit of the PDO.
To customize the PDO mapping, select the Mapped Object you wish to modify.
Example: Select the first Transmit-PDO (PDO R1).
Result: The predefined PDO mapping (or the current customized mapping) appears
in the Mapped Object frame.
Step Action
3 To delete an unused word object from the PDO mapping structure, select the word
you wish to map, and click the Add icon to append the word object to the
Mapped Objects structure.
Note: To restore the default mapping structure for the selected PDO, click the
Default icon .
5 To change a word object’s address within the mapped PDO structure, use the Move
Overview
The Linking dialog box of the Master CANopen Configuration is used to define the
physical link between the selected PDOs of the slave devices and the TWDNCO1M
CANopen master module or the Twido Extreme integrated CANopen bus master
PDOs.
Objects Linking
To find out how to use the Linking dialog box to define the physical link between
slave device and master module PDOs, follow these guidelines:
Step Action
1 Double click (or right click and select CANopen Configuration) the CANopen
Master port on the TWDNCO1M or Twido Extreme.
Result: The Linking dialog box appears on screen, as shown in the following
figure:
Non-linked PDOs are displayed on the left under Not-Linked Slave PDOs and
the linked PDOs are displayed on the right under Linked Master PDOs.
Use the Type toggle list to switch between Receive and Transmit PDOs.
Note: Selecting Receive or Transmit in the Slave PDOs frame automatically
toggles the Master PDOs to the opposite type: Transmit or Receive,
respectively.
2 From the Not-Linked Slave PDOs frame, select the PDO you wish to link to the
TWDNCO1M CANopen master or the Twido Extreme integrated CANopen bus
master and click the Add icon to append the PDO to the Master PDOs
link list.
Note: The TWDNCO1M master and the Twido Extreme integrated CANopen
bus master supports a maximum of 16 TPDO links and 16 RPDO links.
3 To change the address index of a PDO link within the Linked Master PDOs
Step Action
4 To delete an unused PDO link within the Linked Master PDOs frame, select the
dialog box: .
Overview
The Symbol column in the CANopen master module configuration dialog box allows
you to define a symbol for the variables associated with the CANopen master.
Object Symbols
CANopen object symbols can be edited in the Master module configuration as
follows:
Step Action
1 Double click (or right click and select Configuration) on the CANopen master.
For Twido Extreme, double click (or right click and select Configuration) on the
base and then select the CANopen tab in the resulting panel.
The following is displayed:
2 Edit the entries in the Symbol column: give descriptive names for the variables.
You can use up to to 32 characters:
z Letters a-z
z Numbers 0-9
z Underscore _
NOTE: For more information about editing symbols, please refer to Symbolizing
Objects, page 48.
At a Glance
This sub-section describes addressing of PDO inputs and PDO outputs of the
CANopen master.
To avoid confusion with Remote I/Os, a new designation is implemented for
CANopen objects’ syntax: %IWC for example.
Illustration
Reminder of the addressing principles:
Specific Values
The table below gives specific values to CANopen slave objects:
Example
The table below shows an example of PDO addressing:
Implicit Exchanges
The objects described below are exchanged implicitly, in other words they are
exchanged automatically on each PLC cycle.
Explicit Exchanges
Objects (words and bits) associated with the CANopen fieldbus contribute data (for
example: bus operation, slave status, etc.) and additional commands to carry out
advanced programming of the CANopen function.
These objects are exchanged explicitly between the Twido controller and the
CANopen Master module via the expansion bus:
z at the request of the program user by way of the instruction: CAN_CMD (see
"Presentation of the CAN_CMD" instruction below)
z via the debug screen or the animation table.
Example of use (for the CANopen master module installed at expansion address 1
on the Twido bus):
Before using an CAN_CMD instruction, the %SW81:X3 bit must be checked to see
whether an instruction is not in progress: check that %SW81:X3 = 1.
To ascertain whether the instruction has then correctly executed, check that the
%SW81:X4 bit equals 0.
Node address
System (slave number)
Word content / Description
words Bit Bit
[15-8] [7-0]
%SW20 2 1 When %SW2x takes the following value:
z = 0 => All modules were missing on the CANopen bus
%SW21 4 3
at CANopen master start up(1).
%SW22 6 5
z = 1 => Unexpected module was present on the network.
%SW23 8 7 It has signalled itself as "not error free" before it was
%SW24 10 9 removed from the network.
z = 2 => Node State Operational (module is in operational
%SW25 12 11
state):
%SW26 14 13 - "error free".
%SW27 16 15 z = 3 => Node State Operational (module is in operational
state):
- "not error free".
z = 4 => Node State Preoperational (module is in
preoperational state):
- expected modules only (those declared as expected in
the configuration table);
- module can be set to operational;
- "error free".
z = 5 => Node State Preoperational (module is in
preoperational state):
- expected modules only (those declared as expected in
the configuration table);
- module can be set to operational;
- "not error free".
Node address
System (slave number)
Word content / Description
words Bit Bit
[15-8] [7-0]
z = 6 => Node State Preoperational (module is in
preoperational state):
- expected modules only (those declared as expected in
the configuration table);
- module is present but its current state does not allow
to set it to operational;
- "error free".
z = 7 => Node State Preoperational (module is in
preoperational state):
- expected modules only (those declared as expected in
the configuration table);
- module is present but its current state does not allow
to set it to operational;
- "not error free".
z = 8 => Wrong module (a module was detected with
different device identity information):
- "error free".
z = 9 => Wrong module (a module was detected with
different device identity information):
- "not error free".
z = 10 => Slave configuration error (module has
answered SDO Write request of the SDO command
table with an error confirmation or has not followed the
rules of the SDO protocol):
- "error free".
z = 11 => Slave configuration error:
- "not error free".
z = 12 => Missing Module / Error Control Timeout / SDO
Timeout (a module that was configured is not available,
has disappeared during operation or does not answer
SDO access):
- "error free".
Node address
System (slave number)
Word content / Description
words Bit Bit
[15-8] [7-0]
z = 13 => Missing Module / Error Control Timeout / SDO
Timeout (a module that was configured is not available,
has disappeared during operation or does not answer
SDO access):
- "not error free".(1)
z = 14 => Unexpected module (a module was detected
that is not in the configuration table):
- "error free".
z = 15 => Unexpected module (a module was detected
that is not in the configuration table):
- "not error free".
NOTE:
1. When %SW2x takes the following value:
z =0, for a slave means that all slaves are missing,
z =13, for a slave means that this slave is missing and at least 1 slave is present
on the CANopen bus.
Symbol Description
n Expansion address of CANopen master module on the Twido bus (1 to 7).
x Number of the first internal word (memory word) passed in parameter.
l Length of the instruction in number of words (2 or 6).
NOTE: The Master CanOpen Twido doesn’t manage objects like strings but only 8,
16 and 32 bit objects (signed or unsigned).
NOTE: Bus status is updated on each PLC scan. However, the result of the
CAN_CMD bus reading instruction is available only at the end of the following PLC
scan.
Example 2:
To read the following variable: SDO_Slave:1_index:24576_sub-index:1_length:4
LD 1
[%MW6 := %MW4] (* Store the result of the last *)
(* SDO command *)
[%MW7 := %MW5] (* Store the result of the last SDO *)
(* command*)
----
LD %SW81:X3 (* If there is no CAN_CMD instruction *)
(* in progress, then continue*)
[%MW0 := 16#0003]
[%MW1 := 16#0001] (* SDO read to address node 1*)
[%MW2 := 16#6000] (* Access to index number 24576*)
[%MW3 := 16#0104] (* Access to sub-index number 1 *)
(* and length value 4 *)
[CAN_CMD1 %MW0:6] (* Start SDO command*)
Example 3:
To write the following variable: SDO_Slave:1_index:24576_sub-index:1_length:4
LD 1
[%MW0 := 16#0004]
[%MW1 := 16#0001] (* SDO write to address node 1*)
[%MW2 := 16#6000] (*Access to index number 24576*)
[%MW3 := 16#0104] (* Access to sub-index number 1 * )
(* and length value 4 *)
[%MW4 := 16#1234] (* Data 1 value*)
[%MW5 := 16#1234] (* Data 2 value*)
----
LD %SW81:X3 (* If there is no CAN_CMD instruction *)
(* in progress, then continue *)
[CAN_CMD1 %MW0:6] (* Start SDO command*)
Example 4:
To force the Twido Extreme integrated CANopen bus master to switch to Init mode:
LD 1
[%MW0 := 16#0005] (*Command type 5 to 8*)
[%MW1 := 16#0001] (*Node address*)
----
LD %SW81:X3 (*If no CAN_CMD instruction is in *)
(* progress, then continue *)
[CAN_CMD1 %MW0:2] (* To force the Twido Extreme *)
(* integrated CANopen bus master to switch to Init mode*)
Introduction
The following section provides basic information about CANJ1939 network
communications.
Applications
CANJ1939 is a high layer protocol for the CAN fieldbus developed by the SAE
(Society of Automotive Engineers) for equipment used in industries ranging from
agriculture, construction, and fire/rescue to forestry, materials handling, and on- and
off-highway equipment.
Characteristics
CANJ1939 is a high speed communications network designed to support real-time
closed loop control functions between electronic devices which may be physically
distributed throughout the vehicle.
CANJ1939 is capable of performing all of the functions of J1708/J1587 as well as
the control system support and any one application may utilize one or the other or
both of these networks.
NOTE: Jl708/Jl587 is an older, widely used, network intended to provide simple
information exchange, including diagnostic data, between electronic devices.
Communication Methods
Three core communication methods exist within CANJ1939:
z Peer-to-peer communications (see page 316): the message is directed to a
particular device, a specific destination address is included within the identifier of
the message.
z Broadcast Communications (see page 316): the message is transmitted on the
network without directing it to a specific destination. This permits any device to
use the data without requiring additional request messages.
z Proprietary Communications: not used in Twido Extreme
Additional Sources
Form more details about CANJ1939, please refer to the following SAE literature:
Introduction
This section presents information relating to the Parameter Group Number and
Suspect Parameter Number usage on a CANJ1939 network.
The PG is not dependent on the source address field: any source is allowed to send
any PG.
Examples of SPNs
z Engine coolant temperature
z Fuel temperature
z Engine oil temperature
z Turbo oil temperature
z Engine intercooler temperature
CANJ1939 Identifier
Introduction
CANJ1939 provides a complete network definition using the 29-bit identifier (CAN
Extended Frame) defined within the CAN protocol.
NOTE: CANJ1939 also enables 11-bit identifier (CAN Standard Frame) devices to
be used within the same network, defining all messages as proprietary, permitting
both device types to coexist without interference.
The following sections describe the various parts that compose the CANJ1939
frame.
Priority
The Priority field (3 bits) is used to determine message priority during the arbitration
process:
z A value of 000 has the highest priority. Higher priority messages would typically
be used for high speed control messages.
z A value of 111 has the lowest priority. Lower priority messages would be used for
data which is not time critical.
Reserved (R)
The R bit is reserved. This default will permit future use of the bit for other purposes
as defined by the SAE (Society of Automotive Engineers) committee.
Source Address
The Source Address field (8 bits) contains the unique address of the ECU
(CANJ1939 element) transmitting the message.
Other Fields
z SOF (Start Of Frame): The initial bit in a CAN frame used only to indicate the
beginning of the frame.
z SRR (Substitute Remote Request): This bit is entirely defined and controlled by
CAN and therefore not described or modified by CANJ1939.
z IDE (Identifier Extension Bit): This bit is entirely defined and controlled by CAN
and therefore not described or modified by CANJ1939.
z RTR (Remote Transmission Request): This feature of CAN is not used in
CANJ1939.
Overview
This section provides details about collision detection, address assignment and
communication methods on a CANJ1939 network.
Collision Detection
CANJ1939 uses the CAN protocol which permits any device to transmit a message
on the network when the bus is idle.
Collisions are avoided due to the arbitration process that occurs while the identifier
is transmitted (using a non-destructive arbitration scheme). Arbitration, permits high
priority messages to get through with low latency (delay) times because there is
equal access to the network by any device.
Address Assignment
For a given network, each network element address must be unique (0 to 254, 255
available for Broadcast). The PGNs are not Source Address dependent. Therefore
any CANJ1939 element can transmit any message.
Broadcast
Most messages used on the CANJ1939 network are of the Broadcast type. This
means that the data are transmitted over the network without directing it to a specific
destination. This permits any device to use those data without requiring additional
request messages. This also permits future software revisions to easily
accommodate new devices (address assignments).
Peer to Peer
When a message must be directed to a particular device, a specific destination
address can be included within the identifier of the message.
Introduction
This section describes how to implement a CANJ1939 fieldbus using the
Twido Extreme TWDLEDCK1 base controller.
Hardware Requirements
Twido Extreme PLC base Extreme base
z TWDLEDCK1
Software Requirements
Twido PLC configuration TwidoSuite V2.0 or higher
software
Step Description
1 Hardware Setup
2 CANJ1939 Configuration Methodology
3 Configuration Dialog Boxes
4 Creation of Transmit/Receive Objects
5 Broadcast Configuration
6 Peer-to-Peer Configuration
7 Expert Mode Configuration
8 CANJ1939 I/O Objects
9 Using SPN Requests
These steps are detailed in the following sections.
Hardware Setup
Overview
This section describes the general methodology for configuring the CANJ1939 bus.
Further details are provided in subsequent sections.
CANJ1939 configuration is performed in the Describe window of TwidoSuite. The
results of your configuration may be then viewed in Program →Configure the
Hardware, Module Configuration CANJ1939 tab (see Viewing CANJ1939
Transmit/Receive objects, page 333).
NOTE:
1. CANJ1939 configuration can only be performed in Offline mode.
2. No changes can be made when the Twido Extreme is connected to the PC. Only
the network name, element names and "Expert Mode" check box can be modified
in Online mode.
NOTE:
1. A CANJ1939 device is represented in TwidoSuite by a CANJ1939 element (or
elements). A device (or element) is also known as an Electronic Control Unit
(ECU) (see Electronic Control Unit (ECU), page 311).
2. Element addresses are restricted to values 0 to 254. See CANJ1939 Knowledge
Base, page 311
Overview
This section details the CANJ1939 Configuration Dialog boxes used in the Describe
window of TwidoSuite.
Step Action
1 In the Describe window, roll the mouse over the element, network or port until configuration (screwdriver)
cursor appears, double-click (or click right and choose "configure").
Result: one of the following configuration dialog box opens, see steps 2, 3 and 4.
2 Port Configuration dialog box
Step Action
3 Element Configuration dialog box
Step Action
5 The following fields can be modified (optional):
z Name: the default name is "Element 1" (for element) and "My network 1"(for network) and this field is
limited to 32 characters.
z Address: the default value is 0. Element addresses are restricted to values 0 to 255.
z Expert Mode check box: when this is selected the PGN/SPN numbers are displayed. By default this
check box is cleared and even if you leave this box selected when you close this dialog box the default
value (cleared) is reinstated when the dialog box is reopened.
z #: this takes values from 0 to 31 and provides a simple identification number for different types of
messages (see Parameter Group Number (PGN), page 311). If two or more message objects come from
the same parameter group, and thus share the same #, changing the # value for one object will
automatically apply this value to the others. The table is also re-ordered to always display the objects in
ascending # order.
z Priority: this takes values from 0 to 7(0 being the highest priority). These values are preset according to
the particular message object (SPN) (see Suspect Parameter Number (SPN), page 312). These can be
edited, however, and changing the priority for one message object results in attributing the same priority
to all message objects that share the same #.
z Periodic mode (transmit objects) check box: when this is selected the message is sent periodically with
the period (in ms) that you indicate in the Period field. If the periodic mode check box is cleared the period
field cannot be edited. Changing the periodic mode for one message object results in applying the same
mode to all message objects that share the same #.
z Hourglass mode(receive objects) check box: when this is selected the time (in ms) indicated in the
Period field provides a time out period. (If the Twido Extreme does not receive a message after this time
out period a Parameter Group error occurs.) System Words %SW33 to %SW40 are updated.
z Period: (in ms) this takes values from 10 to 60000 (default value is 100) and can only be edited if the
corresponding periodic mode (transmit objects) or Time out (receive objects) check box is selected.
z Descr: press this button to display a description of the message object (SPN).
z Processor instance: (1) indicates to the CANJ1939 element which PLC will send it messages.
Authorized values are 0 and 1.
z Function instance: (1) particular occurrence of a given function in an automobile system and given
network. If only one instance of a certain Function exists in a network, then this field must be set to ‘0’ to
define it as the first instance.
z Automobile system instance: (1) particular occurrence of a given vehicle system in a given network. If
only one instance of a certain automobile system exists in a network, then this field must be set to ‘0’ to
define it as the first instance.
Overview
CANJ1939 messages can be either transmit or receive objects. These are created
via the appropriate (element or port) configuration dialog box accessible from the
Describe window. A transmit object is an object transmitted by the Twido Extreme
and a receive object is one received by the Twido Extreme.
This section explains how to create and delete transmit/receive objects. Broadcast
messages are defined by adding objects on a port. Peer-to-peer messages are
defined by adding objects to the appropriate element(s). See Communication on a
CANJ1939 Network, page 316.
NOTE: In TwidoSuite you can configure the CANJ1939 network for messages
(broadcast or peer-to-peer) that are sent by the Twido Extreme PLC. TwidoSuite
can only be used to configure Twido Extreme controllers. Other non-Twido products
connected on the CANJ1939 network cannot be configured using TwidoSuite.
Step Action
1 In the Describe window, roll the mouse over appropriate element (for peer to peer) or port (for broadcast)
until configuration (screwdriver) cursor appears, double-click (or click right and choose "configure") to
open the configuration dialog box.
Result: the following Configuration dialog box opens (port example).
Note:This example is for a broadcast message. Peer to peer messages are created in the same way but
by configuring an element.
For example of element Configuration dialog boxes and more detailed information concerning their fields
see CANJ1939 Configuration Dialog Boxes (Element, Network, Port), page 323.
Step Action
2 Click "Add an object".
Result: the following dialog box opens:
3 Select type "Receive" or "Transmit" and choose the desired message object from the Type list. (This
Type list may be scrolled with the scroll bar or by typing the first three letters of the object name.
If your chosen object has already been created on another CANJ1939 element, port or network (with the
same type Receive/Transmit), you will receive an error message and be prevented from adding this
object.
(Selecting the Expert Mode check box reveals the corresponding PGNs/SPNs.(1))
The Type of object (Receive or Transmit) will depend on whether you are configuring an element or port
as well as the type of messaging you require (broadcast or peer-to-peer). See Message Object Summary
(see page 330) below.
In the "source address" field you can choose to deal with the desired message object from All
CANJ1939 elements or from just one CANJ1939 element by selecting its address. The "source
address" field is not available if "Transmit" is selected in the Type list.
(1)
CANJ1939 Message objects are grouped into different types (or Parameter Groups). Each message
object, therefore, is associated with a hexadecimal Parameter Group Number (PGN) and also has its
own individual hexadecimal identity number known as a Suspect Parameter Number (SPN). Thus a
message object is often referred to by its SPN and several SPNs are related to the same PGN. For
further information see CANJ1939 Configuration in Expert Mode, page 340.
Step Action
4 Click Cancel to abandon or OK to add the selected object and close the "Add an Object" Configuration
dialog box.
Result: the (element or port) Configuration dialog box displays the chosen message objects.
Example:
5 Repeat steps 2 to 4 for each message object you wish to create for this element or port.
No more than 32 indexes of the same type (transmit or receive) can be added on an element or port. If
you try to exceed this, an error message will appear and you will not be able to add a new object.
6 If necessary, resolve conflicts by deleting objects.
If the total size of your chosen message objects (SPNs) exceeds the memory limitations of TwidoSuite
(this will be depend on the SPNs chosen, as these differ in size), you will receive the error message "too
many SPNs defined on the network" and be prompted to delete some objects (2).
(2) If
you try to add a transmit (receive) object (which exceeds 8 bytes) and there is already another
transmit (receive) object which comes from the same parameter group (on an element or port), you will
receive a conflict error message and you will be prompted to "Create" (default option) a new instance of
this parameter group which includes your message object. You will also be given the choice to "Replace"
(which deletes the conflicting message object of the same parameter group) or "Cancel" (to discard
changes).
Step Action
7 (Optional) You can manually edit certain fields in the (element or port) Configuration dialog box such as
#, priority, periodic mode (for detailed explanation of these fields, see CANJ1939 Configuration Dialog
Boxes (Element, Network, Port), page 323
If necessary, manually edit the # fields to assign new indexes for the created object groups (PGNs).
Make sure that the created message objects have consecutive # indexes. For more information on the
# field, see Message Object Indexes below.
8 Click Cancel to discard changes or click OK to save changes and close the Configuration dialog box.
Step Action
1 In the Describe window, roll the mouse over appropriate element or port until
configuration (screwdriver) cursor appears, double click (or click right and
choose "configure") to open the configuration dialog box which displays
previously created transmit/receive objects
Result: the following dialog box opens:
2 Click the receive/transmit object that you want to delete and click "Delete an
object" or press delete on the keyboard.
(Selecting the Expert Mode check box reveals the corresponding PGNs/SPNs
(1).
(1) CANJ1939 Message objects are grouped into different types (or Parameter
Groups). Each message object, therefore, is associated with a hexadecimal
Parameter Group Number (PGN) and also has its own individual hexadecimal
identity number known as a Suspect Parameter Number (SPN). Thus a
message object is often referred to by its SPN and several SPNs are related to
the same PGN. For further information see CANJ1939 Configuration in Expert
Mode, page 340.
3 Repeat steps 1 and 2 for each message object you wish to delete.
Step Action
4 After deleting message objects always make sure that the resulting indexes #
are consecutive. This will ensure that all SPNs are later accessible in the
Program →Configure →Configure the Hardware (Module Configuration
pane, CANJ1939 tab) window.
For example, if you add 6 SPNs, they are automatically numbered #0 to #5. If
you then delete the SPN with index #3, the SPNs #4 and #5 will not be visible
in the configuration screen. To avoid this, manually edit the indexes #4 and #5
replacing them with indexes #3 and #4 to ensure a consecutive index list #0 to
#4.
5 Click Cancel to discard or OK to delete the selected object (s) and close the
Configuration dialog box.
Overview
This section explains how to view previously defined CANJ1939 message objects in
the Program →Configure →Configure the Hardware window (Module
Configuration pane, select CANJ1939 tab) of TwidoSuite and details the fields
found in this pane.
NOTE: No actual configuration may be done in this window.
See (CANJ1939 Configuration Methodology, page 320) for general configuration
information and see Creating or Deleting CANJ1939 Transmit/Receive Objects,
page 326 to add and delete message objects.
NOTE: To ensure that all previously created message objects appear in this pane
the message objects must be indexed consecutively in the configuration dialog
box used for Creating or Deleting CANJ1939 Transmit/Receive Objects
(see page 330) accessible from the Describe window.
Only the symbol field can be edited in this pane. If you choose to modify this field
you will be asked if you wish to apply these changes when you leave this window. If
an object with a modified symbol is later deleted, the symbol modification is not
saved.
For more information concerning the address field see CANJ1939 Input/Output
Objects, page 342.
If an SPN is smaller than 8 bits, ":Xi" is appended to the address to provide the
starting position of the SPN in the word.
Overview
This section describes broadcast configuration in a CANJ1939 network.
Broadcast Messages
In a CANJ1939 network each device (element) has at least one address. Most
messages, however, are broadcast, and, therefore not directed to a specific
destination address.
CANJ1939 Messages consist of a 29-bit identifier (see CANJ1939 Identifier,
page 314 for more details) which defines the message priority, the sender and what
data is contained. Broadcast messages differ in this identifier by a field containing a
Group Extension which indicates that the message must be broadcast to all network
elements and not to a particular address. Broadcast message objects are also
referred to as PDU2 type objects (see CANJ1939 Identifier, page 314).
Broadcast messages are created in TwidoSuite by adding message objects on the
port in the Describe window of TwidoSuite.
Step Action
1 Create and configure your CANJ1939 network in the Describe window of
TwidoSuite.
See and .
2 Add the desired Transmit object(s) to the port. This will be broadcast to all
elements on the network (see Creating or Deleting CANJ1939
Transmit/Receive Objects, page 326). This enables any device to use the data
contained in this message.
3 Open the Program →Configure →Configure the Hardware window
(Module Configuration pane, select CANJ1939 tab) window to display the
message objects that you have configured in the previous step
See Viewing CANJ1939 Transmit/Receive objects, page 333.
Step Action
1 Create and configure the CANJ1939 network in the Describe window of
TwidoSuite.
See and .
2 Add the desired Receive object(s) to the port (see ). This will be received by
the Twido Extreme if it is broadcast on the network.
Note: You can configure Twido Extreme to deal with message from All
CANJ1939 elements or from just one CANJ1939 element.
SeeCreating or Deleting CANJ1939 Transmit/Receive Objects, page 326.
3 Open the Program →Configure →Configure the Hardware window
(Module Configuration pane, select CANJ1939 tab) window to display the
message objects that you have configured in the previous step
See Viewing CANJ1939 Transmit/Receive objects, page 333.
Overview
This section describes Peer-to-Peer configuration in a CANJ1939 network.
Peer-to-Peer Messages
Peer-to-Peer messages are defined in CANJ1939 by a destination address field in
the CANJ1939 29-bit identifier. Peer-to-Peer message objects are also referred to
as PDU1 type objects (see CAN identifier section CANJ1939 Identifier, page 314 for
more details).
Peer-to-Peer messages are created in TwidoSuite by adding message objects on
the element in the Describe window of TwidoSuite.
Step Action
1 Create and configure your CANJ1939 network in the Describe window of
TwidoSuite.
See and .
2 Add the desired Transmit object(s) to the element (see Creating or Deleting
CANJ1939 Transmit/Receive Objects, page 326). This message will be sent
by the Twido Extreme. This enables this element to receive this message
when it is transmit by the Twido Extreme.
3 Open the Program →Configure →Configure the Hardware window
(Module Configuration pane, select CANJ1939 tab) window to display the
message objects that you have configured in the previous step
See Viewing CANJ1939 Transmit/Receive objects, page 333.
Step Action
1 Create and configure your CANJ1939 network in the Describe window of
TwidoSuite.
See and .
2 Add the desired Receive object(s) to the element (see Creating or Deleting
CANJ1939 Transmit/Receive Objects, page 326). This will be received by the
Twido Extreme if it is sent by this element.
3 Open the Program →Configure →Configure the Hardware window
(Module Configuration pane, select CANJ1939 tab) window to display the
message objects that you have configured in the previous step
See Viewing CANJ1939 Transmit/Receive objects, page 333.
Overview
CANJ1939 configuration involves adding appropriate transmit or receive objects on
elements in the network. See Creating or Deleting CANJ1939 Transmit/Receive
Objects, page 326. This can also be done in expert mode (by selecting the Expert
Mode check box in the Configuration dialog box). This section explains the use of
this mode.
SPN Request
A particular use of the Expert Mode is to request specific information from a
CANJ1939 element on the network. This is done by adding a particular Transmit
SPN to the CANJ1939 element and by assigning this SPN value to the %IWC in the
ladder/list program. See Request a PGN Output, page 346 for an example.
Introduction
This section describes the addressing of CANJ1939 inputs and outputs.
The syntax implemented for CANJ1939 objects is explained in the following
illustration.
Illustration
Reminder of the addressing principles:
Specific Values
The table below gives specific values to CANJ1939 objects:
Example
The table below shows an example of CANJ1939 addressing:
For example, to force the PGN output to be written for a particular PGN, set bit 2 in
the corresponding %SW.
CANJ1939 Programming
Ladder or List programs are created in a similar way to other Twido applications.
See Ladder Language, page 399 and Instruction List Language, page 423. When
using the data browser in the ladder/list program editor, select the appropriate object
type (%IWC0, %QWC0, %IWCD0, %QWCD0, %IWCF0 and %QWCF0) in the
Address menu. If the Twido Extreme is later replaced by a base that does not
support the CANJ1939 protocol, these entries must be deleted from the program
and they are no longer available in the data browser Address list.
Introduction
A PGN is sent by a CANJ1939 element anytime its value changes. To force a PGN
output, use any of the following 2 methods:
z SPN labelled RQST is used by the Twido Extreme to request a PGN from a
CANJ1939 element.
z System Word %SW33 is used to force a PGN output.
Stage Description
1 Twido Extreme sends a SPN RQST to a CANJ1939 element to request the value
of the PGN Exhaust Temperature
2 The CANJ1939 element sends the value of the PGN requested (Exhaust
Temperature)
Note: If the parameter requested is not available, the CANJ1939 element send a Non-ACKnowledgement (NACK)
to the Twido Extreme.
Foreword
Configure TwidoPort with these instructions:
NOTE: Plug ’n play feature
When TwidoPort is configured with TwidoSuite, TwidoPort’s IP configuration is
stored in the Twido controller. Therefore, maintenance personnel can exchange
TwidoPorts without additional configuration.
To use the plug ’n play functionality, use TwidoSuite and upgrade the Twido
firmware to 3.4 or higher.
2 Enter TwidoPort’s static IP Address in Note: For good device communication, the IP addresses of
dotted decimal notation. the PC running the TwidoSuite application and TwidoPort
(See notes 1 and 2.) must share the same network ID.
3 Enter the valid Subnetwork mask Note: For good device communication, the subnet mask
assigned to TwidoPort by your network configured on the PC running the TwidoSuite application
administrator. Please note that you cannot and TwidoPort’s subnet mask must match.
leave this field blank; you must enter a As default, the TwidoSuite application automatically
value. computes and displays a default subnet mask based on
(See notes 1 and 3.) the class IP that you have provided in the IP Address field
above. Default subnet mask values, according to the
category of the TwidoPort’s network IP address, follow this
rule:
Class A network -> Default subnet mask: 255.0.0.0
Class B network -> Default subnet mask: 255.255.0.0
Class C network -> Default subnet mask: 255.255.255.0
Note 1 Consult with your network or system administrator to obtain valid IP parameters for your network.
Note 2 To allow good communication over the network, each connected device must have a unique IP address.
When connected to the network, TwidoPort runs a check for duplicate IP address. If a duplicate IP
address is located over the network, the STATUS LED will emit 4 flashes periodically. You must then
enter a new duplicate-free IP address in this field.
Note 3 Unless TwidoPort has special need for subnetting, use the default subnet mask.
Note 4 If there is no gateway device on your network, simply enter TwidoPort’s IP address in the Gateway
Address field.
Select Preferences
Result:
The following Connections Management dialog box appears:
Step Action
1 Click the Add button in the Connections Management dialog box.
Result: A new connection line is added. The new line displays suggested
default connection settings. You will need to change these settings.
Note: To set a new value in a field, you have two options:
z Select the desired field, then click the Modify button.
z Double click the desired field.
2 In the Name field, enter a descriptive name for the new connection. A valid
name may contain up to 32 alphnumeric characters.
3 In the Connection Type field, click to unfold the dropdown list that includes:
Serial, Ethernet, and USB (if any).
Select Ethernet as you are setting up a new Ethernet connection between your
PC and an Ethernet-capable Twido controller.
4 In the IP / Phone field, enter a valid IP address which is the IP information of
the Twido controller you wish to connect to.
IP Address: Enter the static IP address that you have previously specified for
your Twido controller.
Step Action
5 The Punit / Address field can be filled in when IP / Phone has been selected.
For an Ethernet connection, the default Punit/Address value is Direct. This
default must be changed to 1 (or to whatever address you have previously
used for the controller).
Note: If you use an address different than 1, connection is not possible
(whatever the address you configured for Port 1 (see page 355) of the Twido
controller).
For a Serial Type connection, default value is Punit. When any of those is
selected, the next three fields (Baudrate, Parity and Stop Bits) are disabled.
If you do not know the controller address, @ allows you to select it later, once
the program has been transferred. (A window pops up before the first
connection to let you choose the controller to which you transfer, with a 1-247
range, and 1 as the default address value.)
6 Use the default settings in Timeout and Break timeout fields, unless you have
specific timeout needs. (For more details, please refer to .)
7 Click the OK button to save the new connection settings and close the
Connections management dialog box.
Result: All newly-added connections are appended in the Preferences →
Connections Management table and in the Program →Debug →Connect
→Select a connection table.
BootP Configuration
BootP Process
TwidoPort expects a response from the BootP server within two minutes of its BootP
request transmission. If it does not, TwidoPort assumes the default IP configuration
that is constructed from a MAC address of this structure:
MAC Address
The MAC Address has the structure:
MAC[0] MAC[1] MAC[2] MAC[3] MAC[4] MAC[5].
For Example, if the MAC address is 0080F4012C71, the default IP address would
be 85.16.44.113.
Example:
If the IP address of the PC is 192.168.10.30 and the default IP address (or the
configured IP address) of TwidoPort is 85.16.44.113, the complete command
would be:
IP/Ethernet Settings
IP Source
The select IP Source option dictates the location from which the IP configuration
is obtained:
z STORED—from local flash memory.
z SERVED—from BootP server.
z TWIDO—from the Twido controller.
The default IP address (DEFAULT) is derived from the MAC address. (By definition,
the default is not selectable.)
NOTE: A valid IP configuration in the Twido controller overrides the user selection.
Foreword
NOTE: Under normal circumstances, it is not necessary to configure TwidoPort’s
serial parameters because the module supports an autobaud algorithm that
eliminates the need for serial configuration.
4 Select R and press Enter. The Telnet main menu appears. (You
may have to press Enter again to
update the screen.)
Foreword
NOTE: Usually, it is not necessary to configure TwidoPort’s gateway parameters.
Security Configuration
Ethernet Statistics
Serial Statistics
Foreword
NOTE:
1. Obtain a newer version of the TwidoPort firmware before attempting to upgrade
the firmware with these instructions.
2. Stop the process before upgrading the firmware.
3. Modbus communication will not be available during the firmware upgrade
procedure.
Kernel Mode
In the absence of valid firmware, TwidoPort goes into Kernel mode. If you attempt
to use Telnet to connect to TwidoPort while it is in this mode, you will see:
FTP Connection
The following illustration shows how to connect to TwidoPort via ftp in backup mode:
Ethernet Features
Introduction
The ConneXium TwidoPort adds Ethernet connectivity to the Schneider Electric
Twido product line. It is the gateway between a single Twido Modbus/RTU (RS485)
device and the physical layer of Modbus/TCP networks in slave mode. TwidoPort
does not require a separate power supply because it gets power from the Twido
controller through its serial port. This gateway module supports slave mode only.
Ethernet Features
TwidoPort supports the following Ethernet features:
z Auto-negotiation
TwidoPort supports 10/100TX auto-negotiation. It communicates only in half-
duplex mode.
z Auto-MDI/MDI-X
TwidoPort supports auto-switching of transmit and receive wire pairs to establish
communications with the end device (auto-MDI/MDI-X). TwidoPort, therefore,
transparently interconnects infrastructure or end devices with either straight-
through or crossover cables.
About Modbus
The Modbus protocol is a master/slave protocol that allows one master to request
responses from slaves or to take action based on their requests. The master can
address individual slaves or can initiate a broadcast message to all slaves. Slaves
return a message (response) to queries that are addressed to them individually.
Responses are not returned to broadcast queries from the master.
Theory of Operations
Modbus/TCP clients can communicate with Twido through TwidoPort, a bridge
between Twido devices (Modbus/RTU over RS485 serial link) and Modbus/TCP
over Ethernet networks.
NOTE: When implementing TwidoPort on a network, the system design
requirements must account for the inherent limited bandwidth of serial connections.
Expect a peak performance of approximately 40 Modbus transactions per second.
Requesting multiple registers in a single request is more efficient than placing a
separate request for each register.
You cannot initiate read or write requests from the Twido controller through
TwidoPort.
13
Subject of this Chapter
This chapter provides details for using the optional Twido Operator Display.
Operator Display
Introduction
The Operator Display is a Twido option for displaying and controlling application
data and some controller functions such as operating state and the Real-Time Clock
(RTC). This option is available as a cartridge (TWDXCPODC) for the Compact
controllers or as an expansion module (TWDXCPODM) for the Modular controllers.
The Operator Display has two operating modes:
z Display Mode: only displays data.
z Edit mode: allows you to change data.
NOTE: The operator display is updated at a specific interval of the controller scan
cycle. This can cause confusion in interpreting the display of dedicated outputs for
%PLS or %PWM pulses. At the time these outputs are sampled, their value will
always be zero, and this value will be displayed.
Illustration
The following illustration shows a view of the Operator Display, which consists of a
display area (here in Normal mode) and four push-button input keys.
Display area
The Operator Display provides an LCD display capable of displaying two lines of
characters:
z The first line of the display has three 13-segment characters and four 7-segment
characters.
z The second line has one 13-segment character, one 3-segment character (for a
plus/minus sign), and five 7-segment characters.
NOTE: If in Normal mode, the first line indicates an object name and the second line
displays its value. If in Data mode, the first line displays %SW68 value and the
second line displays %SW69 value.
Input keys
The functions of the four input push-buttons depend on the Operator Display mode.
Introduction
The initial display or screen of the Twido optional Operator Display shows the
Controller Identification and State Information.
Example
The firmware revision is displayed in the upper-right corner of the display area, and
the controller state is displayed in the upper-left corner of the display area, as seen
in the following:
Controller States
Controller states include any of the following:
z NCF: Not Configured
The controller is in the NCF state until an application is loaded. No other state is
allowed until an application program is loaded. You can test the I/O by modifying
system bit S8 (see System Bits (%S), page 702).
z STP: Stopped
Once an application is present in the controller, the state changes to the STP or
Stopped state. In this state, the application is not running. Inputs are updated and
data values are held at their last value. Outputs are not updated in this state.
z INI: Initial
You can choose to change the controller to the INI or initial state only from the
STP state. The application is not running. The controller’s inputs are updated and
data values are set to their initial state. No outputs are updated from this state.
z RUN: Running
When in the RUN or running state the application is running. The controller’s
inputs are updated and data values are set according to the application. This is
the only state where the outputs are updated.
z HLT: Halted (User Application Error)
If the controller has entered an ERR or error state, the application is halted. Inputs
are updated and data values are held at their last value. From this state, outputs
are not updated. In this mode, the error code is displayed in the lower-right portion
of the Operator Display as an unsigned decimal value.
Step Action
1 Press the key until the Operations Display is shown (or press ESC). The current
controller state is displayed in the upper-left corner of the display area.
2 Press the MOD/ENTER key to enter edit mode.
3 Press the key to select a controller state.
4 Press the MOD/ENTER key to accept the modified value, or press the ESC key to
discard any modifications made while in edit mode.
Introduction
The optional Operator Display provides these features for monitoring and adjusting
application data:
z Select application data by address (such as %I or %Q).
z Monitor the value of a selected software object/variable.
z Change the value of the currently displayed data object (including forcing inputs
and outputs).
Notes:
1. (*) means a 32-bit double word variable. The double word option is available on
all controllers with the exception of the Twido TWDLC•A10DRF controllers.
2. Variables will not be displayed if they are not used in an application since Twido
uses dynamic memory allocation.
3. If the value of %MW is greater than +32767 or less than -32768, the operator
display will continue to blink.
4. If the value of %SW is greater than 65535, the operator display continues to blink,
except for %SW0 and %SW11. If a value is entered that is more than the limit,
the value will return to the configured value.
5. If a value is entered for %PLS.P that is more than the limit, the value written is the
saturation value.
Step Action
1 Press the key until the Data Display screen is shown.
The Input object ("I") will be displayed in the upper left corner of the display area.
The letter " I " (or the name of the object previously viewed as data) is not blinking.
2 Press the MOD/ENTER key to enter edit mode.
The Input Object "I" character (or previous object name viewed as data) begins
blinking.
3 Press the key to step sequentially through the list of objects.
4 Press the key to step sequentially through the field of an object type and press
the key to increment through the value of that field. You can use the key
and key to navigate and modify all fields of the displayed object.
Step Action
5 Repeat steps 3 and 4 until editing is complete.
6 Press the MOD/ENTER key to accept the modified values.
Note: The object’s name and address have to be validated before accepting any
modifications. That is, they must exist in the configuration of the controller prior to
using the operator display.
Press ESC to discard any changes made in edit mode.
Input/Output Format
The input/output objects (%I, %Q, %IW and %QW) have three-part addresses (e.g.:
%IX.Y.Z) and are displayed as follows:
z Object type and controller address in the upper-left
z Expansion address in the upper-center
z I/O channel in the upper-right
In the case of a simple input (%I) and output (%Q), the lower-left portion of the
display will contain a character that is either "U" for unforced or "F" for a forced bit.
The force value is displayed in the lower-right of the screen.
The output object %Q0.3.11 appears in the display area as follows:
Simple Format
A simple format is used for objects %M, %MW, %KW, %MD, %KD, %MF, %KF, %S,
%SW and %X as follows:
z Object number in the upper-right
z Signed value for the objects in the lower portion
In the following example, memory word number 67 contains the value +123.
Introduction
The operator display allows you to display the protocol settings and change the
addresses of all serial ports configured using TwidoSuite. The maximum number of
serial ports is two. In the example below, the first port is configured as Modbus
protocol with an address 123. The second serial port is configured as a remote link
with an address of 4.
Step Action
1 Press the key until the Communication Display is shown. The single letter of
the protocol setting of the first serial port ("M", "R", or "A") will be displayed in the
upper left corner of the operator display.
2 Press the MOD/ENTER key to enter the edit mode.
3 Press the key until you are in the field that you wish to modify.
4 Press the key to increment the value of that field.
5 Continue steps 3 and 4 until the address settings are complete.
6 Press the MOD/ENTER key to accept the modified values or ESC to discard any
modifications made while in edit mode.
Note: The address is part of the configuration data on the Controller. Changing its value
using the operator display means that you can no longer connect using TwidoSuite as equal.
TwidoSuite will require that you do a download to become equal again.
Introduction
You can modify the date and time using the operator display if the RTC option
cartridge (TWDXCPRTC) is installed on your Twido controller. The Month is
displayed in the upper-left side of the HMI Display. Until a valid time has been
entered, the month field will contain the value "RTC". The day of the month is
displayed in the upper-right corner of the display. The time of day is in military
format. The hours and minutes are shown in the lower-right corner of the display and
are separated by the letter "h". The example below shows that the RTC is set to
March 28, at 2:22 PM.
NOTE:
1. The TWDLCA•40DRF series of compact controllers and the Twido Extreme PLC
(TWDLEDCK1) have an integrated RTC.
2. On all other controllers, time of day clock and real-time correction are only
available if the Real-Time Clock (RTC) option cartridge (TWDXCPRTC) is
installed.
Step Action
1 Press the key until the Time/Date Display is shown. The month value ("JAN",
"FEB") will be displayed in the upper-left corner of the display area. The value "RTC"
will be displayed in the upper-left corner if no month has been initialized.
2 Press the MOD/ENTER key to enter the edit mode.
3 Press the key until you are in the field that you wish to modify.
4 Press the key increment the value of that field.
5 Continue steps 3 and 4 until the Time of Day value is complete.
6 Press the MOD/ENTER key to accept the modified values or ESC to discard any
modifications made while in edit mode.
Introduction
Each Real-Time Clock (RTC) has a RTC Correction Factor value that is used to
correct for inaccuracies in the RTC module.
You can display and modify the Real-Time Correction Factor:
z using the operator display,
z by selecting Program →Debug →Check PLC →Configure Real Time Clock
from the task tool panel if you are connected,
z using system bits and system words, see System Bits and System Words,
page 701.
Step Action
1 Press the key until the RTC Factor Display is shown. "RTC Corr" will be
displayed in the upper line of the operator display.
2 Press the MOD/ENTER key to enter edit mode.
3 Press the key until you are in the field that you wish to modify.
4 Press the key to increment the value of that field.
5 Continue Steps 3 and 4 until the RTC correction value is complete.
6 Press the MOD/ENTER key to accept the modified values or ESC to discard any
modifications made while in edit mode.
Step Action
1 Set the Real-Time Clock Value.
2 After a few weeks, determine the deviation of the Real-Time Clock on your PLC.
3 Calculate the factor necessary for a Real-Time Correction on a weekly basis.
4 Set the Real-Time Correction Factor with this value.
Result: the Real-Time Correction Factor will be added to (or subtracted from)
the Real-Time Clock value of your PLC every week.
4
5
6 Sign of the correction factor 0: subtraction
1: addition
III
Subject of this Part
This part provides instructions for using the Ladder, List, and Grafcet programming
languages to create control programs for Twido programmable controllers.
Ladder Language
14
Subject of this Chapter
This chapter describes programming using Ladder Language.
Introduction
Ladder diagrams are similar to relay logic diagrams that represent relay control
circuits. The main differences between the two are the following features of Ladder
programming that are not found in relay logic diagrams:
z All inputs are represented by contact symbols ( ).
z All outputs are represented by coil symbols ( ).
z Numerical operations are included in the graphical Ladder instruction set.
Notice that in the above illustration, all inputs associated with a switching device in
the relay logic diagram are shown as contacts in the Ladder diagram. The M1 output
coil in the relay logic diagram is represented with an output coil symbol in the Ladder
diagram. The address numbers appearing above each contact/coil symbol in the
Ladder diagram are references to the locations of the external input/output
connections to the controller.
Ladder Rungs
A program written in Ladder language is composed of rungs which are sets of
graphical instructions drawn between two vertical potential bars. The rungs are
executed sequentially by the controller.
Programming Grid
Each Ladder rung consists of a grid of seven rows by eleven columns that are
organized into two zones as shown in the following illustration.
Grid Zones
The Ladder diagram programming grid is divided into two zones:
z Test Zone
Contains the conditions that are tested in order to perform actions. Consists of
columns 1 - 10, and contains contacts, function blocks, and comparison blocks.
z Action Zone
Contains the output or operation that will be performed according to the results of
the tests of the conditions in the Test Zone. Consists of columns 8 - 11, and
contains coils and operation blocks.
Sections/Subroutines
Each section/subroutine consists of:
z A section header with with section number (automatically assigned by the
program), section/subroutine label, a user-defined section/subroutine title and
four lines of user comments. See .
z A sequence of rungs below the section/subroutine header.
Rung Headers
In addition to the rung, a rung header appears directly above the rung. Use the rung
header to document the logical purpose of the rung. The rung header can contain
the following information:
z Rung number
z Labels (%Li)
z Rung title
z Rung comments
For more details about using the rung header to document your programs, see
Program Documentation, page 421.
Introduction
Ladder diagrams consist of blocks representing program flow and functions such as
the following:
z Contacts
z Coils
z Program flow instructions
z Function blocks
z Comparison blocks
z Operation blocks
Function Blocks
Function blocks are placed in the test zone of the programming grid. The block must
appear in the first row; no ladder instructions or lines of continuity may appear above
or below the function block. Ladder test instructions lead to the function block’s input
side, and test instructions and/or action instructions lead from the block’s output
side.
Function blocks are vertically oriented and occupy two columns by four rows of the
programming grid.
Comparison Blocks
Comparison blocks are placed in the test zone of the programming grid. The block
may appear in any row or column in the test zone as long as the entire length of the
instruction resides in the test zone.
Comparison blocks are horizontally oriented and occupy two columns by one row of
the programming grid.
See the following example of a comparison block.
To edit the comparison block, click on the field just above the comparison box and
type in your expression. Both symbols and addresses may be used as operands
here. The comment field however is disabled.
Operation blocks
Operation blocks are placed in the action zone of the programming grid. The block
may appear in any row in the action zone. The instruction is right-justified; it appears
on the right and ends in the last column.
35011386 06/2011 405
Ladder Language
Operation blocks are horizontally oriented and occupy four columns by one row of
the programming grid.
The following is an example of an operation block.
To edit the operation block, click on the field just above the operation box and type
in your expression. Both symbols and addresses may be used as operands here.
The comment field (top box), however, is disabled.
If symbols have been previously defined, the expression will be displayed with both
addresses (lower box) and symbols (upper box) as shown in the following example
of an operation block. Here, the address %MW2 has been previously defined with
the symbol OPERATE_SWITCH.
Introduction
Instructions in Ladder diagrams consist of graphic elements.
Contacts
The contacts graphic elements are programmed in the test zone and take up one
cell (one row high by one column wide).
Link Elements
The graphic link elements are used to insert/delete ladder loops:.
Coils
The coil graphic elements are programmed in the action zone and take up one cell
(one row high and one column wide).
Function blocks
The graphic elements of function blocks are programmed in the test zone and
require four rows by two columns of cells (except for very fast counters which require
five rows by two columns).
Introduction
The OPEN and SHORT instructions provide a convenient method for debugging
and troubleshooting Ladder programs. These special instructions alter the logic of a
rung by either shorting or opening the continuity of a rung as explained in the
following table.
In List programming, the LD, OR and AND instructions are used to create the OPEN
and SHORT instructions using immediate values of 0 and 1 respectively.
Examples
The following are examples of using the OPEN and SHORT instructions.
When no RESET input is required, as you cannot delete the link segment to the
function block R-input, use the OPEN element to permanently break the input
segment.
Programming Advice
Programming of Outputs
Output bits, like internal bits, should only be modified once in the program. In the
case of output bits, only the last value scanned is taken into account when the
outputs are updated.
In order to perform the same function, the following equations must be programmed:
If several contacts are parellelized, they must be nested within each other or
completely separate:
Ladder/List Reversibility
Introduction
Program reversibility is a feature of the TwidoSuite programming software that
provides conversion of application program sections from Ladder to List and from
List back to Ladder.
You can set the default display of programs: either List or Ladder format in user
preferences. You can toggle program sections between List and Ladder views.
NOTE: When switching between ladder and list views, only the rungs in the selected
section are reversed. This enables you to display a program with some sections in
ladder view and other sections in list view in the same window.
Understanding Reversibility
A key to understanding the program reversibility feature is examining the
relationship of a Ladder rung and the associated instruction List sequence:
z Ladder rung: A collection of Ladder instructions that constitute a logical
expression.
z List sequence: A collection of List programming instructions that correspond to
the Ladder instructions and represents the same logical expression.
The following illustration displays a common Ladder rung and its equivalent program
logic expressed as a sequence of List instructions.
Ensuring Reversibility
Programs created in Ladder can always be reversed to List. However, some List
logic may not reverse to Ladder. To ensure reversibility from List to Ladder, it is
important to follow the set of List programming guidelines in Guidelines for
Ladder/List Reversibility, page 419.
Unconditional Rungs
Programming unconditional rungs also requires following List programming
guidelines to ensure List-to-Ladder reversibility. Unconditional rungs do not have
tests or conditions. The outputs or action instructions are always executed.
The following diagram provides examples of unconditional rungs and the equivalent
List sequence.
Notice that each of the above unconditional List sequences begin with a load
instruction followed by a one, except for the JMP instruction. This combination sets
the Boolean accumulator value to one, and therefore sets the coil (store instruction)
to one and sets%MW5 to zero on every scan of the program. The exception is the
unconditional jump List instruction (JMP %L6) which is executed regardless of the
value of the accumulator and does not need the accumulator set to one.
Program Documentation
15
Subject of this Chapter
This chapter describes programming using Instruction List Language.
Introduction
A program written in List language consists of a series of instructions executed
sequentially by the controller. Each List instruction is represented by a single
program line and consists of three components:
z Line number
z Instruction code
z Operand(s)
Line Number
Line numbers are generated automatically when you enter an instruction. Blank
lines and Comment lines do not have line numbers.
Instruction Code
The instruction code is a symbol for an operator that identifies the operation to be
performed using the operand(s). Typical operators specify Boolean and numerical
operations.
For example, in the sample program above, LD is the abbreviation for the instruction
code for a LOAD instruction. The LOAD instruction places (loads) the value of the
operand %I0.1 into an internal register called the accumulator.
Operand
An operand is a number, address, or symbol representing a value that a program
can manipulate in an instruction. For example, in the sample program above, the
operand %I0.1 is an address assigned the value of an input to the controller. An
instruction can have from zero to three operands depending on the type of
instruction code.
Operands can represent the following:
z Controller inputs and outputs such as sensors, push buttons, and relays.
z Predefined system functions such as timers and counters.
z Arithmetic, logical, comparison, and numerical operations.
z Controller internal variables such as bits and words.
Introduction
List instructions have only one explicit operand, the other operand is implied. The
implied operand is the value in the Boolean accumulator. For example, in the
instruction LD %I0.1, %I0.1 is the explicit operand. An implicit operand is stored in
the accumulator and will be written over by value of %I0.1.
Operation
A List instruction performs a specified operation on the contents of the accumulator
and the explicit operand, and replaces the contents of the accumulator with the
result. For example, the operation AND %I1.2 performs a logical AND between the
contents of the accumulator and the Input 1.2 and will replace the contents of the
accumulator with this result.
All Boolean instructions, except for Load, Store, and Not, operate on two operands.
The value of the two operands can be either True or False, and program execution
of the instructions produces a single value: either True or False. Load instructions
place the value of the operand in the accumulator, while Store instructions transfer
the value in the accumulator to the operand. The Not instruction has no explicit
operands and simply inverts the state of the accumulator.
Introduction
List language consists of the following types of instructions:
z Test Instructions
z Action instructions
z Function block instructions
This section identifies and describes the Twido instructions for List programming.
Test Instructions
The following table describes test instructions in List language.
AND The Boolean result is equal to the AND logic between the
Boolean result of the previous instruction and the status
of the operand.
ANDN The Boolean result is equal to the AND logic between the
Boolean result of the previous instruction and the reverse
status of the operand.
ANDR The Boolean result is equal to the AND logic between the
Boolean result of the previous instruction and the
detection of the operand’s rising edge (1 = rising edge).
ANDF The Boolean result is equal to the AND logic between the
Boolean result of the previous instruction and the
detection of the operand’s falling edge (1 = falling edge).
N - Negation (NOT)
Action instructions
The following table describes action instructions in List language.
Using Parentheses
Introduction
In AND and OR logical instructions, parentheses are use to specify divergences in
Ladder Editors. Parentheses are associated with instructions, as follows:
z Opening the parentheses is associated with the AND or OR instruction.
z Closing the parentheses is an instruction which is required for each open
parentheses.
Modifiers
The following table lists modifiers that can be assigned to parentheses.
Nesting Parenthesis
It is possible to nest up to eight levels of parentheses.
Observe the following rules when nesting parentheses:
z Each open parentheses must have a corresponding closed parentheses.
z Labels (%Li:), subroutines (SRi:), jump instructions (JMP), and function block
instructions must not be placed in expressions between parentheses.
z Store instructions ST, STN, S, and R must not be programmed between
parentheses.
z Stack instructions MPS, MRD, and MPP cannot be used between parentheses.
Introduction
The Stack instructions process routing to coils.The MPS, MRD, and MPP
instructions use a temporary storage area called the stack which can store up to
eight Boolean expressions.
NOTE: These instructions can not be used within an expression between
parentheses.
Grafcet
16
Subject of this Chapter
This chapter describes programming using Grafcet Language.
Introduction
Grafcet instructions in TwidoSuite offer a simple method of translating a control
sequence (Grafcet chart).
The maximum number of Grafcet steps depend on the type of Twido controller. The
number of steps active at any one time is limited only by the total number of steps.
For the TWDLCAA10DRF and the TWDLCAA16DRF, steps 1 through 62 are
available. Steps 0 and 63 are reserved for pre- and post-processing. For all other
controllers, steps 1 through 95 are available.
Grafcet Instructions
The following table lists all instructions and objects required to program a Grafcet
chart:
Grafcet Examples
Linear sequence:
Alternative sequence:
Simultaneous sequences:
NOTE: For a Grafcet Chart to be operational, at least one active step must be
declared using the =*=i instruction (initial step) or the chart should be pre-positioned
during preprocessing using system bit %S23 and the instruction S %Xi.
Introduction
A TwidoSuite Grafcet program has three parts:
z Preprocessing
z Sequential processing
z Post-Processing
Preprocessing
Preprocessing consists of the following:
z Power returns
z Error management
z Changes of operating mode
z Pre-positioning Grafcet steps
z Input logic
The rising edge of input %I0.6 sets bit %S21 to 1. This disables the active steps and
enables the initial steps.
Preprocessing begins with the first line of the program and ends with the first
occurrence of a "= * =" or "- * -" instruction.
Three system bits are dedicated to Grafcet control: %S21, %S22 and %S23. Each
of these system bits are set to 1 (if needed) by the application, normally in
preprocessing. The associated function is performed by the system at the end of
preprocessing and the system bit is then reset to 0 by the system.
Sequential Processing
Sequential processing takes place in the chart (instructions representing the chart):
z Steps
z Actions associated with steps
z Transitions
z Transition conditions
Example:
Sequential processing ends with the execution of the "= * = POST" instruction or with
the end of the program.
Post-Processing
Post-processing consists of the following:
z Commands from the sequential processing for controlling the outputs
z Interlocks specific to the outputs
Example:
Introduction
A TwidoSuite Grafcet program offers two ways to program the actions associated
with steps:
z In the post-processing section
z Within List instructions or Ladder rungs of the steps themselves
Example:
Basic Instructions
17
Subject of this Chapter
This chapter provides details about instructions and function blocks that are used to
create basic control programs for Twido controllers.
Boolean Instructions
Introduction
Boolean instructions can be compared to Ladder language elements. These
instructions are summarized in the following table.
The Boolean result of the test elements is applied to the action elements as shown
by the following instructions.
Edge Detection
The following table summarizes the instructions and timing for detecting edges:
NOTE: It is now possible to apply edge instructions to the %Mi internal bits.
Introduction
Each Boolean instruction in this section is described using the following information:
z Brief description
z Example of the instruction and the corresponding ladder diagram
z List of permitted operands
z Timing diagram
The following explanations provide more detail on how Boolean instructions are
described in this section.
Examples
The following illustration shows how examples are given for each instruction.
Permitted Operands
The following table defines the types of permitted operands used for Boolean
instructions.
Operand Description
0/1 Immediate value of 0 or 1
%I Controller input %Ii.j
%Q Controller output %Qi.j
%M Internal bit %Mi
%S System bit %Si
%X Step bit %Xi
%BLK.x Function block bit (for example, %TMi.Q)
%•:Xk Word bit (for example, %MWi:Xk)
[ Comparison expression (for example, [%MWi<1000])
Timing Diagrams
The following illustration shows how timing diagrams are displayed for each
instruction.
Introduction
Load instructions LD, LDN, LDR, and LDF correspond respectively to the opened,
closed, rising edge, and falling edge contacts (LDR and LDF are used only with
controller inputs and internal words, and for AS-Interface and PDO CANopen slave
inputs).
Examples
The following diagrams are examples of Load instructions.
Permitted Operands
The following table lists the types of load instructions with Ladder equivalents and
permitted operands.
Timing diagram
The following diagram displays the timing for Load instructions.
Introduction
The assignment instructions ST, STN, S, and R correspond respectively to the
direct, inverse, set, and reset coils.
Examples
The following diagrams are examples of assignment instructions.
Permitted Operands
The following table lists the types of assignment instructions with ladder equivalents
and permitted operands.
STN %Q,%QA%M,%S,%BLK.x,%•:Xk
S %Q,%QA,%M,%S,%X,%BLK.x,%•:Xk
R %Q,%QA,%M,%S,%X,%BLK.x,%•:Xk
Timing diagram
The following diagram displays the timing for assignment instructions.
Introduction
The AND instructions perform a logical AND operation between the operand (or its
inverse, or its rising or falling edge) and the Boolean result of the preceding
instruction.
Examples
The following diagrams are examples of logic AND instructions.
Permitted Operands
The following table lists the types of AND instructions with ladder equivalents and
permitted operands.
Timing diagram
The following diagram displays the timing for the AND instructions.
Introduction
The OR instructions perform a logical OR operation between the operand (or its
inverse, or its rising or falling edge) and the Boolean result of the preceding
instruction.
Examples
The following diagrams are examples of logic OR instructions.
Permitted Operands
The following table lists the types of OR instructions with Ladder equivalents and
permitted operands.
Timing diagram
The following diagram displays the timing for the OR instructions.
Introduction
The XOR instruction performs an exclusive OR operation between the operand and
the Boolean result of the preceding instruction.
The XORN instruction performs an exclusive OR operation between the inverse of
the operand and the Boolean result of the preceding instruction.
The XORR instruction performs an exclusive OR operation between the rising edge
of the operand and the Boolean result of the preceding instruction.
The XORF instruction performs an exclusive OR operation between the falling edge
of the operand and the Boolean result of the preceding instruction.
Examples
The following example shows the use of XOR instructions.
Permitted Operands
The following table lists the types of XOR instructions and permitted operands.
Timing Diagram
The following diagram displays the timing for the XOR instructions.
Special Cases
The following are special rules for using XOR instructions in Ladder programs:
z Do not insert XOR contacts in the first position of a rung.
z Do not insert XOR contacts in parallel with other ladder elements (see the
following example.)
As shown in the following example, inserting an element in parallel with the XOR
contact will generate a validation error.
Introduction
The NOT (N) instruction negates the Boolean result of the preceding instruction.
Example
The following is an example of using the NOT instruction.
Permitted Operands
Not applicable.
Timing Diagram
The following diagram displays the timing for the NOT instruction.
Introduction
Function blocks are the sources for bit objects and specific words that are used by
programs. Basic function blocks provide simple functions such as timers or up/down
counting.
Bit Objects
Bit objects correspond to the block outputs. These bits can be accessed by Boolean
test instructions using either of the following methods:
z Directly (for example, LD E) if they are wired to the block in reversible
programming (see Standard function blocks programming principles, page 470).
z By specifying the block type (for example, LD %Ci.E).
Inputs can be accessed in the form of instructions.
Word Objects
Word objects correspond to specified parameters and values as follows:
z Block configuration parameters: Some parameters are accessible by the
program (for example, pre-selection parameters) and some are inaccessible by
the program (for example, time base).
z Current values: For example, %Ci.V, the current count value.
Introduction
Use one of the following methods to program standard function blocks:
z Function block instructions (for example, BLK %TM2): This reversible method of
programming ladder language enables operations to be performed on the block
in a single place in the program.
z Specific instructions (for example, CU %Ci): This non-reversible method enables
operations to be performed on the block’s inputs in several places in the program
(for example, line 100 CU %C1, line 174 CD %C1, line 209 LD %C1.D).
Reversible Programming
Use instructions BLK, OUT_BLK, and END_BLK for reversible programming:
z BLK: Indicates the beginning of the block.
z OUT_BLK: Is used to directly wire the block outputs.
z END_BLK: Indicates the end of the block.
NOTE: Only test and input instructions on the relevant block can be placed between
the BLK and OUT_BLK instructions (or between BLK and END_BLK when
OUT_BLK is not programmed).
Introduction
There are three types of Timer function blocks:
z TON (Timer On-Delay): this type of timer is used to control on-delay actions.
z TOF (Timer Off-Delay): this type of timer is used to control off-delay actions.
z TP (Timer - Pulse): this type of timer is used to create a pulse of a precise
duration.
The delays or pulse periods are programmable and may be modified using the
TwidoSuite.
Illustration
The following is an illustration of the Timer function block.
Parameters
The Timer function block has the following parameters:
NOTE: The larger the preset value, the greater the timer accuracy.
Introduction
Use the TOF (Timer Off-Delay) type of timer to control off-delay actions. This delay
is programmable using TwidoSuite.
Timing Diagram
The following timing diagram illustrates the operation of the TOF type timer.
Operation
The following table describes the operation of the TOF type timer.
Phase Description
1 The current value %TMi.V is set to 0 on a rising edge at input IN, even if the timer
is running.
2 The %TMi.Q output bit is set to 1 when a rising edge is detected at input N.
3 The timer starts on the falling edge of input IN.
4 The current value %TMi.V increases to %TMi.P in increments of one unit for
each pulse of the time base TB.
5 The %TMi.Q output bit is reset to 0 when the current value reaches %TMi.P.
Introduction
The TON (Timer On-Delay) type of timer is used to control on-delay actions. This
delay is programmable using the TwidoSuite.
Timing Diagram
The following timing diagram illustrates the operation of the TON type timer.
Operation
The following table describes the operation of the TON type timer.
Phase Description
1 The timer starts on the rising edge of the IN input.
2 The current value %TMi.V increases from 0 to %TMi.P in increments of one unit
for each pulse of the time base TB.
3 The %TMi.Q output bit is set to 1 when the current value has reached %TMi.P.
4 The %TMi.Q output bit remains at 1 while the IN input is at 1.
5 When a falling edge is detected at the IN input, the timer is stopped, even if the
timer has not reached %TMi.P, and %TMi.V is set to 0.
TP Type of Timer
Introduction
The TP (Timer - Pulse) type of timer is used to create pulses of a precise duration.
This delay is programmable using the TwidoSuite.
Timing Diagram
The following timing diagram illustrates the operation of the TP type timer.
Operation
The following table describes the operation of the TP type timer.
Phase Description
1 The timer starts on the rising edge of the IN input. The current value %TMi.V is
set to 0 if the timer has not already started.
2 The %TMi.Q output bit is set to 1 when the timer starts.
3 The current value %TMi.V of the timer increases from 0 to %TMi.P in increments
of one unit per pulse of the time base TB.
4 The %TMi.Q output bit is set to 0 when the current value has reached %TMi.P.
5 The current value %TMi.V is set to 0 when %TMi.V equals %TMi.P and input IN
returns to 0.
6 This timer cannot be reset. Once %TMi.V equals %TMi.P, and input IN is 0, then
%TMi.V is set to 0.
Introduction
Timer function blocks (%TMi) are programmed in the same way regardless of how
they are to be used. The timer function (TON, TOF, or TP) is selected during
configuration.
Examples
The following illustration is a timer function block with examples of reversible and
non-reversible programming.
Configuration
The following parameters must be entered during configuration:
z Timer type: TON, TOF, or TP
z Timebase: 1 min, 1 s, 100 ms, 10 ms or 1 ms
z Preset value (%TMi.P): 0 to 9999
z Adjust: Checked or Not Checked
Special Cases
The following table contains a list of special cases for programming the Timer
function block.
Programming Example
The following is an example of programming a timer function block.
Introduction
The Counter function block (%Ci) provides up and down counting of events. These
two operations can be done simultaneously.
Illustration
The following is an illustration of the up/down Counter function block.
Parameters
The Counter function block has the following parameters:
Operation
The following table describes the main stages of up/down counter operation.
Special Cases
The following table shows a list of special operating/configuration cases for
counters.
Introduction
The following example is a counter that provides a count of up to 5000 items. Each
pulse on input %I1.2 (when internal bit %M0 is set to 1) increments the counter %C8
up to its final preset value (bit %C8.D=1). The counter is reset by input %I1.1.
Programming Example
The following illustration is a counter function block with examples of reversible and
non-reversible programming.
Configuration
The following parameters must be entered during configuration:
z Preset value (%Ci.P): set to 5000 in this example
z Adjust: Yes
In this example, if we take %C1.P 4, the current value of the %C1.V counter will be
incremented from 0 to 3, then decremented from 3 to 0. Whereas %I0.0=1 %C1.V
oscillates between 0 and 3.
Introduction
The Shift Bit Register function block (%SBRi) provides a left or right shift of binary
data bits (0 or 1).
Illustration
The following is an example of a Shift Register function block.
Parameters
The Shift Bit Register function block has the following parameters.
Operation
The following illustration shows a bit pattern before and after a shift operation.
This is also true of a request to shift a bit to the right (Bit 15 to Bit 0) using the CD
instruction. Bit 0 is lost.
If a 16-bit register is not adequate, it is possible to use the program to cascade
several registers.
Programming
In the following example, a bit is shifted to the left every second while Bit 0 assumes
the opposite state to Bit 15.
Special Cases
The following table contains a list of special cases for programming the Shift Bit
Register function block.
Introduction
A Step Counter function block (%SCi) provides a series of steps to which actions
can be assigned. Moving from one step to another depends on external or internal
events. Each time a step is active, the associated bit (step counter bit %SCi.j) is set
to 1. The step counter can control output bits (%Qi.j), internal bits (%Mi) or AS
interface slave output bits (%QAx.y.z). Only one step of a step counter can be active
at a time.
Illustration
The following is an example of a Step Counter function block.
Parameters
The step function block has the following parameters:
Timing Diagram
The following timing diagram illustrates the operation of the step function block.
Programming
The following is an example of a Step Counter function block.
z Step Counter 0 is incremented by input %I0.2.
z Step Counter 0 is reset to 0 by input %I0.3 or when it arrives at step 3.
z Step 0 controls output %Q0.1, step 1 controls output %Q0.2, and step 2 controls
output %Q0.3.
The following illustration shows both reversible and non-reversible programming for
this example.
Special case
The following table contains a list of special cases for operating the Step Counter
function block.
At a Glance
Numerical instructions generally apply to 16-bit words (see Word Objects, page 27)
and to 32-bit double words (see page 30). They are written between square
brackets. If the result of the preceding logical operation was true (Boolean
accumulator = 1), the numerical instruction is executed. If the result of the preceding
logical operation was false (Boolean accumulator = 0), the numerical instruction is
not executed and the operand remains unchanged.
Assignment Instructions
Introduction
Assignment instructions are used to load Operand Op2 into Operand Op1.
Assignment
Syntax for Assignment instructions.
Examples
Examples of bit string assignments.
Usage rules:
z For bit string -> word assignment: The bits in the string are transferred to the word
starting on the right (first bit in the string to bit 0 in the word), and the word bits
which are not involved in the transfer (length ≤16) are set to 0.
z For word -> bit string assignment: The word bits are transferred from the right
(word bit 0 to the first bit in the string).
NOTE: The abbreviation %BLK.x (for example, %C0.P) is used to describe any
function block word.
Assignment of Words
Assignment operations can be performed on the following words and double words:
z Word (indexed) -> word (2, for example) (indexed or not)
z Double word (indexed) -> double word (indexed or not)
z Immediate whole value -> word (Example 3) or double word (indexed or not)
z Bit string -> word or double word
z Floating point (indexed or not)-> floating point (indexed or not)
z Word or double word -> bit string
z Immediate floating point value -> floating point (indexed or not)
Examples
Examples of word assignments.
Syntax
Syntax for word assignments.
Operator Syntax
:= [Op1: = Op2]
Operand 1 (Op1) takes the value of Operand 2 (Op2)
NOTE: The abbreviation %BLK.x (for example, R3.I) is used to describe any
function block word. For bit strings %Mi:L, %Si:L, and %Xi:L, the base address of
the first of the bit string must be a multiple of 8 (0, 8, 16, ..., 96, ...).
Examples
Examples of word table assignments:
Syntax
Syntax for word, double word and floating point table assignments
Operator Syntax
:= [Op1: = Op2]
Operand 1 (Op1) takes the value of Operand 2 (Op2)
NOTE: The abbreviation %BLK.x (for example, R3.I) is used to describe any
function block word.
Comparison Instructions
Introduction
Comparison instructions are used to compare two operands.
The following table lists the types of Comparison instructions.
Instruction Function
> Test if operand 1 is greater than operand 2
>= Test if operand 1 is greater than or equal to operand 2
< Test if operand 1 is less than operand 2
<= Test if operand 1 is less than or equal to operand 2
= Test if operand 1 is equal than operand 2
<> Test if operand 1 is different from operand 2
Structure
The comparison is executed inside square brackets following instructions LD, AND,
and OR. The result is 1 when the comparison requested is true.
Examples of Comparison instructions.
Syntax
Syntax for Comparison instructions:
Operator Syntax
>, >=, <, <=, =, <> LD [Op1 Operator Op2]
AND [Op1 Operator Op2]
OR [Op1 Operator Op2]
Operands:
Introduction
Arithmetic instructions are used to perform arithmetic operations between two
integer operands or on one integer operand.
The following table lists the types of Arithmetic instructions.
Instruction Function
+ Add two operands
- Subtract two operands
* Multiply two operands
/ Divide two operands
REM Remainder of division of the two operands
SQRT Square root of an operand
INC Increment an operand
DEC Decrement an operand
ABS Absolute value of an operand
Structure
Arithmetic operations are performed as follows:
Syntax
The syntax depends on the operators used as shown in the table below.
Operator Syntax
+,-,*,/,REM [Op1: = Op 2 Operator Op3]
INC, DEC [Operator Op1]
SQRT (1) [Op1: = SQRT(Op2)]
ABS (1) [Op1: = ABS(Op2)]
Operands:
Division / remainder
z Division by 0
If the divider is 0, the division is impossible and system bit %S18 is set to 1. The
result is then incorrect.
z Overflow during operation
If the division quotient exceeds the capacity of the result word, bit %S18 is set to
1.
Square root extraction
z Overflow during operation
Square root extraction is only performed on positive values. Thus, the result is
always positive. If the square root operand is negative, system bit %S18 is set to
1 and the result is incorrect.
NOTE: The user program is responsible for managing system bits %S17 and %S18.
These are set to 1 by the controller and must be reset by the program so that they
can be reused (see previous page for example).
Examples
Example 1: overflow during addition.
If %MW1 =23241 and %MW2=21853, the real result (45094) cannot be expressed
in one 16-bit word, bit %S18 is set to 1 and the result obtained (-20442) is incorrect.
In this example when the result is greater than 32767, its value is fixed at 32767.
Logic Instructions
Introduction
The Logic instructions are used to perform a logical operation between two word
operands or on one word operand.
The following table lists the types of Logic instructions.
Instruction Function
AND AND (bit-wise) between two operands
OR Logic OR (bit-wise) between two operands
XOR Exclusive OR (bit-wise) between two operands
NOT Logic complement (bit-wise) of an operand
Structure
Logic operations are performed as follows:
Syntax
The syntax depends on the operators used:
Example
The following is an example of a logical AND instruction:
[%MW15:=%MW32 AND %MW12]
Shift Instructions
Introduction
Shift instructions move bits of an operand a certain number of positions to the right
or to the left.
The following table lists the types of Shift instructions.
Instruction Function
Logic shift
SHL(op2,i) Logic shift of i positions to
the left.
Rotate shift
ROL(op2,i) Rotate shift of i positions
to the left.
NOTE: System bit %S17 (see page 702) is used to indicate the last ejected bit.
Structure
Shift operations are performed as follows:
Syntax
The syntax depends on the operators used as shown in the table below.
Operator Syntax
SHL, SHR [Op1: = Operator (Op2,i)]
ROL, ROR
Operands:
Conversion Instructions
Introduction
Conversion instructions perform conversion between different representations of
numbers.
The following table lists the types of Conversion instructions.
Instruction Function
BTI BCD --> Binary conversion
ITB Binary --> BCD conversion
Decimal 0 1 2 3 4 5 6 7 8 9
BCD 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001
Examples:
z Word %MW5 expresses the BCD value "2450" which corresponds to the binary
value: 0010 0100 0101 0000
z Word %MW12 expresses the decimal value "2450" which corresponds to the
binary value: 0000 1001 1001 0010
Word %MW5 is converted to word %MW12 by using instruction BTI.
Word %MW12 is converted to word %MW5 by using instruction ITB.
Structure
Conversion operations are performed as follows:
Syntax
The syntax depends on the operators used as shown in the table below.
Operator Syntax
BTI, ITB [Op1: = Operator (Op2)]
Operands:
Application Example:
The BTI instruction is used to process a setpoint value at controller inputs via BCD
encoded thumb wheels.
The ITB instruction is used to display numerical values (for example, the result of a
calculation, the current value of a function block) on BCD coded displays.
Introduction
The following table describes instructions used to perform conversions between
single and double words:
Instruction Function
LW LSB of double word extracted to a word.
HW MSB of double word extracted to a word.
CONCATW Concatenates two words into a double word.
DWORD Converts a 16 bit word into a 32 bit double word.
Structure
Conversion operations are performed as follows:
Syntax
The syntax depends on the operators used as shown in the following table: l
END Instructions
Introduction
The End instructions define the end of the execution of a program scan.
By default (normal mode) when the end of program is activated, the outputs are
updated and the next scan is started.
If scanning is periodic, when the end of period is reached the outputs are updated
and the next scan is started.
Examples
Example of an unconditional END instruction.
NOP Instruction
NOP
The NOP instruction does not perform any operation. Use it to "reserve" lines in a
program so that you can insert instructions later without modifying the line numbers.
Jump Instructions
Introduction
Jump instructions cause the execution of a program to be interrupted immediately
and to be continued from the line after the program line containing label %Li (i =0 to
15 for module without I/O expansion TWDLCxx10DRF/TWDLCxx16DRF and 0 to 63
for the others).
Examples
Examples of jump instructions.
Guidelines
z Jump instructions are not permitted between parentheses, and must not be
placed between the instructions AND(, OR(and a close parenthesis instruction
")".
z The label can only be placed before a LD, LDN, LDR, LDF or BLK instruction.
z The label number of label %Li must be defined only once in a program.
z The program jump is performed to a line of programming which is downstream or
upstream. When the jump is upstream, attention must be paid to the program
scan time. Extended scan time can cause triggering of the watchdog.
Subroutine Instructions
Introduction
The Subroutine instructions cause a program to perform a subroutine and then
return to the main program.
Example
Examples of subroutine instructions.
Guidelines
z A subroutine should not call up another subroutine.
z Subroutine instructions are not permitted between parentheses, and must not be
placed between the instructions AND(, OR( and a close parenthesis instruction
")".
z The label can only be placed before a LD or BLK instruction marking the start of
a Boolean equation (or rung).
z Calling the subroutine should not be followed by an assignment instruction. This
is because the subroutine may change the content of the boolean accumulator.
Therefore upon return, it could have a different value than before the call. See the
following example.
Example of programming a subroutine.
Advanced Instructions
18
Subject of this Chapter
This chapter provides details about instructions and function blocks that are used to
create advanced control programs for Twido programmable controllers.
Introduction
Advanced function blocks use similar types of dedicated words and bits as the
standard function blocks. Advanced function blocks include:
z LIFO/FIFO registers (%R)
z Drum controllers (%DR)
z Fast counters (%FC)
z Very fast counters (%VFC)
z Pulse width modulation output (%PWM)
z Pulse generator output (%PLS)
z Shift Bit Register (%SBR)
z Step counter (%SC)
z Message control block (%MSG)
At a Glance
All Twido applications are stored in the form of List programs, even if written in the
Ladder Editor, and therefore, Twido controllers can be called List "machines." The
term "reversibility" refers to the ability of TwidoSuite to represent a List application
as Ladder and then back again. By default, all Ladder programs are reversible.
As with basic function blocks, advanced function blocks must also take into
consideration reversibility rules. The structure of reversible function blocks in List
language requires the use of the following instructions:
z BLK: Marks the block start and the input portion of the function block
z OUT_BLK: Marks the beginning of the output portion of the function block
z END_BLK: Marks the end of the function block
NOTE: The use of these reversible function block instructions is not mandatory for
a properly functioning List program. For some instructions it is possible to program
in List language without being reversible.
Inputs Use
%I0.0.0 %VFC0: Up/Down management or Phase B
%I0.0.1 %VFC0: Pulse input or Phase A
%I0.0.2 %FC0: Pulse input or %VFC0 pre-set input
%I0.0.3 %FC1: Pulse input or %VFC0 capture input
%I0.0.4 %FC2: Pulse input or %VFC1 capture input
%I0.0.5 %VFC1 pre-set input
%I0.0.6 %VFC1: Up/Down management or Phase B
%I0.0.7 %VFC1: Pulse input or Phase A
Outputs Use
%Q0.0.0 %PLS0 or PWM0 output
%Q0.0.1 %PLS1 or PWM1 output
%Q0.0.2 Reflex outputs for %VFC0
%Q0.0.3
%Q0.0.4 Reflex outputs for %VFC1
%Q0.0.5
Introduction
A register is a memory block which can store up to 16 words of 16 bits each in two
different ways:
z Queue (First In, First Out) known as FIFO.
z Stack (Last In, First Out) know as LIFO.
Illustration
The following is an illustration of the register function block.
Parameters
The Counter function block has the following parameters:
LIFO Operation
Introduction
In LIFO operation (Last In, First Out), the last data item entered is the first to be
retrieved.
Operation
The following table describes LIFO operation.
FIFO Operation
Introduction
In FIFO operation (First In, First Out), the first data item entered is the first to be
retrieved.
Operation
The following table describes FIFO operation.
Introduction
The following programming example shows the content of a memory word
(%MW34) being loaded into a register (%R2.I) on reception of a storage request
(%I0.2), if register %R2 is not full (%R2.F = 0). The storage request in the register
is made by %M1. The retrieval request is made by input %I0.3, and %R2.O is loaded
into %MW20, if the register is not empty (%R2.E = 0).
Programming Example
The following illustration is a register function block with examples of reversible and
non-reversible programming.
Configuration
The only parameter that must be entered during configuration is the type of register:
z FIFO (default), or
z LIFO
Special Cases
The following table contains a list of special cases for programming the Shift Bit
Register function block:
Introduction
The Pulse Width Modulation (%PWM) function block generates a square wave
signal on dedicated output channels %Q0.0.0 or %Q0.0.1, with variable width and,
consequently, duty cycle. Controllers with relay outputs for these two channels do
not support this function due to a frequency limitation.
There are two %PWM blocks available. %PWM0 uses dedicated output %Q0.0.0
and %PMW1 uses dedicated output %Q0.0.1. The %PLS function blocks contend
to use these same dedicated outputs so you must choose between the two
functions.
Illustration
PWM block and timing diagram:
Parameters
The following table lists parameters for the PWM function block.
Range of Periods
The preset value and the time base can be modified during configuration. They are
used to fix the signal period T=%PWMi.P * TB. The lower the ratios to be obtained,
the greater the selected %PWMi.P must be. The range of periods available:
z 0.142 ms to 36.5 ms in steps of 0.142 ms (27.4Hz to 7kHz)
z 0.57 ms to 146 ms in steps of 0.57 ms (6./84 Hz to 1.75 kHz)
z 10 ms to 5.45 mins in steps of 10 ms
z 1 sec to 9.1 hours in steps of 1 sec
For fast time-base (0.147 ms & 0.142 ms), all values are working.For 10ms and 1s
time-base, preset value determine the number of "step" between 0 and 100%. For
instance :
%PWM0.P = 2 => available ratio are 0%, 50%, 100%
%PWM0.P = 5 => available ratio are 0%, 20%, 40%, 60%, 80%, 100%
%PWM0.P = 10 => ratios are 0-10-20-30-40-50-60-70-80-90-100 %
NOTE: The PWM function block does not work if the preset value is equal to1.
Operation
The frequency of the output signal is set during configuration by selecting the time
base TB and the preset %PWMi.P. Modifying the % PWMi.R duty cycle in the
program modulates the width of the signal. Below is an illustration of a pulse diagram
for the PWM function block with varying duty cycles.
Programming Example:
Special Cases
The following table shows a list of special operating of the PWM function block.
Introduction
The %PLS function block is used to generate square wave signals. There are two
%PLS functions available on the dedicated output channels %Q0.0.0 or %Q0.0.1.
The %PLS function block allows only a single signal width, or duty cycle, of 50%.
You can choose to limit the number of pulses or the period when the pulse train is
executed. These can be determined at the time of configuration and/or updated by
the user application.
NOTE: Controllers with relay outputs for these two channels do not support %PLS
function.
Representation
An example of the pulse generator function block in single-word mode:
Specifications
The table below contains the characteristics of the PLS function block:
To obtain a good level of precision from the duty cycle with time
bases of 10ms and 1s, you are recommended to have a %PLSi
>= 100 if P is odd.
Number of %PLSi.N The number of pulses to be generated in period T can be limited
pulses %PLSi.ND* to the range 0 <= %PLSi.N <= 32767 in standard mode or
0 <= %PLSi.ND <= 4294967295 in double word mode . The
default value is set to 0.
To produce an unlimited number of pulses, set %PLSi.N or
%PLSi.ND to zero. The number of pulses can always be
changed irrespective of the Adjustable setting.
Adjustable Y/N If set to Y, it is possible to modify the preset value %PLSi.P via
the HMI or Animation Tables Editor. Set to N means that there is
no access to the preset.
Pulse IN At state 1, the pulse generation is produced at the dedicated
generation output channel. At state 0, the output channel is set to 0.
input
Reset input R At state 1, outputs %PLSi.Q and %PLSi.D are set to 0.The
number of pulses generated in period T is set to 0.
Current %PLSi.Q At state 1, indicates that the pulse signal is generated at the
pulse dedicated output channel configured.
output
generation
Pulse %PLSi.D At state 1, signal generation is complete. The number of desired
generation pulses has been reached.
done output
Range of Periods
The preset value and the time base can be modified during configuration. They are
used to fix the signal period T=%PLSi.P * TB. The range of periods available:
z 0.142 ms to 36.5 ms in steps of 0.142 ms (27.4Hz to 7kHz)
z 0.57 ms to 146 ms in steps of 0.57 ms (6.84 Hz to 1.75 kHz)
z 20 ms to 5.45 mins in steps of 10 ms
z 2 sec to 9.1 hours in steps of 1 sec
Operation
The following is an illustration of the %PLS function block.
Special Cases
NOTE: %PLSx.D is set when the number of desired pulses has been reached. It is
reset by either setting the IN or the R inputs to 1.
Introduction
The drum controller operates on a principle similar to an electromechanical drum
controller which changes step according to external events. On each step, the high
point of a cam gives a command which is executed by the controller. In the case of
a drum controller, these high points are symbolized by state 1 for each step and are
assigned to output bits %Qi.j, internal bits %Mi or AS interface slave output bits
%QAx.y.z known as control bits.
Illustration
The following is an illustration of the drum controller function block.
Parameters
The drum controller function block has the following parameters:
Introduction
The drum controller consists of:
z A matrix of constant data (the cams) organized in eight steps (0 to 7) and 16 data
bits (state of the step) arranged in columns numbered 0 to F.
z A list of control bits is associated with a configured output (%Qi.j.k), memory word
(%Mi) or AS interface slave output (%QAx.y.z). During the current step, the
control bits take on the binary states defined for this step.
The example in the following table summarizes the main characteristics of the drum
controller.
Column 0 1 2 D O F
Control bits %Q0.1 %Q0.3 %Q1.5 %Q0.6 %Q0.5 %Q1.0
0 steps 0 0 1 1 1 0
1 steps 1 0 1 1 0 0
5 steps 1 1 1 0 0 0
6 steps 0 1 1 0 1 0
7 steps 1 1 1 1 0 0
Operation
In the above example, step 5 is the current step, control bits %Q0.1, %Q0.3, and
%Q1.5 are set to state 1; control bits %Q0.6, %Q0.5, and %Q1.0 are set to state 0.
The current step number is incremented on each rising edge at input U (or on
activation of instruction U). The current step can be modified by the program.
Timing Diagram
The following diagram illustrates the operation of the drum controller.
Special Cases
The following table contains a list of special cases for drum controller operation.
Introduction
The following is an example of programming and configuring a drum controller. The
first six outputs %Q0.0 to %Q0.5 are activated in succession each time input %I0.1
is set to 1. Input I0.0 resets the outputs to 0.
Programming Example
The following illustration is a drum controller function block with examples of
reversible and non-reversible programming.
Configuration
The following information is defined during configuration:
z Number of steps: 6
z The output states (control bits) for each drum controller step.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Step 1: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Step 2: 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Step 3: 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
Step 4: 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
Step 5: 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
Step 6: 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
1: %Q0.0 4: %Q0.1
2: %Q0.2 5: %Q0.3
3: %Q0.4 6: %Q0.5
Introduction
The Fast Counter function block (%FC) serves as either an up-counter or a down-
counter. It can count the rising edge of discrete inputs up to frequencies of 5 kHz(1)
in single word or double word computational mode. Because the Fast Counters are
managed by specific hardware interrupts, maintaining maximum frequency
sampling rates may vary depending on your specific application and hardware
configuration.
NOTE: (1) For Twido Extreme PLC (TWDLEDCK1), the Fast Counter can count the
rising edge up to frequencies of 10 kHz.
The TWDLC••40DRF Compact controllers can accomodate up to four fast counters,
while all other series of Compact controllers can be configured to use a maximum of
three fast counters. Modular controllers can only use a maximum of two. The Fast
Counter function blocks %FC0, %FC1, %FC2, and %FC3 use dedicated inputs
%I0.0.2, %I0.0.3, %I0.0.4 and %I0.0.5 respectively. These bits are not reserved for
their exclusive use. Their allocation must be considered with the use of other
function blocks for these dedicated resources.
Illustration
The following is an example of a Fast Counter function block in single-word mode.
Parameters
The following table lists parameters for the Fast Counter function block.
Special Note
If configured to be adjustable, then the application can change the preset value
%FCi.P or %FCi.PD and current value %FCi.V or %FCi.VD at any time. But, a new
value is taken into account only if the input reset is active or at the rising edge of
output %FCi.D. This allows for successive different counts without the loss of a
single pulse.
Operation
If configured to up-count, when a rising edge appears at the dedicated input, the
current value is incremented by one. When the preset value %FCi.P or %FCi.PD is
reached, the Done output bit %FCi.D is set to 1.
If configured to down-count, when a rising edge appears at the dedicated input, the
current value is decreased by one. When the value is zero, the Done output bit
%FCi.D is set to 1.
Special Cases
The following table contains a list of special operating cases for the %FC function
block:
Introduction
The Very Fast Counter function block (%VFC) can be configured by TwidoSuite to
perform any one of the following functions:
z Up/down counter
z Up/down 2-phase counter
z Single Up Counter
z Single Down Counter
z Frequency Meter
Illustration
Here is a block representation of the Very Fast Counter (%VFC) in single-word
mode:
Specifications
The following table lists characteristics for the very fast counter (%VFC) function
block.
(*) Means a 32-bit double word variable. The double word option is available on all
controllers with the exception of the Twido TWDLC•A10DRF controllers.
(1) Writable only if Adjust is set to one.
(2) Access available only if configured.
(3) Read and write access only through the application. Not the Operator Display or
Animation Tables Editor.
CM = Counting Mode
FM = Frequency Meter Mode
NOTE: Outputs are managed independently from the controller cycle time. The
response time is between 0 and 1ms.
Reflex value < %VFC.S0 %VFC0.S0 <= value < %VFC0.S1 value >= %VFC0.S1
Output
%Q0.0.2 X
%Q0.0.3 X X
Reflex value < %VFC.S0 %VFC0.S0 <= value < %VFC0.S1 value >= %VFC0.S1
Output
%Q0.0.2 X X
%Q0.0.3 X
Example:
Reflex value < %VFC.S0 %VFC0.S0 <= value < %VFC0.S1 value >= %VFC0.S1
Output
%Q0.0.2 X
%Q0.0.3 X X
Example:
Special Cases
The following table shows a list of special operating of the %VFC function block.
Introduction
A Twido controller can be configured to communicate with Modbus slave devices or
can send and/or receive messages in character mode (ASCII).
TwidoSuite provides the following functions for these communications:
z EXCH instruction to transmit/receive messages
z Exchange control function block (%MSG) to control the data exchanges
The Twido controller uses the protocol configured for the specified port when
processing an EXCH instruction. Each communication port can be assigned a
different protocol. The communication ports are accessed by appending the port
number to the EXCH or %MSG function (EXCH1, EXCH2, %MSG1, %MSG2).
In addition, TWDLC•E40DRF series controllers implement Modbus TCP messaging
over the Ethernet network by using the EXCH3 intruction and %MSG3 function.
EXCH Instruction
The EXCH instruction allows a Twido controller to send and/or receive information
to/from ASCII devices. The user defines a table of words (%MWi:L) containing the
data to be sent and/or received (up to 250 data bytes in transmission and/or
reception). The format for the word table is described in the paragraphs about each
protocol. A message exchange is performed using the EXCH instruction.
Syntax
The following is the format for the EXCH instruction:
[EXCHx %MWi:L]
Where: x = serial port number (1 or 2); x = Ethernet port (3); L = total number of
words of the word table (maximum 125). Modbus frame length must be ≤255 Bytes .
The Twido controller must finish the exchange from the first EXCHx instruction
before a second exchange instruction can be started. The %MSG function block
must be used when sending several messages.
NOTE: To find out more information about the Modbus TCP messaging instruction
EXCH3, please refer to .
Introduction
NOTE: The "x" in %MSGx signifies the controller port: "x = 1 or 2"
z x = 1 or 2, signifies the serial port 1 or 2 of the controller, respectively;
z x = 3, signifies the Ethernet network port of the controller (on TWDLC•E40DRF
controllers only). For more information about the %MSG3 function, please refer
to .
The %MSGx function block manages data exchanges and has three functions:
z Communications error checking:
Error checking verifies that the block length (word table) programmed with the
EXCH instruction is large enough to contain the length of the message to be sent
(compare with length programmed in the least significant byte of the first word of
the word table).
Error 1 : Invalid command, table incorrectly configured, incorrect character
received (speed, parity, etc.) or reception table full (not updated).
z Coordination of multiple messages:
To ensure coordination when sending multiple messages, the %MSGx function
block provides the information required to determine when a previous message
is complete.
z Transmission of priority messages:
The %MSGx function block allows the current message transmission to be
stopped, in order to allow the immediate sending of an urgent message.
The programming of the %MSGx function block is optional.
Illustration
The following is an example of the %MSGx function block.
Parameters
The following table lists parameters for the %MSGx function block.
If an error occurs when using an EXCH instruction, bits %MSGx.D and %MSGx.E
are set to 1, and system word %SW63 contains the error code for Port 1, and
%SW64 contains the error code for Port 2. See System Words (%SW), page 710.
Reinitializing Exchanges
An exchange is cancelled by activating the input (or instruction) R. This input
initializes communication and resets output %MSGx.E to 0 and output %MSGx.D to
1. It is possible to reinitialize an exchange if an error is detected.
Example of reinitializing an exchange:
Special Cases
The following table the special operating cases for the %MSGx function block.
Clock Functions
Introduction
Twido controllers have a time-of-day clock function, which requires the Real-Time
Clock option (RTC) and provides the following:
z Schedule blocks are used to control actions at predefined or calculated times.
z Time/date stamping is used to assign time and dates to events and measure
event duration.
The Twido time-of-day clock can be accessed by selecting Schedule Blocks from
from the TwidoSuite Program →Configure →Configure Data task. Additionally,
the time-of-day clock can be set by a program. Clock settings continue to operate
for up to 30 days when the controller is switched off, if the battery has been charged
for at least six consecutive hours before the controller is switched off.
The time-of-day clock has a 24-hour format and takes leap years into account.
Schedule Blocks
Introduction
Schedule Blocks are used to control actions at a predefined month, day, and time.
A maximum of 16 schedule blocks can be used and do not require any program
entry.
NOTE: Check system bit %S51 and system word %SW118 to confirm that the Real-
Time Clock (RTC) option is installed see System Bits (%S), page 702. The RTC
option is required for using schedule blocks.
Parameters
The following table lists parameters for a schedule block:
By default (or after a cold restart) all bits of this system word are set to 1. Use of
these bits by the program is optional.
Example
The following table shows the parameters for a summer month spray program
example:
Using the following program, the schedule block can be disabled through a switch
or a humidity detector wired to input %I0.1.
Time/Date Stamping
Introduction
System words %SW49 to %SW53 contain the current date and time in BCD format
(see Review of BCD Code, page 507, which is useful for display on or transmission
to a peripheral device. These system words can be used to store the time and date
of an event (see System Words (%SW), page 710.
NOTE: Date and time can also be set by using the optional Operator Display (see
Time of Day Clock, page 393).
Dating an Event
To date an event it is sufficient to use assignment operations, to transfer the
contents of system words to internal words, and then process these internal words
(for example, transmission to display unit by EXCH instruction).
Programming Example
The following example shows how to date a rising edge on input %I0.1.
Introduction
You can update the date and time settings by using one of the following methods:
z TwidoSuite
Use the Adjust Time dialog box. This dialog box is available from either
z the TwidoSuite Monitoring Utility accessible via the TwidoSuite
Application Launcher or
z by selecting Program →Debug, connecting yourself and selecting Check
PLC.
z System Words
Use system words %SW49 to %SW53 or system word %SW59.
The date and time settings can only be updated when the RTC option cartridge
(TWDXCPRTC) is installed on the controller. Note that the TWDLC••40DRF series
of compact controllers and the Twido Extreme PLC (TWDLEDCK1) have an
integrated RTC onboard.
Programming Example:
Words %MW10 to %MW14 will contain the new date and time in BCD format (see
Review of BCD Code, page 507) and will correspond to the coding of words %SW49
to %SW53.
The word table must contain the new date and time:
Using %SW59
Another method of updating the date and time is to use system bit %S59 and date
adjustment system word %SW59.
Setting bit %S59 to 1 enables adjustment of the current date and time by word
%SW59 (see System Words (%SW), page 710). %SW59 increments or decrements
each of the date and time components on a rising edge.
Application Example
The following front panel is created to modify the hour, minutes, and seconds of the
internal clock.
The following program reads the inputs from the panel and sets the internal clock.
Overview
This section contains information for getting started with the PID control and Auto-
Tuning functions available on Twido controllers.
Purpose of Document
Introduction
This quick start guide aims to guide you, by providing examples, through all the
steps required to correctly configure and set up your Twido controller’s PID control
functions.
NOTE: Implementing the PID function on a Twido does not require an advanced
level of system understanding, but does demand a certain degree of rigor for good
results.
Step Description
1 Configuration of analog channels used for control
2 Prerequisites for PID configuration
3 PID configuration
4 Initialization of control setup.
5 AT + PID control setup
6 Debugging and adjustments
The diagram below shows the experimental setup used in the example:
Introduction
In general, a PID controller uses an analog feedback signal (known as the "process
value") to measure the value to be adjusted.
This value can be a level, a temperature, a distance, or another value for other
applications.
Step Action
1 Select Describe step from the TwidoSuite interface.
See .
2 Display the product catalog and select a module to add to the system
description.
For example, TM2ALM3LT for measuring temperature using a PT100 or
Thermocouple.
3 Add the module to the system description (see .)
4 Use the Configuration Editor to set parameters of analog I/O modules that you
added as expansion modules when you described the system.
5 In the Type column, select the input type corresponding to the type of sensor
used (ThermoCouple K, if the sensor is of this type).
6 In the Range column, select the measurement unit for the sensor. For
temperature sensors it is easier to select Celsius, as this makes the number
of counts sent back by the analog card a direct factor of the real measurement.
Step Action
7 Provide an address for the input symbol of the configured analog card. It will
be used to complete the PID fields (%IW1.0, for this example).
8 Do the same for an analog output if an output must be used to drive the control
system.
Introduction
Before configuring the PID, ensure that the following phases have been performed:
Phase Description
1 PID enabled in the program.
2 Scan period configured
z In Instruction List:
----
0 LD %M0
1 [ PID 0 ]
NOTE: Ensure that you use correct syntax:
Check that there is a space between "PID" and the PID number (e.g.
PID<space>0).
Step Action
1 Use the Program →Configure →Configure the Behavior task to configure the
controller Scan Mode settings.
2 Check the Periodic box.
3 Set the cycle time as shown in the screen below:
Note: The cycle time should be adjusted to the size of the program and desired
performance. (A time of 50ms is a good compromise).
Introduction
For this example, we have chosen to implement the majority of PID controller
functions for Twido. Some selections are not essential and can be simplified.
Auto-Tuning (AT)
The PID controller has an Auto-Tuning function that simplifies the regulation loop
setting (this function is referred to as AT in the rest of the document).
Operating Modes
The Twido PID controller offers four distinct operating modes, configurable in the
General tab in the PID dialog box:
z PID = Simple PID controller.
z AT + PID = The Auto-Tuning function is active when the PID starts up and
automatically enters the gain values Kp, Ti, Td (PID tab) and the type of PID
action (Output tab). At the end of the Auto-Tuning, sequence, the controller
switches to PID mode for the adjusted setpoint, and using the parameters set by
AT.
z AT = The Auto-Tuning function is active when the PID starts up and automatically
enters the gain values Kp, Ti, Td (PID tab) and the type of PID action (Output
tab). At the end of the sequence the PID stops and waits. The gain values Kp, Ti,
Td (PID tab) and the type of PID action (Output tab) are entered.
z Word address = The selection of PID operating mode can be controlled by the
program by assigning the desired value to the word address associated to this
selection:
z %MWxx=1: The controller operates in simple PID mode.
z %MWxx=2: The controller operates in AT + PID.
z %MWxx=3: The controller operates in AT mode only.
z %MWxx=4: The controller operates in PI mode only.
This type of configuration via the word address enables the user to manage the
PID controller operating mode via the application program, thus making it
possible to adapt to the final requirements.
NOTE: PI regulation can be selected from the PID tab.
Step Action
1 Select the Program →Configure →Configure the Data task on the
TwidoSuite interface.
Result: The default software configuration window appears.
2 Select Advanced Objects from the Object Category frame and choose PID)
from the Objects Type frame.
3 Select the desired PID# from the PID table.
4 The PID dialog box appears in the foreground and is used to enter the different
controller settings as shown in the figure below. In offline mode, this displays
several tabs: General, Input, PID, AT, Output:
Important: The tabs must be entered in the order in which they appear in the
PID dialog box: first General, Input, PID, AT then Output.
Note: In online mode, this screen displays two more tabs, Animation and
Trace, used respectively for the diagnostics and display of the controller
operation.
Step Action
1 In the General tab, check the Configured box to activate the PID and set the
following tabs.
2 In the Operating mode drop-down list, select the type of operation desired
(see page 582).
In the example: We will select the Memory address mode and enter the word
%MW17 in the associated field. The PID operating mode will then be linked to
the value in %MW17.
Step Action
1 In the Input tab, enter the analog channel used as a measurement in the
associated field.
In the example: We have chosen %IW1.0 as this is used as a temperature
measurement.
2 Where necessary, set alarms on the low and high measurement thresholds by
checking the boxes and filling in the associated fields.
Note: The values entered may be fixed values (entered in the associated
fields) or modifiable values (by filling in the fields associated with the memory
addresses: %MWxx).
Step Action
1 In the PID tab, enter the value to be used to set the controller setpoint. In
general, this value is a memory address or setpoint of an analog input.
In the example: We have entered %MW0, which will be used as a setpoint
word.
2 The Corrector type can be selected only if the PID operating mode has been
previously chosen in the General tab.
In the example: the Corrector type is set to automatic and disabled.
Note: If you have previously chosen PID as your operating mode, you can
select the desired corrector type (PID or PI) from the drop-down list. If PI is
selected the Td parameter is forced to zero and this field is disabled.
3 Set the Kp, Ti, Td parameters.
Important: If the AT or AT+PID mode is selected, it is essential that the Kp, Ti
and Td fields be completed with memory addresses, to enable the Auto-
Tuning function to automatically fill in the values found.
In the example: We have entered %MW10 for Kp, %MW11 for Ti and %MW12
for Td.
Note: In principle, it is rather difficult to determine the optimal adjustment
values of Kp, Ti and Td for an application that has not yet been created.
Consequently, we strongly recommend you enter the memory words
addresses in these fields, in order to enter these values in online mode thus
avoiding switching to offline mode to make on-the-fly changes to values.
4 Enter the PID Sampling period. This value is used by the controller to acquire
measurements and update outputs.
In the example: We have set the PID sampling period to 100, or 1s. Given that
the adjusted system has a time constant of several minutes, this sampling
period value seems correct.
Important: We advise you set the sampling period to a multiple of the
controller scan period, and a value consistent with the adjusted system.
Step Action
1 In the AT tab, check the Authorize box if you want to use AT.
Special For further details about setting these values refer to the Auto tuning tab of the
Note PID function (see page 621) section.
Advice We strongly recommend you enter the memory words addresses in these
fields, in order to enter these values in online mode thus avoiding switching to
offline mode to make on-the-fly changes to values.
Step Action
2 Enter the Measurement limit value. This is the limit value that the
measurement must not exceed during AT.
3 Enter the Output setpoint value which is the controller output value sent to
generate AT.
Special For further details about setting these values refer to the Auto tuning tab of the
Note PID function (see page 621) section.
Advice We strongly recommend you enter the memory words addresses in these
fields, in order to enter these values in online mode thus avoiding switching to
offline mode to make on-the-fly changes to values.
WARNING
UNEXPECTED EQUIPMENT OPERATION
Do not use a relay output with the PID function.
Failure to follow these instructions can result in death, serious injury, or
equipment damage.
NOTE: Use a solid state output in conjunction with the PID function. Using a relay
may result in quickly exceeding its life cycle limits resulting in an inoperative relay,
with contacts either frozen open or soldered close.
Step Action
1 In the Output tab, enter the selection from the Action drop-down list.
This selection depends on the configured system:
z Direct action: the controller output decreases as the variation value
(setpoint - measurement) increases (cold controller).
z Inverse action: Direct action: the controller output decreases as the
variation value (setpoint - measurement) increases (hot controller).
Important: When using the AT function, this list automatically selects Bit
address. The operating mode is determined by the AT function, and in this
case entered in the bit associated with this field.
2 Where necessary, enter the threshold values of the controller output in the
Alarms field. This function may be necessary in certain applications for
managing process alarms where thresholds are exceeded.
Step Action
3 Set the Manual mode operating mode.
The drop-down list offers several choices:
z Inhibit = no manual mode.
z Authorize = the controller operates in manual mode only.
z Bit address = the value of the bit is used to change the operation of manual
mode (bit set to 0 = automatic mode, bit set to 1 = manual mode).
In the example: Here we select %M2 to activate the choice, and %MW18 to
adjust the value of the manual setpoint.
Use the manual mode to make trials to determine the min/max output
limitation, or most accurate AT output setpoint.
4 Adjust the Discrete output word. This word is used by the controller to send
the control setpoint. It can be sent directly to an analog output channel (%QW..)
or to a memory word (%MWxx) for additional processing.
Important: When using the PWM function, enter a memory address (%MWxx)
in this field.
5 Set the PWM output if required by the system:
1. Check the Authorize box if you intend to control the system via a PWM
actuator.
2. Enter the PWM control Period in the associated field.
3. Enter the Output used to control the PWM actuator. We recommend you
use the base controller transistor outputs for this function (for example,
%Q0.0 or %Q0.1 for the TWDLMDA20DRT base controller).
6 Confirm the controller configuration by clicking OK in the bottom left of the
screen.
7 To configure several PID controllers, click Next to increment the number of the
PID to be set.
Step Action
1 Connect the PC to the controller and transfer the application.
2 Switch the controller to RUN mode.
NOTE: Before switching the controller to RUN mode, check that the machine’s
operating conditions allow this for the rest of the application.
Procedure
The steps below must be followed to initialize control set-up:
Step Action
1 Create an animation table containing the main objects needed for diagnostics.
In the example:
z %MW0: loop controller setpoint,
z %IW1.0: measurement,
z %M0: enabling of loop controller,
z %M1: loop controller action type (set by the AT function),
z %M2: selection of Automatic or Manual mode,
z %MW10 to %MW12: PID loop controller coefficients,
z %MW13: measurement limit not to be exceeded in AT mode,
z %MW14: loop controller output setpoint in AT mode,
z %MW15: discrete output of the PID loop controller (entered by the controller),
z %MW16: setting of the PWM period,
z %MW17: operating mode selection for the PID controller,
z %MW18: manual setpoint associated with the %M2 bit selection.
Step Action
2 Check the consistency of the value measured in the %IW1.0 field.
In the example:
1. A measurement of 248 counts is obtained when the system stable and cold.
2. This seems consistent, as we have a multiplication coefficient of 10 between the
temperature and the value read. We can also influence the measurement
externally to make sure the reading is consistent (increase the temperature
around the probe to check the measurement also increases).
Note: This test is quite important, as the operation of the controller depends
essentially on the accuracy of the measurement.
3. If you have any doubt about the accuracy of the measurement, set the controller
to STOP mode and check the wiring to the inputs of the analog card (voltmeter
or ammeter for inputs 0-10V / 4-20mA, ohmmeter for the PT100 (100 ohms at
20° ) or Thermocouple (a few tens of ohms):
z First disconnect the probe from the analog card terminals.
z Check there is no wiring reversal (the colors of the wires connected to the
inputs, compensation cable for the PT100).
Important: IN0 and IN1 input channels have a shared potential at the
terminals (-).
z Check that the analog card is powered by a 24 VDC supply to the first two
terminals.
z Check that the 4-20 mA input sensors are supplied. The Twido analog input
cards are not a source of current.
3 To power up the loop controller, start by controlling the PID controller in Manual
mode in order to increase the limit values needed by the AT function.
To set the controller to Manual mode:
1. Switch the controller to RUN mode.
2. Enter the memory addresses with the following values in the animation table:
z %M2: Manual mode selection = 1,
(M2=1 => Manual Mode, M2=0 => Automatic Mode),
z %MW16: PWM period setting = 10,
z %MW17: Operating mode selection for the PID controller = 1 (PID only),
z %MW18: Manual setpoint associated with the %M2 bit selection = 1000.
This setpoint value can be selected several times, on condition that the
system be left to return to its initial state.
In the example: We have selected the value 1000, which corresponds to an
average temperature increase value (for information, 2000 counts = 200° ).
When cold, the system starts at a value of 250 counts.
4 Check that the controller is RUN mode.
(%M0: controller validation = 1, to be entered in the animation table.)
5 Select Advanced Objects from the Object Category frame and choose PID) from
the Objects Type frame.
Select the desired PID# from the PID table.
Step Action
6 Activate the Animation tab for the required PID number and check that the
animation matches the screen below:
Note: The screens of the PID controller are only refreshed if the controller is
enabled (and API set to RUN).
7 Activate the Trace tab for the required PID number, then:
1. Set the time elapse drop-down list to 15 min to see a trace of the measurement
signal’s progress.
2. Check that the measurement value remains within the acceptable values for the
system. The increase in the measurement can be checked in the Trace tab.
When this has stabilized, read the value corresponding to the stabilization of the
measurement graph (for example, 350 counts corresponding to 35° , or an
increase of 10° compared with the initial state).
Step Action
8 Set the time elapse scroll list to 15min to see a trace of the measurement signal’s
progress.
Check that the measurement value remains within the acceptable values for the
system. We can view the increase in the measurement from the Trace tab. When
this has stabilized, read the value corresponding to the stabilization of the
measurement graph (for example, 350 counts corresponding to 35° , or an increase
of 10° compared with the initial state).
9 If we see that the actuator is not controlled, check the output circuit:
z For an analog output, check the output voltage or current from the analog card.
z For a PWM output, check:
z the LED of the output concerned is lit (%Q0.1, in this example),
z the wiring of the supplies and 0V circuit for the TWDLMDA20DRT base
outputs,
z the actuator power supply.
10 Close the PID display screen and stop the manual mode by entering the following
values in the animation table:
z %M0: Enable loop controller = 0 (stop the loop controller)
z %M2: Selection of Automatic or Manual mode = 0 (stop manual mode)
z %MW17: Operating mode selection for the PID controller = 0
z %MW18: Manual setpoint associated with %M2 bit selection = 0.
Introduction
In this section, we will be looking at how to configure the controller to start operation
in AT+PID. mode. In this operating mode, the controller will automatically adjust the
controller to coefficients Kp, Ti, Td.
NOTE: During the sequence, the system should not be subject to any disturbance
due to external variations that would affect the final adjustments. Also, before
launching the AT sequence, make sure the system is stabilized.
Step Action
1 Enter or check the memory addresses with the following values in the
animation table:
z %M2: selection of Automatic or Manual mode = 0,
z %MW0: loop controller setpoint = 600 (in this example, the setpoint is active
after the AT sequence and the controller maintains a temperature of 60° ),
z %MW10 to %MW12: coefficients of the PID controller (leave at 0, the AT
sequence will fill them in),
z %MW13: measurement limit not to be exceeded in AT mode = 900 (in the
example, if 90° is exceeded an error will occur inAT),
z %MW14: controller output setpoint in AT mode = 2000 (from the test in
manual mode).
This is the step change value applied to the process. In AT mode, the output
setpoint is directly applied at the controller output.
This value can be an internal word (%MW0 to %MW2999), an internal
constant (%KW0 to %KW255) or a direct value. The value must therefore
be between 0 and 10,000.
Note: The output autotuning setpoint must always be greater than the last
output applied to the process.
z %MW15: discrete output of the PID loop controller (entered by the
controller),
z %MW16: PWM period setting (leave 10, as set previously),
z %MW17: operating mode selection for the PID controller = 2 (AT + PID),
z %MW18: manual setpoint associated with the %M2 bit selection = 0.
Step Action
7 Activate the Animation tab for the required PID number and check that the
animation matches the screen below:
Note: The screens of the PID controller are only refreshed if the controller is
enabled (and API set to RUN).
8 Click on Trace button and wait for the system to startAT.
Note: The waiting time may last for 10-20 minutes before the AT procedure
changes.
Repetition of AT
The Auto-Tuning sequence is repeated on every switch to RUN or cold start (%S0).
You should therefore test the diagnostics words using the program what to do in the
event of a restart.
Screen data can be exported into Excel format by clicking on the Export button. This
opens a dialog box in which you can specify the name and location of an .cvs file. In
this dialog box click Save to export the data or Cancel to abandon export.
Step Action
1 Select Advanced Objects from the Object Category frame and choose PID)
from the Objects Type frame.
Select the desired PID# from the PID table.
2 Click the Animation tab.
NOTE: The PID states are stored when the PC and TwidoSuite are in online mode.
Overview
General
The PID regulation function is a TwidoSuite programming language function.
This function is particularly adapted to:
z Answering the needs of the sequential process which need the auxiliary
adjustment functions (examples: plastic film packaging machine, finishing
treatment machine, presses, etc.)
z Responding to the needs of the simple adjustment process (examples: metal
furnaces, ceramic furnaces, small refrigerating groups, etc.)
It is very easy to install as it is carried out in the:
z Configuration
z and Debug
screens associated with a program line (operation block in Ladder Language or by
simply calling the PID in Instruction List) indicating the number of the PID used.
The correct syntax when writing a PID instruction is: PID<space>n, when n is the
PID number.
Example of a program line in Ladder Language:
Key Features
The key features are as follows:
z Analog input,
z Linear conversion of the configurable measurement,
z High or low configurable input alarm,
z Analog or PWM output,
z Cut off for the configurable output,
z Configurable direct or inverse action.
At a Glance
The working of a regulation loop has three distinct phases:
z The acquisition of data:
z Measurements from the process’ sensors (analog, encoders)
z Setpoint(s) generally from the controller’s internal variables or from data from
a TwidoSuite animation table
z Execution of the PID regulation algorithm
z The sending of orders adapted to the characteristics of the actuators to be driven
via the discrete (PWM) or analog outputs
The PID algorithm generates the command signal from:
z The measurement sampled by the input module
z The setpoint value fixed by either the operator or the program
z The values of the different corrector parameters
The signal from the corrector is either directly handled by a controller analog output
card linked to the actuator, or handled via a PWM adjustment on a discrete output
of the controller.
Illustration
The following diagram schematizes the principal of a regulation loop.
At a Glance
The Twido PID function is a function that is available for controllers compatible with
Twido version 2.0 or higher, which is why its installation is subject to a number of
hardware and software compatibilities described in the following paragraphs.
In addition, this function requires the resources presented in the Performances
paragraph.
Compatibility
The Twido PID function is available on Twido controllers version 2.0 or higher
software.
If you have Twidos with an earlier version of the software, you can update your
firmware in order to use this PID function.
NOTE: The version 1.0 analog input/output modules can be used as PID
input/output modules without needing to be updated.
In order to configure and program a PID on these different hardware versions, you
must have the TwidoSuite software.
Performance
The PID regulation loops have the following performances:
Description Time
Loop execution time 0.4 ms
General
The PID function completes a PID correction via an analog measurement and
setpoint in the default [0-10000] format and provides an analog command in the
same format or a Pulse Width Modulation (PWM) on a discrete output.
All the PID parameters are explained in the windows used to configure them. Here,
we will simply summarize the functions available, indicate measurement values and
describe how they integrate into PID in a functional flow diagram.
NOTE: For use at full scale (best resolution), you can configure your analog input
connected to the PID’s measurement branch in 0-10000 format. However, if you use
the default configuration (0-4095), the controller will function correctly.
NOTE: In order for regulation to operate correctly, it is essential that the Twido PLC
is in periodic mode. The PID function is then executed periodically on each cycle,
and the PID input data sampling complies with the period set in configuration (see
table below).
NOTE: For a more in-depth explanation of how each of the functions described in
the above table works, refer to the diagram below.
Operating Principles
The following diagram presents the operating principle of the PID function.
NOTE: In ONLINE mode, when the PLC is in periodic task, the value displayed in
the Ts Field (in the PID software configuration screen) can be different with the
parameter entered (%MW). The Ts value is a multiple of the periodic task, whereas
the %MW value is the value read by the PLC.
NOTE: The parameters used are described in the table on the page above and in
the configuration screens.
At a Glance
The following paragraphs describe how to access the PID configuration screens on
Twido controllers.
Procedure
The following table describes the procedure for accessing the PID configuration
screens:
Step Action
1 Check that you are in offline mode.
2 Select Advanced Objects from the Object Category frame and choose PID
from the Objects Type frame.
3 Select the desired PID# from the PID table. (see page 609)
Result: The PID configuration window opens and displays the General
(see page 613) tab by default.
At a Glance
The PID configuration window permits to:
z Configure each TWIDO PID (in offline mode),
z Debug each TWIDO PID (in online mode).
The table below describes the settings that you may define.
Field Description
Address Specify the PID number that you wish to configure here.
The value is between 0 and 13, 14 PID maximum per application.
Configured To configure the PID, this box must be checked. Otherwise no action can
be performed in these screens and the PID, though it exists in the
application, cannot be used.
Note: You must first complete the current PID configuration before switching
to another PID or performing any another software task.
Field Description
Used Read only, this box is checked if the PID with corresponding number is
used in the application program
Sort option box Select the corresponding sort option according to whether you wish to
display All, or only Used or Unused PID in the PID selection table.
Note: You must first complete the current PID configuration before switching
to another PID or performing any another software task.
Field Description
General Tab Specify the PID General parameters, see General Tab of PID function,
page 613
Input Tab Specify the PID Input parameters, see Input Tab of the PID, page 616
PID Tab Specify the PID internal parameters, see PID Tab of PID function,
page 618
AT Tab Specify the AT parameters, see AT Tab of PID Function, page 621
Output Tab Specify the PID Output parameters, see Output Tab of the PID,
page 626
Animation Tab View/Debug the PID, see Animation Tab of PID Function, page 630
NOTE: In some cases, some tabs and fields may not be accessible for either of the
two following reasons:
z The operating mode (offline or online) which is currently active does not allow you
to access these parameters.
z The "PID only" operating mode is selected, which prevents access to the AT tab
parameters that are no longer needed.
The PID trace button allows you to view the PID control.
This tab allows you to view PID operation and to make adjustments to the way it
behaves, see Trace Screen of PID Function, page 633.
At a Glance
Select Advanced Objects from the Object Category frame and choose PID from the
Objects Type frame.
Select the desired PID# from the PID table.
The PID configuration window allows you to:
z configure each TWIDO PID (in online mode),
z debug each TWIDO PID (in offline mode),
When you open this screen, if you are:
z in offline mode: the General tab is displayed by default and you have access to
the configuration parameters,
z in online mode: the Animation tab is displayed and you have access to the
debugging and adjustment parameters.
NOTE: In some cases, some tabs and fields may not be accessible for either of the
following reasons:
z The operating mode (offline or online) which is currently active does not allow you
to access these parameters.
z The "PID only" operating mode is selected, which prevents access to the AT tab
parameters that are no longer needed.
The following paragraphs describe the General tab.
Description
The table below describes the settings that you may define.
Field Description
PID number Specify the PID number that you wish to configure here.
The value is between 0 and 13, 14 PID maximum per application.
Configured To configure the PID, this box must be checked. Otherwise no action can
be performed in these screens and the PID, though it exists in the
application, cannot be used.
Field Description
Operating mode Specify the desired operating mode here. You may choose from three
operating modes and a word address, as follows:
z PID
z AT
z AT+PID
z Word address
Word address You may provide an internal word in this text box (%MW0 to %MW2999)
that is used to programmatically set the operating mode. The internal
word can take four possible values depending on the operating mode
you wish to set:
z %MWx = 1 (to set PID only)
z %MWx = 2 (to set AT + PID)
z %MWx = 3 (to set AT only)
z %MWx = 4 (to set PI only)
PID States If you check to enable this option, you may provide a memory word in
this text box (%MW0 to %MW2999) that is used by the PID controller to
store the current PID state while running the PID controller and/or the
autotuning function (for more details, please refer to PID States and
Error Codes, page 635.)
Diagram The diagram allows you to view the different possibilities available for
configuring your PID.
NOTE: Make sure to use the autotuning only when no other PID are running, the
influence of the others PID produces a but calculus of the constant Kp, Ti, Td.
At a Glance
The tab is used to enter the PID input parameters.
NOTE: It is accessible in offline mode.
Description
The table below describes the settings that you may define.
Field Description
PID number Specify the PID number that you wish to configure here.
The value is between 0 and 13, 14 PID maximum per application.
Measurement Specify the variable that will contain the process value to be controlled
here.
The default scale is 0 to 10000. You can enter either an internal word
(%MW0 to %MW2999) or an analog input (%IWx.0 to %IWx.1).
Conversion Check this box if you wish to convert the process variable specified as a
PID input.
If this box is checked, both the Min value and Max value fields are
accessible.
The conversion is linear and converts a value between 0 and 10,000 into
a value for which the minimum and maximum are between -32768 and
+32767.
Min value Specify the minimum and maximum of the conversion scale. The
Max value process variable is then automatically rescaled within the [Min value to
Max value] interval.
Note: The Min value must always be less than the Max value.
Min value or Max value can be internal words (%MW0 to %MW2999),
internal constants (%KW0 to %KW255) or a value between -32768 and
+32767.
Alarms Check this box if you wish to activate alarms on input variables.
Note: The alarm values should be determined relative to the process
variable obtained after the conversion phase. They must therefore be
between Min value and Max value when conversion is active.
Otherwise they will be between 0 and 10000.
Low Specify the high alarm value in the Low field.
Output This value can be an internal word (%MW0 to %MW2999), an internal
constant (%KW0 to %KW255) or a direct value.
Output must contain the address of the bit which will be set to 1 when
the lower limit is reached. Output can be either an internal bit (%M0 to
%M255) or an output (%Qx.0 to %Qx.32).
High Specify the low alarm value in the High field.
Output This value can be an internal word (%MW0 to %MW2999), an internal
constant (%KW0 to %KW255) or a direct value.
Output must contain the address of the bit which will be set to 1 when
the upper limit is reached. Output can be either an internal bit (%M0 to
%M255) or an output (%Qx.0 to %Qx.32).
Diagram The diagram allows you to view the different possibilities available for
configuring your PID.
At a Glance
The PID tab is used to enter the internal PID parameters.
NOTE: It is accessible in offline mode.
Description
The table below describes the settings that you may define.
Field Description
PID number Specify the PID number that you wish to configure here.
The value is between 0 and 13, 14 PID maximum per application.
Setpoint Specify the PID setpoint value here. This value can be an internal word
(%MW0 to %MW2999), an internal constant (%KW0 to %KW255) or a
direct value.
This value must therefore be between 0 and 10000 when conversion
is inhibited. Otherwise it must be between the Min value and the
Max value for the conversion.
Corrector type If the PID operating mode has been previously chosen in the General
tab, you can select the desired Corrector type (PID or PI) from the
drop-down list. If other operating modes have been chosen the
Corrector type is set to automatic and cannot be modified manually.
If PI is selected from the drop-down list, the Td parameter is forced to
zero and this field is disabled.
Kp * 100 Specify the PID proportional coefficient multiplied by 100 here.
This value can be an internal word (%MW0 to %MW2999), an internal
constant (%KW0 to %KW255) or a direct value.
The valid range for the Kp parameter is: 0 < Kp < 10000.
Note: If Kp is mistakenly set to 0 (Kp ≤0 is invalid), the default value
Kp=100 is automatically assigned by the PID function.
TI (0.1 sec) Specify the integral action coefficient here for a timebase of 0.1
seconds.
This value can be an internal word (%MW0 to %MW2999), an internal
constant (%KW0 to %KW255) or a direct value.
It must be between 0 and 20000.
Note: To disable the integral action of the PID, set this coefficient to 0.
Td (0.1 sec) Specify the derivative action coefficient here for a timebase of 0.1
seconds.
This value can be an internal word (%MW0 to %MW2999), an internal
constant (%KW0 to %KW255) or a direct value.
It must be between 0 and 10000.
Note: To disable the derivative action of the PID, set this coefficient to
0.
Field Description
Sampling period Specify the PID sampling period here for a timebase of 10-2 seconds
(10 ms).
This value can be an internal word (%MW0 to %MW2999), an internal
constant (%KW0 to %KW255) or a direct value.
It must be between 1 (0.01 s) and 10000 (100 s).
Diagram The diagram allows you to view the different possibilities available for
configuring your PID.
NOTE: When AT is enabled, Kp, Ti and Td parameters are no longer set by the user
for they are automatically and programmatically set by the AT algorithm. In this case,
you must enter in these fields an internal word only (%MW0 to %MW2999).
Note: Do not enter an internal constant or a direct value when AT is enable, for this
will trigger an error when running your PID application.
At a Glance
The setting of correct PID parameters may be complex and time-consuming. This
can make process control difficult to setup for the less experienced, though not
necessarily for a process control professional. Thus, optimum tuning may
sometimes be difficult to achieve.
The PID Auto-Tuning algorithm is designed to automatically determine adequate
values for the following four PID terms:
z Gain factor,
z Integral value,
z Derivative value, and
z Direct or Reverse action.
Thus, the AT function can provide rapid and fine tuning for the process loop.
AT Requirements
PID Auto-tuning is particularly suited for temperature control processes.
In general, the processes that can be controlled by the AT function must meet the
following requirements:
z the process is mostly linear over the entire operating range,
z the process response to a level change of the analog output follows a transient
asymptotic pattern, and
z there is little disturbance in process variables. (In the case of a temperature
control process, this implies there is no abnormally high rate of heat exchange
between the process and its environment.)
AT Operating Principle
The following diagram describes the operating principle of the AT function and how
it interacts with the PID loops:
Description
PID Auto-Tuning is an open-loop process that is acting directly on the control
process without regulation or any limitation other than provided by the Process
Variable (PV) Limit and the Output Setpoint. Therefore, both values must be
carefully selected within the allowable range as specified by the process to prevent
potential process overload.
WARNING
UNSTABLE PID OPERATION
z The Process Variable (PV) limit and the output setpoint values must be set with
complete understanding of their effect on the machine or process.
z Do not exceed the allowable range for Process Variable and Output Setpoint
values.
Failure to follow these instructions can result in death, serious injury, or
equipment damage.
WARNING
UNEXPECTED EQUIPMENT OPERATION
Do not use a relay output with the PID function.
Failure to follow these instructions can result in death, serious injury, or
equipment damage.
The table below describes the settings that you may define.
Field Description
Authorize Check this box if you wish to enable the AT mode.
There are two ways to use this checkbox, depending on whether you set the
operating mode manually or via a word address in the General tab of the PID
function:
z If you set the Operating mode to PID+AT or AT from the General tab
(see page 613)), then the Authorize option is automatically checked and is
not available (it cannot be cleared).
z If you set the operating mode via a word address %MWx (%MWx = 2:
PID+AT; %MWx = 3: AT), then you must check the Authorize option
manually to allow configuring the AT parameters.
Result: In either of the above cases, all the fields in this AT tab configuration
screen become active and you must fill in the Setpoint and Output fields with the
appropriate values.
Field Description
Process Specify the limit that the measured process variable shall not exceed during the
Variable AT process. This parameter helps provide stability to the control system, as AT
(PV) Limit is an open loop process.
This value can be an internal word (%MW0 to a maximum of %MW2999,
depending on amount of system memory available), an internal constant
(%KW0 to %KW255) or a direct value.
This value must therefore be between 0 and 10000 when conversion is
inhibited. Otherwise it must be between the Min value and the Max value for the
conversion.
AT Output Specify the AT output value here. This is the value of the step-change that is
setpoint applied to the process.
This value can be an internal word (%MW0 to %MW2999), an internal constant
(%KW0 to %KW255) or a direct value.
This value must therefore be between 0 and 10000.
The AT output setpoint value should be chosen appropriately using your
practical experience of the process you are controlling. In case of doubt ,or to
determine the most appropriate value, select manual mode and monitor the
system response to various manual output setpoint trials.
Note: The AT Output Setpoint must always be larger than the output last applied
to the process.
NOTE: When the AT function is enabled, constants (%KWx) or direct values are no
longer allowed, only memory words are allowed in the following set of PID fields:
z Kp, Ti and Td parameters must be set as memory words (%MWx) in the PID
tab;
z Action field is automatically set to "Address bit" in the OUT tab;
z Bit box must be filled in with an adequate memory bit (%Mx) in the OUT tab.
At a Glance
The tab is used to enter the PID output parameters.
NOTE: It is accessible in offline mode.
Description
The table below describes the settings that you may define.
Field Description
PID number Specify the PID number that you wish to configure here.
The value is between 0 and 13, 14 PID maximum per application.
Action Specify the type of PID action on the process here. Three options are
available: Reverse, Direct or bit address.
If you have selected bit address, you can modify this type via the
program, by modifying the associated bit which is either an internal bit
(%M0 to %M255) or an input (%Ix.0 to %Ix.32).
Action is direct if the bit is set to 1 and reverse if it is not.
Note: When AT is enabled, the Auto-Tuning algorithm automatically
determines the correct type of action direct or reverse for the control
process. In this case, only one option is available from the Action
dropdown list: Address bit. You must then enter in the associated Bit
textbox an internal word (%MW0 to %MW2999). Do not attempt to enter
an internal constant or a direct value in the Bit textbox, for this will trigger
an execution error.
Limits Specify here whether you want to place limits on the PID output. Three
Bit options are available: Enable, Disable or bit address.
If you have selected bit address, you can enable (bit to 1) or disable (bit
to 0) limit management by the program, by modifying the associated bit
which is either an internal bit (%M0 to %M255) or an input (%Ix.0 to
%Ix.32).
Min. Set the high and low limits for the PID output here.
Max. Note: The Min. must always be less than the Max..
Min. or Max. can be internal words (%MW0 to %MW2999), internal
constants (%KW0 to %KW255) or a value between 1 and 10000.
Manual mode Specify here whether you want to change the PID to manual mode. Three
Bit options are available: Enable, Disable or bit address.
Output If you have selected bit address, you can switch to manual mode (bit to
1) or switch to automatic mode (bit to 0) using the program, by modifying
the associated bit which is either an internal bit (%M0 to %M255) or an
input (%Ix.0 to %Ix.32).
The Output of manual mode must contain the value that you wish to
assign to the analog output when the PID is in manual mode.
This Output can be either a word (%MW0 to %MW2999) or a direct value
in the [0-10000] format.
Analog output Specify the PID output in auto mode here.
This Analog output can be %MW-type (%MW0 to %MW2999) or %QW-
type (%QWx.0).
Field Description
PWM output Check this box if you want to use the PWM function of PID.
enabled Specify the modulation period in Period (0.1s). This period must be
Period (0.1s) between 1 and 500 and can be an internal word (%MW0 to %MW2999) or
Output an internal constant (%KW0 to %KW255). PWM precision depends both
pwm period and scan period. The precision is improved when PWM.R has
greatest number of values. For instance with scan period = 20ms and
PWM period = 200ms, PWM.R can take values 0%, 10%, 20%, 30%, 40%,
50%, 60%, 70%, 80%, 90%, 100%. With scan period = 50ms and PWM
period = 200ms, PWM.R can take values 0%, 25%, 50%, 75% and 100%
of the periode PWM.P.
Specify the PWM output bit as the value in Output. This can be either an
internal bit (%M0 to %M255) or an output (%Qx.0 to %Qx.32).
Diagram The diagram allows you to view the different possibilities available for
configuring your PID.
Note:
z The term Reverse in the action field is used to reach a high setpoint (e.g.: for
heating)
z The term Direct in the action field is used to reach a low setpoint (e.g.: for cooling)
At a Glance
The following paragraphs describe how to access the PID debugging screens on
TWIDO controllers.
Procedure
The following table describes the procedure for accessing the PID debugging
screens:
Step Action
1 Check that you are in online mode.
2 In the monitor software configuration screen, select Advanced Objects from
the Object Category frame and choose PID from the Objects Type frame.
3 Select the desired PID# from the PID table.
Note: You can also double-click the PID graphic element in the ladder rung to
access the PID configuratrion window.
4 Click the Animation tab.
Result: The PID configuration window opens and displays the Animation
(see page 630) tab by default.
At a Glance
The tab is used to debug the PID.
The diagram depends on the type of PID control that you have created. Only
configured elements are shown.
The display is dynamic. Active links are shown in red and inactive links are shown
in black.
NOTE: It is accessible in online mode. In this mode, when the PLC is in periodic
task, the value displayed in the Ts Field (in the PID software configuration screen)
can be different with the parameter entered (%MW). The Ts value is a multiple of the
periodic task, whereas the %MW value is the value read by the PLC.
Description
The following table describes the different zones of the window.
Field Description
PID number Specify the PID number that you wish to debug here.
The value is between 0 and 13, 14 PID maximum per application.
Operating mode This field shows the current PID operating mode.
List of PID states This dropdown list allows you to view the last 15 PID states in real time.
This list is updated with each change of state indicating the date and time
of the change as well as the current state.
Create an Click on Create an Animation Table, to create a file containing all the
Animation Table variables shown in the diagram to enable you modify them online and
debug your PID.
At a Glance
This screen allows you to view PID operation and to make adjustments to the way it
behaves.
The graphs begin to be traced as soon as the debug window is displayed.
NOTE: It is accessible in online mode.
Description
The following table describes the different zones of the window.
Field Description
PID number Specify the PID number that you wish to view here.
The value is between 0 and 13, 14 PID maximum per application.
Chart This zone displays the setpoint and process value graphs.
The scale on the horizontal axis (X) is determined using the menu to the
top right of the window.
The scale on the vertical axis is determined using the PID input
configuration values (with or without conversion). It is automatically
optimized so as to obtain the best view of the graphs.
Horizontal axis This menu allows you to modify the scale of the horizontal axis. You can
scale menu choose from 4 values: 15, 30, 45 or 60 minutes.
Initialize This button clears the chart and restarts tracing the graphs.
Export This button enables you to export the screen data into Excel format.
Click on Export to open a dialog box in which you can specify the name
and location of an .cvs file. In this dialog box, click Save to export the
data or Cancel to abandon the export.
At a Glance
In addition to the List of PID States available from the Animation dialog box (see
Animation Tab of PID Function, page 630) that allows to view and switch back to one
of the 15 latest PID states, the Twido PID controller also has the ability to record the
current state of both the PID controller and the AT process to a user-defined memory
word.
To find out how to enable and configure the PID state memory word (%MWi) see
General Tab of PID function, page 613.
Description of AT State
The autotuning process is divided into 4 consecutive phases. Each phase of the
process must be fulfilled in order to bring the autotuning to a successful completion.
The following process response curve and table describe the 4 phases of the Twido
PID autotuning:
AT Phase Description
1 Phase 1 is the stabilization phase. It starts at the time the user launches the
AT process. During this phase, the Twido autotuning performs checks to
ensure that the process variable is in steady state.
Note: The output last applied to the process before start of the autotuning is
used as both the starting point and the relaxation point for the autotuning
process.
2 Phase 2 applies the fist step-change to the process. It produces a process
step-response similar to the one shown in the above figure.
AT Phase Description
3 Phase 3 is the relaxation phase that starts when the first step-response has
stabilized.
Note: Relaxation occurs toward equilibrium that is determined as the output
last applied to the process before start of the autotuning.
4 Phase 4 applies the second step-change to the process in the same amount
and manner as in Phase 2 described above. The autotuning process ends and
the AT parameters are computed and stored in their respective memory words
upon completion of Phase 4.
Note: After this phase is complete, the process variable is restored to the
output level last applied to the process before start of the autotuning.
Auto-Tuning Requirements
When using the auto-tuning function, make sure the control process and the Twido
PLC meet all of the following four requirements:
z The control process must be an open-loop, stable system.
z At the start of the auto-tuning run, the control process must be in steady state with
a null process input (e.g.: an oven or a furnace shall be at ambient temperature.)
z During operation of the auto-tuning, make sure that no disturbances enter
through the process for either computed parameters will be incorrect or the auto-
tuning process will not operate correctly (e.g.: the door of the oven shall not be
opened, not even momentarily.)
z Configure the Twido PLC to scan in Periodic mode. Once you have determined
the correct sampling period (Ts) for the auto-tuning, the scan period must be
configured so that the sampling period (Ts) is an exact multiple of the Twido PLC
scan period.
NOTE: To ensure a correct run of the PID control and of the auto-tuning process, it
is essential that the Twido PLC be configured to execute scans in Periodic mode
(not Cyclic). In Periodic mode, each scan of the PLC starts at regular time intervals.
This way, the sampling rate is constant throughout the measurement duration
(unlike cyclic mode where a scan starts as soon as the previous one ends, which
makes the sampling period unbalanced from scan to scan.)
AT Operating Modes
The auto-tuning can be used either independently (AT mode) or in conjunction with
the PID control (AT + PID):
z AT mode: After convergence of the AT process and successful completion with
the determination of the PID control parameters Kp, Ti and Td (or after detection
of an error in the AT algorithm), the AT numerical output is set to 0 and the
following message appears in the List of PID States drop-down list: "Auto-tuning
complete."
z AT + PID mode: The AT is launched first. After successful completion of the AT,
the PID control loop starts (based on the Kp, TI and Td parameters computed by
the AT)."
Note on AT+PID: If the AT algorithm encounters an error:
z no PID parameter is computed;
z the AT numerical output is set to output last applied to the process before start
of the autotuning;
z an error message appears in the List of PID States drop-down list
z the PID control is cancelled.
(For more details, see Appendix 2: First-Order With Time Delay Model)
Step Action
1 It is assumed that you have already configured the various settings in the
General, Input, PID, AT and Output tabs of the PID.
2 Select the PID > Output tab.
3 Select Authorize or Address bit from the Manual mode dropdown list to allow
manual output and set the Output field to a high level (in the [5000-10000]
range).
4 Select PLC > Transfer PC => PLC... to download the application program to
the Twido PLC.
5 Within the PID configuration window, switch to Trace mode.
6 Run the PID and check the response curve rise.
7 When the response curve has reached a steady state, stop the PID
measurement.
Note: Keep the PID Trace window active.
8 Use the following graphical method to determine time constant (τ ) of the control
process:
1. Compute the process variable output at 63% rise (S[63%]) by using the
following formula: S[63%] = S[initial] + (S[ending]-S[initial])x63%
2. Find out graphically the time abscissa (t[63%]) that corresponds to S(63%).
3. Find out graphically the initial time (t[initial]) that corresponds the start of the
process response rise.
4. Compute the time constant (τ ) of the control process by using the following
relationship: τ = t[63%]-t[initial]
9 Compute the sampling period (Ts) based on the value of (τ ) that you have just
determined in the previous step, using the following rule: Ts = τ /75
Note: The base unit for the sampling period is 10ms. Therefore, you should
round up/down the value of Ts to the nearest 10ms.
10 Select Program > Configure the Behavior to set the Scan Mode parameters
and proceed as follows:
1. Set the Scan mode of the Twido PLC to Periodic.
2. Set the Scan Period so that the sampling period (Ts) is an exact multiple
of the scan period, using the following rule: Scan Period = Ts / n,
where "n" is a positive integer.
Note: You must choose "n" so that the resulting Scan Period is a positive
integer in the range [2 - 150 ms].
Step Action
1 The PID Output tab is selected from the PID configuration screen.
2 Manual mode is selected from the Output tab.
3 The manual mode Output is set to 10000.
4 The PID run is launched from the PID Trace tab.
5 The PID run is stopped when the oven’s temperature has reached a steady state.
Step Action
6 The following information is obtained directly from the graphical analysis of the
response curve, as shown in the figure below:
where
z S[i] = initial value of process variable = 260
z S[e] = ending value of process variable = 660
z S[63%] = process variable at 63% rise = S[i] + (S[e] - S[i]) x 63%
= 260+(660-260)x63%
= 512
z τ = time constant
= time elapsed from the start of the rise till S[63%] is reached
= 9 min 30 s = 570 s
Step Action
7 The sampling period (Ts) is determined using the following relationship:
Ts = τ /75
= 570/75 = 7.6 s (7600 ms)
8 In the Program > Scan mode edit dialog box, the Scan Period must be set so that
the sampling period (Ts) is an exact multiple of the scan period, as in the following
example: Scan Period = Ts/76 = 7600/76 = 100 ms (which satisfies the condition:
2 ms ≤Scan Period ≤150 ms.)
Trial-and-Error Method
The trial-and-error method consists in providing successive guesses of the sampling
period to the auto-tuning function until the auto-tuning algorithm converges
successfully towards Kp, Ti and Td that are deemed satisfactory by the user.
NOTE: Unlike the process response curve method, the trial-and-error method is not
based on any approximation law of the process response. However, it has the
advantage of converging towards a value of the sampling period that is in the same
order of magnitude as the actual value.
Top perform a trial-and-error estimation of the auto-tuning parameters, follow these
steps:
Step Action
1 Select the AT tab from the PID configuration window.
2 Set the Output limitation of AT to 10000.
3 Select the PID tab from the PID configuration window.
4 Provide the first or nth guess in the Sampling Period field.
Note: If you do not have any first indication of the possible range for the
sampling period, set this value to the minimum possible: 1 (1 unit of 10 ms).
5 Select PLC > Transfer PC => PLC... from menu bar to download the
application program to the Twido PLC.
6 Launch Auto-Tuning.
7 Select the Animation tab from the PID configuration screen.
8 Wait till the auto-tuning process ends.
Step Action
9 Two cases may occur:
z Auto-tuning completes successfully: You may continue to Step 9.
z Auto-tuning unsuccessfull: This means the current guess for the
sampling period (Ts) is not correct. Try a new Ts guess and repeat steps 3
through 8, as many times as required until the auto-tuning process
eventually converges.
Follow these guidelines to provide a new Ts guess:
z AT ends with the error message "The computed time constant is
negative!": This means the sampling period Ts is too large. You
should decrease the value of Ts to provide as new guess.
z AT ends with the error message "Sampling error!": This means the
sampling period Ts is too small. You should increase the value of Ts to
provide as new guess.
10 You may now view the PID control parameters (Kp, Ti and Td) in Animation tab,
and adjust them in the PID tab of the PID configuration screen, as needed.
Note: If the PID regulation provided by this set of control parameters does not
provide results that are totally satisfactory, you may still refine the trial-and-
error evaluation of the sampling period until you obtain the right set of Kp, Ti
and Td control parameters.
Autotuning error: the time The sampling period may be too For more details, refer to Limitations on Using the
constant is negative large. Auto-tuning and the PID Control (see page 639).
Autotuning error: error The AT algorithm is unstable (no Check the PID and AT parameters and make
calculating Kp convergence). adjustments that can improve convergence.
z Disturbances on the process Check also that there is no disturbance that could
while autotuning have affect the process variable.
caused a distortion of the Try to modify
process static gain z the ouput setpoint,
evaluation. z the sampling period.
z The process variable
Make sure there is no process disturbance while
transient response is not big autotuning is in progress.
enough for the autotuning to
determine the static gain.
z A combination of the above
possible causes may effect
on the process.
Autotuning error: time τ /θ > 20 PID regulation may no longer be stable.
constant over delay ratio > For more details, refer to Limitations on Using the
20 Auto-tuning and the PID Control (see page 639).
Autotuning error: time τ /θ < 2 PID regulation may no longer be stable.
constant over delay ratio < 2 For more details, refer to Limitations on Using the
Auto-tuning and the PID Control (see page 639).
Autotuning error: the limit for Computed value of static gain Measurement sensitivity of some application
Kp has been exceeded (Kp) is greater than 10000. variables may be too low. The application’s
measurement range must be rescaled within the [0-
10000] interval.
Autotuning error: the limit for Computed value of integral time Computational limit is reached.
Ti has been exceeded constant (Ti) is greater than
20000.
Autotuning error: the limit for Computed value of derivative Computational limit is reached.
Td has been exceeded time constant (Td) is greater
than 10000.
Introduction
Numerous methods to adjust the PID parameters exist, we suggest Ziegler and
Nichols which have two variants:
z closed loop adjustment,
z open loop adjustment.
Before implementing one of these methods, you must set the PID action direction:
z if an increase in the OUT output causes an increase in the PV measurement,
make the PID inverted (KP > 0),
z on the other hand, if this causes a PV reduction, make the PID direct (KP < 0).
According to the kind of (PID or PI) regulator, the adjustment of the coefficients is
executed with the following values:
- Kp Ti Td
PID Kpc/1,7 Tc/2 Tc/8
PI Kpc/2,22 0,83 x Tc -
The intersection point on the right hand side which is representative of the integrator
with the time axes, determines the time Tu. Next, Tg time is defined as the time
necessary for the controlled variable (measurement) to have the same variation size
(% of the scale) as the regulator output.
According to the kind of (PID or PI) regulator, the adjustment of the coefficients is
executed with the following values:
- Kp Ti Td
PID -1,2 Tg/Tu 2 x Tu 0,5 x Tu
PI -0,9 Tg/Tu 3,3 x Tu -
This adjustment method also provides a very dynamic command, which can express
itself through unwanted overshoots during the change of setpoints’ pulses. In this
case, lower the production value until you get the required behavior. The method is
interesting because it does not require any assumptions about the nature and the
order of the procedure. You can apply it just as well to the stable procedures as to
real integrating procedures. It is really interesting in the case of slow procedures
(glass industry,…) because the user only requires the beginning of the response to
regulate the coefficients Kp, Ti and Td.
where:
= model time constant,
= model delay,
The suitable PID process control is attained in the following domain: 2- -20
For <2, in other words for fast control loops (low ) or for processes with a large
delay (high t) the PID process control is no longer suitable. In such cases more
complex algorithms should be used.
Introduction
The PID control function onboard all Twido controllers provides an efficient control
to simple industrial processes that consist of one system stimulus (referred to as
Setpoint in this document) and one measurable property of the system (referred to
as Measure or Process Variable).
where
where:
z I = the integral action (acting independently and parallel to the derivative action),
z D = the derivative action (acting independently and parallel to the integral
action),
z P = the proportional action (acting serially on the combined output of the integral
and derivative actions,
z U = the PID controller output (later fed as input into the controlled process.)
where
z Kp = the controller proportional gain,
z Ti = the integral time constant,
z Td = the derivative time constant,
z Ts = the sampling period,
z ε(i) = the deviation (ε(i) = setpoint - process variable.)
NOTE: Two different computational algorithms are used, depending on the value of
the integral time constant (Ti):
z Ti ≠ 0: In this case, an incremental algortihm is used.
z Ti = 0: This is the case for non-integrating processes. In this case, a positional
algotrithm is used, along with a +5000 offset that is applied to the PID output
variable.
For a detailed description of Kp, Ti and Td please refer to PID Tab of PID function,
page 618.
As can be inferred from (equ.1) and (equ.1’), the key parameter for the PID
regulation is the sampling period (Ts). The sampling period depends closely on the
time constant (τ ), a parameter intrinsic to the process the PID aims to control. (See
Appendix 2: First-Order with Time Delay Model, page 656.)
Introduction
This section presents the first-order with time delay model used to describe a variety
of simple but nonetheless important industrial processes, including thermal
processes.
where
z k = the static gain,
z τ = the time constant,
z θ = the delay-time,
z U = the process input (this is the output of the PID controller),
z S = the process output.
The following figure shows a typical first-order process response to a step stimulus:
where
z k = the static gain computed as the ratio ΔS/ΔU,
z τ = the time at 63% rise = the time constant,
z 2τ = the time at 86% rise,
z 3τ = the time at 95% rise.
NOTE: When auto-tuning is implemented, the sampling period (Ts) must be chosen
in the following range: [τ /125 <Ts < τ /25]. Ideally, you should use [Ts= τ /75]. (See
PID Tuning with Auto-Tuning (AT), page 639.)
General
These instructions are used to perform an arithmetic operation between two
operands or on one operand.
Structure
Ladder Language
LD %I3.2
[%MF1:=SQRT(%MF10)]
LDR %I3.3
[%MF2:=ABS(%MF20)]
LDR %I3.5
[%MF8:=TRUNC(%MF2)]
Ladder Language
LD %I3.2
[%MF2:=LN(%MF20)]
LDR %I3.3
[%MF4:=EXP(%MF40)]
LDR %I3.4
[%MF6:=EXPT(%MF50,%MW52)]
Syntax
Operators and syntax of arithmetic instructions on floating point
Operators Syntax
+, - *, / Op1:=Op2 Operator Op3
SQRT, ABS, TRUNC, Op1:=Operator(Op2)
LOG, EXP, LN
EXPT Op1:=Operator (Op2,Op3)
E.g. in the case where the instruction %MF2:= %MF2 + %MF0 is repeated
indefinitely. If the initial conditions are %MF0 = 1.0 and %MF2 = 0, the value %MF2
becomes blocked at 16777216.
We therefore recommend you take great care when programming repeated
calculations. If, however, you wish to program this type of calculation, it is up to the
client application to manage truncation errors.
Operands of arithmetic instructions on floating point:
Rules of Use
z Operations on floating point and integer values can not be directly mixed.
Conversion operations (see page 667) convert into one or other of these
formats.)
z The system bit %S18 is managed in the same way as integer operations
(see page 500), the word %SW17 (see page 710) indicates the cause of the
detected fault.
z When the operand of the function is an invalid number (e.g. logarithm of a
negative number), it produces an indeterminate or infinite result and changes bit
%S18 to 1, the word %SW17 indicates the cause of the detected error.
NOTE: For the TRUNC instruction, the system bit %S17 is not affected.
Example Result
TRUNC (3.5) 3
TRUNC (324.18765) 324
TRUNC (927.8904) 927
*
Note: This example applies to the TRUNC instruction when used with %MDi. (When
used with %MFi, the TRUNC instruction has no overflow and therefore has no
maximum/minimum limits.)
Example Result
TRUNC (-7.7) -7
TRUNC (45.678E+20) 2 147 483 647 (maximum signed double word) *
%S18 is set to 1
TRUNC (-94.56E+13) - 2 147 483 648 (minimum signed double word)*
%S18 is set to 1
*
Note: This example applies to the TRUNC instruction when used with %MDi. (When
used with %MFi, the TRUNC instruction has no overflow and therefore has no
maximum/minimum limits.)
Trigonometric Instructions
General
These instructions enable the user to perform trigonometric operations.
COS cosine of an angle expressed in ACOS arc cosine (result within 0 and )
radian,
TAN tangent of an angle expressed ATAN
in radian, arc tangent (result within and )
Structure
Ladder language
LD %I3.2
[%MF2:=TAN(%MF10)]
LDR %I3.3
[%MF4:=ATAN(%MF20)]
Syntax
Operators, operands and syntax of instructions for trigonometric operations
Rules of use
z when the operand of the function is an invalid number (e.g.: arc cosine of a
number greater than 1), it produces an indeterminate or infinite result and
changes bit %S18 to 1, the word %SW17 (see page 710) indicates the cause of
the detected error.
z the functions SIN/COS/TAN allow as a parameter an angle between
and but their precision decreases progressively for the angles outside the
period and because of the imprecision brought by the modulo
carried out on the parameter before any operation.
Conversion instructions
General
These instructions are used to carry out conversion operations.
Structure
Ladder language
LD %M2
[%MF2:=RAD_TO_DEG(%MF20)]
Structured Text language
IF %M0 THEN
%MF0:=DEG_TO_RAD(%MF10);
END_IF;
IF %M2 THEN
%MF2:=RAD_TO_DEG(%MF20);
END_IF;
Syntax
Operators, operands and syntax of conversion instructions
Rules of use
The angle to be converted must be between -737280.0 and +737280.0 (for
DEG_TO_RAD conversions) or between and (for RAD_TO_DEG
conversions).
For values outside these ranges, the displayed result will be + 1.#QNAN, the %S18
and %SW17:X0 bits being set at 1.
General
Four conversion instructions are offered.
Integer conversion instructions list<-> floating:
Structure
Ladder language
LD I1.8
[%MD4:=REAL_TO_DINT(%MF9)]
Structured Text language
%MF0:=INT_TO_REAL(%MW10);
IF %I1.8 THEN
%MD4:=REAL_TO_DINT(%MF9);
END_IF;
Syntax
Operators and syntax (conversion of an integer word --> floating):
Operators Syntax
INT_TO_REAL Op1=INT_TO_REAL(Op2)
Operators Syntax
DINT_TO_REAL Op1=DINT_TO_REAL(Op2)
Operators Syntax
REAL_TO_INT Op1=Operator(Op2)
REAL_TO_DINT
Example:
floating conversion --> integer word: 5978.6 --> 5979
floating conversion --> integer double word: -1235978.6 --> -1235979
NOTE: If during a real to integer (or real to integer double word) conversion the
floating value is outside the limits of the word (or double word),bit %S18 is set to 1.
Precision of Rounding
Standard IEEE 754 defines 4 rounding modes for floating operations.
The mode employed by the instructions above is the "rounded to the nearest" mode:
"if the nearest representable values are at an equal distance from the theoretical
result, the value given will be the value whose low significance bit is equal to 0".
In certain cases, the result of the rounding can thus take a default value or an excess
value.
For example:
Rounding of the value 10.5 -> 10
Rounding of the value 11.5 -> 12
ROUND Instruction
Instruction Description
The ROUND instruction rounds a floating point representation that is stored in an
ASCII string.
Instruction Syntax
For the ROUND instruction, use the following syntax: Op1 := ROUND( Op2,Op3 ).
For example:
Instruction Parameters
The table below describes the ROUND function parameters:
Parameters Description
Op1 %MW in which result is stored
Op2 %MW containing the floating point to be rounded
Op3 Number of significant digits required in rounding
Integer between 1 and 8
Instruction Rules
The ROUND instruction rules are as follows:
z The operand is always rounded down.
z The end character of the operand string is used as an end character for the result
string.
z The end character can be any ASCII character that is not in the interval [’0’ - ’9’]
([16#30 - 16#39]), except for:
z dot ’.’ (16#2E),
z minus ’-’ (16#2D),
z plus ’+’ (16#2B),
z Exp ’e’ or ’E’ (16#65 or 16#45).
z The result and operand should not be longer than 13 Bytes: Maximum size of an
ASCII string is 13 Bytes.
z The scientific notation is not authorized.
Syntax Errors
TwidoSuite checks the syntax. The following examples would result in syntax errors:
Examples
The table below shows examples of ROUND instruction:
Example Result
ROUND ("987654321", 5) "987650000"
ROUND ("-11.1", 8) "-11.1"
ROUND ("NAN") "NAN"
Instruction Description
The ASCII to Integer conversion instruction converts an ASCII string into an Integer
value.
Instruction Syntax
For the ASCII to Integer conversion instruction, use the following syntax:
Op1 := ASCII_TO_INT( Op2 ).
For example:
Instruction Parameters
The table below describes the ASCII to Integer conversion function parameters:
Parameters Description
Op1 %MW in which result is stored
Op2 %MW or %KW
Conversion Rules
The ASCII to Integer instruction rules are as follows:
z OP2 must be included between -32768 to 32767.
z The function always reads the Most Significant Byte first.
z Any ASCII character that is not in the interval [’0’ - ’9’] ([16#30 - 16#39]) is
considered to be an end character, except for a minus sign ’-’ (16#2D )when it is
placed as the first character.
z In case of overflow (>32767 or <-32768), the system bit %S18 (arithmetic
overflow or error) is set to 1 and 32767 or -32768 value is returned.
z If the first character of the operand is an "end" character, the value 0 is returned
and the bit %S18 is set to 1.
z The scientific notation is not authorized.
Examples
Consider that the following ASCII data has been stored in %MW10 to %MW13:
Example Result
%MW20 := ASCII_TO_INT(%MW10) %MW20 = 29318
%MW20 := ASCII_TO_INT(%MW12) %MW20 = 8
%MW20 := ASCII_TO_INT(%MW13) %MW20 = 0 and %S18 is set to 1
Instruction Description
The Integer to ASCII conversion instruction converts an Integer into an ASCII string
value.
Instruction Syntax
For the Integer to ASCII conversion instruction, use the following syntax:
Op1 := INT_TO_ASCII( Op2 ).
For example:
Instruction Parameters
The table below describes the Integer to ASCII conversion function parameters:
Parameters Description
Op1 %MW in which result is stored
Op2 %MW, %KW, %SW, %IW, %QW or any WORD
(Immediate values are not accepted)
Conversion Rules
The Integer to ASCII conversion rules are as follows:
z Op2 must be included between -32768 to 32767.
z The function writes always the Most Significant Byte first.
z End character is "Enter" (ASCII 13).
z The function automatically determines how many %MWs should be filled with
ASCII values (from 1 to 4).
Syntax Errors
TwidoSuite checks the syntax. The following examples would result in syntax errors:
Examples
For the instruction MW10:4 := INT_TO_ASCII(%MW1):
If ... Then...
Integer value Hexadecimal value ASCII value
%MW10 = 16#3231 ‘2’, ‘1’
%MW1 = 123
%MW11 = 16#0D33 ‘3’
%MW10 = 16#3534 ‘5’, ‘4’
%MW1 = 45
%MW11 = 16#000D ‘Enter‘
%MW1 = 7 %MW10 = 16#0D37 ‘Enter’, ‘7’
%MW10 = 16#3145 ‘1’, ‘-’
%MW11 = 16#3332 ‘3’, ‘2’
%MW1 = -12369
%MW10 = 16#3936 ‘9’, ‘6’
%MW11 = 16#000D ‘Enter‘
Instruction Description
The ASCII to Float conversion instruction converts an ASCII string into a floating
point value.
Instruction Syntax
For the ASCII to Float conversion instruction, use the following syntax:
Op1 := ASCII_TO_FLOAT( Op2 ).
For example:
Instruction Parameters
The table below describes the ASCII to Float conversion function parameters:
Parameters Description
Op1 %MF
Op2 %MW or %KW
Conversion Rules
ASCII to Float conversion rules are as follows:
z The function always reads the Most Significant Byte first.
z Any ASCII character that is not in the interval [’0’ - ’9’] ([16#30 - 16#39]) is
considered to be "end" character, except for:
z dot ’.’ (16#2E),
z minus ’-’ (16#2D),
z plus ’+’ (16#2B),
z Exp ’e’ or ’E’ (16#65 or 16#45).
Examples
Consider that the following ASCII data has been stored in %MW10 to %MW14:
Example Result
%MW20 := ASCII_TO_FLOAT(%MW10) %MF20 = -826.5
%MW20 := ASCII_TO_FLOAT(%MW11) %MF20 = 1.#QNAN
%MW20 := ASCII_TO_FLOAT(%MW12) %MF20 = 6500.0
%MW20 := ASCII_TO_FLOAT(%MW13) %MF20 = 1.#QNAN
%MW20 := ASCII_TO_FLOAT(%MW14) %MF20 = 2.0
Instruction Description
The Float to ASCII conversion instruction converts a floating point value into an
ASCII string value.
Instruction Syntax
For the Float to ASCII conversion instruction, use the following syntax:
Op1 := FLOAT_TO_ASCII( Op2 ).
For example:
Conversion Parameters
The table below describes the Float to ASCII conversion function parameters:
Parameters Description
Op1 %MW
Op2 %MF or %KF
Conversion Rules
The Float to ASCII conversion rules are as follows:
z The function always writes the Most Significant Byte first,
z The representation is made using conventional scientific notation,
z "Infinite" or "Not A Number" results return the string "NAN",
z The end character is "Enter" (ASCII 13),
z The function automatically determines how many %MWs should be filled with
ASCII values,
z Conversion precision is 6 figures
z The scientific notation is not authorized.
Syntax Errors
TwidoSuite checks the syntax. The following examples would result in syntax errors:
Examples
For the instruction %MW10:7 := FLOAT_TO_ASCII(%MF1):
General
The SUM_ARR function adds together all the elements of an object table:
z if the table is made up of double words, the result is given in the form of a double
word
z if the table is made up of floating words, the result is given in the form of a floating
word
Structure
Ladder language
Syntax
Syntax of table summing instruction:
Res:=SUM_ARR(Tab)
NOTE: When the result is not within the valid double word format range according
to the table operand, the system bit %S18 is set to 1.
Example
%MD4:=SUM(%MD30:4)
where %MD30=10, %MD32=20, %MD34=30, %MD36=40
%MD4:=10+20+30+40
General
The EQUAL _ARR function carries out a comparison of two tables, element by
element.
If a difference is shown, the rank of the first dissimilar elements is returned in the
form of a word, otherwise the returned value is equal to -1.
The comparison is carried out on the whole table.
Structure
Ladder language
%MW15:=EQUAL_ARR(%MF0:5,%KF0:5)
Syntax
Syntax of table comparison instruction:
Res:=EQUAL_ARR(Tab1,Tab2)
NOTE:
z it is mandatory that the tables are of the same length and same type.
Example
%MW5:=EQUAL_ARR(%MD30:4,%KD0:4)
Comparison of 2 tables:
General
There are 3 search functions:
z FIND_EQR: searches for the position in a double or floating word table of the first
element which is equal to a given value
z FIND_GTR: searches for the position in a double or floating word table of the first
element which is greater than a given value
z FIND_LTR: searches for the position in a double or floating word table of the first
element which is less than a given value
The result of these instructions is equal to the rank of the first element which is found
or at -1 if the search is unsuccessful.
Structure
Ladder language
Syntax
Syntax of table search instructions:
Function Syntax
FIND_EQR Res:=Function(Tab,Val)
FIND_GTR
FIND_LTR
Example
%MW5:=FIND_EQR(%MD30:4,%KD0)
Search for the position of the first double word =%KD0=30 in the table:
General
There are 2 search functions:
z MAX_ARR: search for the maximum value in a double word and floating word
table
z MIN_ARR: search for the minimum value in a double word and floating word table
The result of these instructions is equal to the maximum value (or minimum) found
in the table.
Structure
Ladder language
Syntax
Syntax of table search instructions for max and min values:
Function Syntax
MAX_ARR Res:=Function(Tab)
MIN_ARR
General
This search function:
z OCCUR_ARR: searches in a double word or floating word table for a number of
elements equal to a given value
Structure
Ladder language
Syntax
Syntax of table search instructions for max and min values:
Function Syntax
OCCUR_ARR Res:=Function(Tab,Val)
General
There are 2 shift functions:
z ROL_ARR: performs a rotate shift of n positions from top to bottom of the
elements in a floating word table
Illustration of the ROL_ARR functions
Structure
Ladder language
Syntax
Syntax of rotate shift instructions in floating word or double word tables ROL_ARR
and ROR_ARR
Function Syntax
ROL_ARR Function(n,Tab)
ROR_ARR
Parameters of rotate shift instructions for floating word tables: ROL_ARR and
ROR_ARR:
General
The sort function available is as follows:
z SORT_ARR: performs sorts in ascending or descending order of the elements of
a double word or floating word table and stores the result in the same table.
Structure
Ladder language
Syntax
Syntax of table sort functions:
Function Syntax
SORT_ARR Function(direction,Tab)
z the "direction" parameter gives the order of the sort: direction > 0 the sort is done
in ascending order; direction < 0, the sort is done in descending order, direction
= 0 no sort is performed.
z the result (sorted table) is returned in the Tab parameter (table to sort).
Overview
The LKUP function is used to interpolate a set of X versus Y floating point data for
a given X value.
Interpolation Rule
The LKUP function makes use the linear interpolation rule, as defined in the
following equation:
(equation 1:)
for , where ;
NOTE: If any of two consecutive Xi values are equal (Xi=Xi+1=X), equation (1) yields
an invalid exception. In this case, to cope with this exception the following algorithm
is used in place of equation (1):
(equation 2:)
for , where .
Definition of Op1
Op1 is the memory word that contains the output variable of the interpolation
function.
Depending on the value of Op1, the user can know whether the interpolation was
successful or not, and what prevented success, as outlined in the following table:
Op1 Description
(%MWi)
0 Successful interpolation
1 Interpolation error: Bad array, Xm < Xm-1
2 Interpolation error: Op2 out of range, X < X1
4 Interpolation error: Op2 out of range, X > Xm
8 Invalid size of data array:
z Op3 is set as odd number, or
z Op3 < 6.
NOTE: Op1 does not contain the computed interpolation value (Y). For a given (X)
value, the result of the interpolation (Y) is contained in %MF2 of the Op3 array (See
Definition of Op3 below).
Definition of Op2
Op2 is the floating point variable (%MF0 of the Op3 floating point array) that
contains the user-defined (X) value for which to compute the interpolated (Y) value:
z Valid range for Op2 is as follows: .
Definition of Op3
Op3 sets the size (Op3 / 2) of the floating-point array where the (Xi,Yi) data pairs are
stored.
Xi and Yi data are stored in floating point objects with even indexes, starting at
%MF4 (note that %MF0 and %MF2 floating point objects are reserved for the user
set-point X and the interpolated value Y, respectively).
Given an array of (m) data pairs (Xi,Yi), the upper index (u) of the floating point array
(%MFu) is set by using the following relationships:
z (equation 3:) ;
z (equation 4:) .
The floating point array Op3 (%MFi) has a structure similar to that of the following
example (where Op3=8):
NOTE: As a result of the above floating-point array’s structure, Op3 must meet both
of the following requirements, or otherwise this will trigger a detected error of the
LKUP function:
z Op3 is an even number, and
z Op3 ≥ 6 (for there must be at least 2 data points to allow linear interpolation).
Structure
Interpolation operations are performed as follows:
Example
The following is an example use of a LKUP interpolation function:
[%MW20:=LKUP(%MF0,10)]
In this example:
z %MW20 is Op1 (the output variable).
z %MF0 is the user-defined (X) value which corresponding (Y) value must be
computed by linear interpolation.
z %MF2 stores the computed value (Y) resulting from the linear interpolation.
z 10 is Op3 (as given by equation 3 above). It sets the size of the floating point
array. The highest ranking item %MFu, where u=18 is given by equation 4,
above.
General
The MEAN function is used to calculate the mean average from a given number of
values in a floating point table.
Structure
Ladder Language
Syntax
Syntax of the floating point table mean calculation function:
Function Syntax
MEAN Result=Function(Op1)
Parameters of the calculation function for a given number L of values from a floating
point table:
19
Subject of this Chapter
This chapter provides an overview of the system bits and system words that can be
used to create control programs for Twido controllers.
Introduction
The following section provides detailed information about the function of system bits
and how they are controlled.
Detailed Description
The following table provides an overview of the system bits and how they are
controlled:
%S8 Wiring test Initially set to 1, this bit is used to test the wiring when 1 U
the controller is in "non-configured" state. To modify
the value of this bit, use the operations display keys to
make the required output status changes:
z Set to 1, output reset,
z Set to 0, wiring test authorized.
%S9 Reset outputs Normally set to 0. It can be set to 1 by the program or 0 U, SIM
by the terminal (in the Animation Table Editor):
z At state 1, outputs are forced to 0 when the
controller is in RUN mode,
z At state 0, outputs are updated normally.
%S24 (1) Operations Display Normally at 0, this bit can be set to 1 by the user. 0 U->S
z At state 0, the Operator Display is operating
normally,
z At state 1, the Operator Display is frozen, stays on
current display, blinking disabled, and input key
processing stopped.
(1)
This system bit is not available for the
Twido Extreme PLC (TWDLEDCK1).
%S25 (1) Choosing a display You can choose between two display modes on the 2- 0 U
mode on the operator line operator display: data mode and normal mode.
display z If %S25=0, then normal mode is enabled.
On the first line, you can write an object name (a
system word, a memory word, a system bit, etc.).
On the second line, you can read its value.
z If %S25=1, then data mode is enabled.
On the first line, you can display %SW68 value.
On the second line, you can display %SW69 value.
When %S25=1, the operator keyboard is disabled.
Note: Firmware version must be V3.0 or higher.
(1)
This system bit is not available for the
Twido Extreme PLC (TWDLEDCK1).
%S26 (1) Choosing a signed or You can choose between two value types: signed or 0 U
unsigned value on the unsigned.
operator display z If %S26=0, then signed value (-32768 to 32767)
display is enabled.
+/- signs appear at each start of line.
z If %S26=1, then unsigned value (0 to 65535)
display is enabled.
%S26 can only be used if %S25=1.
Note: Firmware version must be V3.0 or higher.
(1)
This system bit is not available for the
Twido Extreme PLC (TWDLEDCK1).
%S31 Event mask Normally at 1. 1 U->S, SIM
z Set to 0, events cannot be executed and are
queued.
z Set to 1, events can be executed,
This bit can be set to its initial state 1 by the user and
the system (on cold re-start).
%S33 Read or Write selection Normally at 0. 0 U->S, SIM
for Ethernet Server z Set to 0, the %SW33 to %SW38 contains the
configuration application Ethernet configuration (IP declared or
read/change IP assigned by BOOTP or automatic IP self
assigned).
z Set to 1, then the new configuration is given by
%SW33 to %SW38.
This bit can be set to its initial state 0 by the user and
the system (on cold re-start).Then, the Ethernet is
reset to apply the application configuration whatever
the current configuration is.
This bit can be set to 0 by the user and the system (on
cold re-start).
%S50 Updating the date and Normally on 0, this bit can be set to 1 or 0 by the 0 U->S, SIM
time using words program or the Operator Display.
%SW49 to %SW53 z Set to 0, the date and time can be read,
z Set to 1, the date and time can be updated.
%S59 Updating the date and Normally on 0, this bit can be set to 1 or 0 by the 0 U, SIM
time using word %SW59 program or the Operator Display.
z Set to 0, the system word %SW59 is not managed,
z Set to 1, the date and time are incremented or
decremented according to the rising edges on the
control bits set in %SW59.
%S66 (1) BAT LED display This system bit can be set by the user. It allows the 0 S or U->S
enable/disable user to turn on/off the BAT LED:
(only on controllers that z Set to 0, BAT LED is enabled (it is reset to 0 by the
support an external system at power-up),
battery: z Set to 1, BAT LED is disabled (LED remains off
TWDLC••40DRF even if there is a low external battery power or
controllers.) there is no external battery in the compartment).
(1)
This system bit is not available for the
Twido Extreme PLC (TWDLEDCK1).
%S69 (1) User STAT LED display Set to 0, STAT LED is off. 0 U, SIM
Set to 1, STAT LED is on.
(1)
This system bit is not available for the
Twido Extreme PLC (TWDLEDCK1).
%S75 (1) External battery status This system bit is set by the system. It indicates the 0 S
(only on controllers that external battery status and is readble by the user:
support an external z Set to 0, external battery is operating normally,
battery: z Set to 1, external battery power is low, or external
TWDLC••40DRF battery is absent from compartment.
controllers.) (1)
This system bit is not available for the
Twido Extreme PLC (TWDLEDCK1).
%S95 Restore memory words This bit can be set when memory words were 0 U, SIM
previously saved to the internal EEPROM. Upon
completion the system sets this bit back to 0 and the
number of memory words restored is set in %SW97
%S96 Backup program OK This bit can be read at any time (either by the program 0 S, SIM
or while adjusting), in particular after a cold start or a
warm restart.
z Set to 0, the backup program is invalid.
z Set to 1, the backup program is valid.
%S97 Save %MW OK This bit can be read at any time (either by the program 0 S, SIM
or while adjusting), in particular after a cold start or a
warm restart.
z Set to 0, save %MW is not OK.
z Set to 1, save %MW is OK.
NOTE: (1) This system bit is not available for the Twido Extreme PLC
(TWDLEDCK1).
Abbreviation Description
S Controlled by the system
U Controlled by the user
U->S Set to 1 by the user, reset to 0 by the system
S->U Set to 1 by the system, reset to 0 by the user
SIM Applied in TwidoSuite Simulator
Introduction
The following section provides detailed information about the function of the system
words and how they are controlled.
Detailed Description
The following table provides detailed information about the function of the system
words and how they are controlled:
z Bit [11]: Second serial port type*: (0 = EIA RS-232, 1 = EIA RS-485):
z Set to 0 = EIA RS-232
z Set to 1 = EIA RS-485
Note: * EEPROM cartridge and second serial port are not available for
Twido Extreme PLC (TWDLEDCK1).
%SW11 Software Contains the maximum value of the watchdog. The value (10 to 500 ms) U, SIM
watchdog value is defined by the configuration.
%SW20 to Provides status for For more details, refer to CANopen Slave Reserved Specific System S
%SW27 CANopen slave Words (see page 300).
modules with node
address 1 to 16.
%SW30 Last scan time Shows execution time of the last controller scan cycle (in ms). S, SIM
Note: This time corresponds to the time elapsed between the start
(acquisition of inputs) and the end (update of outputs) of a scan cycle.
%SW68 (1) Elements to be If %S25=1, then data display mode is enabled. The operator keyboard U
and displayed is disabled.
simultaneously %SW68 and %SW69 can be displayed on the 2-line operator display:
%SW69 (1)
on the 2-line z %SW68 value on the first line,
operator display z %SW69 value on the second line.
%SW82 (1) Expansion I/O Module 2 Status: Same definitions as %SW80 S, SIM
CANopen Master Module Status at Expansion Address 2: Same definitions as %SW81
(1)
This system word is not available for theTwido Extreme PLC (TWDLEDCK1).
%SW83 (1) Expansion I/O Module 3 Status: Same definitions as %SW80 S, SIM
CANopen Master Module Status at Expansion Address 3: Same definitions as %SW81
%SW84 (1) Expansion I/O Module 4 Status: Same definitions as %SW80 S, SIM
CANopen Master Module Status at Expansion Address 4: Same definitions as %SW81
%SW85 (1) Expansion I/O Module 5 Status: Same definitions as %SW80 S, SIM
CANopen Master Module Status at Expansion Address 5: Same definitions as %SW81
%SW86 (1) Expansion I/O Module 6 Status: Same definitions as %SW80 S, SIM
CANopen Master Module Status at Expansion Address 6: Same definitions as %SW81
%SW87 (1) Expansion I/O Module 7 Status: Same definitions as %SW80 S, SIM
CANopen Master Module Status at Expansion Address 7: Same definitions as %SW81
(1)
This system word is not available for theTwido Extreme PLC (TWDLEDCK1).
%SW94 Application’s In case of an application change, in terms of configuration or S, SIM
signature programming data, the signature (sum of all checksums) changes
consequently.
If %SW94=91F3 in hexadecimal, the application’s signature is 91F3 in
hexadecimal.
Note: Firmware version must be V2.5 or higher.
%SW97 Command or When saving memory words, this value represents the physical number S and U,
diagnostics for %MW to be saved to internal EEPROM. When restoring memory words, SIM
save/restore this value is updated with the number of memory words restored to
function RAM.
For the save operation, when this number is set to 0, memory words will
not be stored. The user must define the user logic program. Otherwise,
this program is set to 0 in the controller application, except in the
following case:
On cold start, this word is set to -1 if the internal Flash EEPROM has no
saved memory word %MW file. In the case of a cold start where the
internal Flash EEPROM contains a memory word %MW list, the value
of the number of saved memory words in the file must be set in this
system word %SW97.
z Baud rate:
z 0: 1200 bauds,
z 1: 2400 bauds,
z 2: 4800 bauds,
z 3: 9600 bauds,
z 4: 19200 bauds,
z 5: 38400 bauds.
z RTS/CTS:
z 0: disabled,
z 1: enabled.
z Parity:
z 00: none,
z 10: odd,
z 11: even.
z Stop bit:
z 0: 1 stop bit,
z 1: 2 stop bits.
z Data bits:
z 0: 7 data bits,
z 1: 8 data bits.
%SW114 Enable schedule Enables or disables operation of schedule blocks by the user S and U,
blocks program or operator display. SIM
Bit 0: 1 = enables schedule block #0
...
Bit 15: 1 = enables schedule block #15
Initially all schedule blocks are enabled.
If schedule blocks are configured the default value is FFFF
If no schedule blocks are configured the default value is 0.
NOTE: (1) This system word is not available for theTwido Extreme PLC
(TWDLEDCK1).
(2)
If a single expansion module is missing at power on, then all expansion module
bits are set to 1 (Detected Error).
Abbreviation Description
S Controlled by the system
U Controlled by the user
SIM Applied in TwidoSuite Simulator
Glossary
0-9
%
Prefix that identifies internal memory addresses in the controller that are used to
store the value of program variables, constants, I/O, and so on.
Addresses
Internal registers in the controller used to store values for program variables,
constants, I/O, and so on. Addresses are identified with a percentage symbol (%)
prefix. For example, %I0.1 specifies an address within the controller RAM memory
containing the value for input channel 1.
Analog potentiometer
An applied voltage that can be adjusted and converted into a discrete value for use
by an application.
Analyze program
A command that compiles a program and checks for program errors: syntax and
structure errors, symbols without corresponding addresses, resources used by the
program that are not available, and if the program does not fit in available controller
memory. Error Messages are displayed in the Program Errors Viewer.
Animation table
Table created within a language editor or an operating screen. When a PC is
connected to the controller, provides a view of controller variables and allows values
to be forced when debugging. Can be saved as a separate file with an extension of
.tat.
Application
A TwidoSuite application consists of a program, configuration data, symbols, and
documentation.
Application browser
A specialized window in the TwidoSuite that displays a graphical tree-like view of an
application. Provides for convenient configuration and viewing of an application.
Application file
Twido applications are stored as file type .twd.
ASCII
(American Standard Code for Information Interchange) Communication protocol for
representing alphanumeric characters, notably letters, figures and certain graphic
and control characters.
Auto load
A feature that is enabled and provides for the automatic transfer of an application
from a backup cartridge to the controller RAM in case of a lost or corrupted
application. At power up, the controller compares the application that is presently in
the controller RAM to the application in the optional backup memory cartridge (if
installed). If there is a difference, then the copy in the backup cartridge is copied to
the controller and the internal EEPROM. If the backup cartridge is not installed, then
the application in the internal EEPROM is copied to the controller.
Backup
A command that copies the application in controller RAM into both the controller
internal EEPROM and the optional backup memory cartridge (if installed).
BootP
A UDP/IP-based protocol (Bootstrap Protocol) which allows a booting host to
configure itself dynamically and without user supervision. BootP provides a means
to notify a host of its assigned IP address.
CAN
Controller Area Network: field bus originally developed for automobile applications
which is now used in many sectors, from industrial to tertiary.
CiA
CAN in Automation: international organization of users and manufacturers of CAN
products.
Client
A computer process requesting service from other computer processes.
COB
Communication OBject: transport unit on CAN bus. A COB is identified by a
unique identifier, which is coded on 11 bits, [0, 2047]. A COB contains a maximum
of 8 data bytes. The priority of a COB transmission is shown by its identifier - the
weaker the identifier, the more priority the associated COB has.
Coil
A ladder diagram element representing an output from the controller.
Comment lines
In List programs, comments can be entered on separate lines from instructions.
Comments lines do not have line numbers, and must be inserted within parenthesis
and asterisks such as: (*COMMENTS GO HERE*).
Comments
Comments are texts you enter to document the purpose of a program. For Ladder
programs, enter up to three lines of text in the Rung Header to describe the purpose
of the rung. Each line can consist of 1 to 64 characters. For List programs, enter text
on n unnumbered program line. Comments must be inserted within parenthesis and
asterisks such as: (*COMMENTS GO HERE*).
Compact controller
Type of Twido controller that provides a simple, all-in-one configuration with limited
expansion. Modular is the other type of Twido controller.
Configuration editor
Specialized TwidoSuite window used to manage hardware and software
configuration.
Constants
A configured value that cannot be modified by the program being executed.
Contact
A ladder diagram element representing an input to the controller.
Counter
A function block used to count events (up or down counting).
Cross references
Generation of a list of operands, symbols, line/rung numbers, and operators used in
an application to simplify creating and managing applications.
Data variable
See Variable.
Date/Clock functions
Allow control of events by month, day of month, and time of day. See Schedule
Blocks.
Default gateway
The IP address of the network or host to which all packets addressed to an unknown
network or host are sent. The default gateway is typically a router or other device.
Drum controller
A function block that operates similar to an electromechanical drum controller with
step changes associated with external events.
EDS
Electronic Data Sheet: description file for each CAN device (provided by the
manufacturers).
EEPROM
Electrically Erasable Programmable Read-Only Memory. Twido has an internal
EEPROM and an optional external EEPROM memory cartridge.
Erase
This command deletes the application in the controller, and has two options:
z To delete the contents of the controller RAM, the controller internal EEPROM,
and the installed optional backup cartridge.
z To delete the contents of the installed optional backup cartridge only.
Executive loader
A 32-Bit Windows application used for downloading a new Firmware Executive
program to a Twido controller.
Expansion bus
Expansion I/O Modules connect to the base controller using this bus.
Fast counters
A function block that provides for faster up/down counting than available with the
Counters function block. A Fast Counter can count up to a rate of 5 KHz.
FIFO
First In, First Out. A function block used for queue operations.
Firmware executive
The Firmware Executive is the operating system that executes your applications and
manages controller operation.
Forcing
Intentionally setting controller inputs and outputs to 0 or 1 values even if the actual
values are different. Used for debugging while animating a program.
Frame
A group of bits which form a discrete block of information. Frames contain network
control information or data. The size and composition of a frame is determined by
the network technology being used.
Framing types
Two common framing types are Ethernet II and IEEE 802.3.
Function block
A program unit of inputs and variables organized to calculate values for outputs
based on a defined function such as a timer or a counter.
Gateway
A device which connects networks with dissimilar network architectures and which
operates at the Application Layer. This term may refer to a router.
Grafcet
Grafcet is used to represent the functioning of a sequential operation in a structured
and graphic form.
This is an analytical method that divides any sequential control system into a series
of steps, with which actions, transitions, and conditions are associated.
Host
A node on a network.
Hub
A device which connects a series of flexible and centralized modules to create a
network.
Init state
The operating state of TwidoSuite that is displayed on the Status Bar when
TwidoSuite is started or does not have an open application.
Initialize
A command that sets all data values to initial states. The controller must be in Stop
or Error mode.
Instance
A unique object in a program that belongs to a specific type of function block. For
example, in the timer format %TMi, i is a number representing the instance.
Internet
The global interconnection of TCP/IP based computer communication networks.
IP
Internet Protocol. A common network layer protocol. IP is most often used with TCP.
IP Address
Internet Protocol Address. A 32-bit address assigned to hosts using TCP/IP.
Ladder editor
Specialized TwidoSuite window used to edit a Ladder program.
Ladder language
A program written in Ladder language is composed of graphical representation of
instructions of a controller program with symbols for contacts, coils, and blocks in a
series of rungs executed sequentially by a controller.
Latching input
Incoming pulses are captured and recorded for later examination by the application.
LIFO
Last In, First Out. A function block used for stack operations.
List editor
Simple program editor used to create and edit a List program.
MAC Address
Media Access Control address. The hardware address of a device. A MAC address
is assigned to an Ethernet TCP/IP module in the factory.
Master controller
A Twido controller configured to be the Master on a Remote Link network.
MBAP
Modbus Application Protocol
Memory cartridge
Optional Backup Memory Cartridges that can be used to backup and restore an
application (program and configuration data). There are two sizes available: 32 and
64 Kb.
Modbus
A master-slave communications protocol that allows one single master to request
responses from slaves.
Modular controller
Type of Twido controller that offers flexible configuration with expansion capabilities.
Compact is the other type of Twido controller.
Monitor state
The operating state of TwidoSuite that is displayed on the Status Bar when a PC is
connected to a controller in a non-write mode.
Network
Interconnected devices sharing a common data path and protocol for
communication.
Node
An addressable device on a communications network.
Offline operation
An operation mode of TwidoSuite when a PC is not connected to the controller and
the application in PC memory is not the same as the application in controller
memory. You create and develop an application in Offline operation.
Offline state
The operating state of TwidoSuite that is displayed on the Status Bar when a PC is
not connected to a controller.
Online operation
An operation mode of TwidoSuite when a PC is connected to the controller and the
application in PC memory is the same as the application in controller memory.
Online operation can be used to debug an application.
Online state
The operating state of TwidoSuite that is displayed on the Status Bar when a PC is
connected to the controller.
Operand
A number, address, or symbol representing a value that a program can manipulate
in an instruction.
Operating states
Indicates the TwidoSuite state. Displayed in the status bar. There are four operating
states: Initial, Offline, Online, and Monitor.
Operator
A symbol or code specifying the operation to be performed by an instruction.
Packet
The unit of data sent across a network.
PC
Personal Computer.
Peer controller
A Twido controller configured as a slave on a Remote Link network. An application
can be executed in the Peer Controller memory and the program can access both
local and expansion I/O data, but I/O data can not be passed to the Master
Controller. The program running in the Peer Controller passes information to the
Master Controller by using network words (%INW and %QNW).
PLC
Twido programmable controller. There are two types of controllers: Compact and
Modular.
PLS
Pulse Generation. A function block that generates a square wave with a 50% on and
50% off duty cycle.
Preferences
A dialog box with selectable options for setting up the List and Ladder program
editors.
Programmable controller
A Twido controller. There are two types of controllers: Compact and Modular.
Protection
Refers to two different types of application protection: password protection which
provides access control, and controller application protection which prevents all
reads and writes of the application program.
Protocol
Describes message formats and a set of rules used by two or more devices to
communicate using those formats.
PWM
Pulse Width Modulation. A function block that generates a rectangular wave with a
variable duty cycle that can be set by a program.
RAM
Random Access Memory. Twido applications are downloaded into internal volatile
RAM to be executed.
Real-time clock
An option that will keep the time even when the controller is not powered for a limited
amount of time.
Reflex output
In a counting mode, the very fast counter’s current value (%VFC.V) is measured
against its configured thresholds to determine the state of these dedicated outputs.
Registers
Special registers internal to the controller dedicated to LIFO/FIFO function blocks.
Remote controller
A Twido controller configured to communicate with a Master Controller on a Remote
Link network.
Remote link
High-speed master/slave bus designed to communicate a small amount of data
between a Master Controller and up to seven Remote Controllers (slaves). There
are two types of Remote Controllers that can be configured to transfer data to a
Master Controller: a Peer Controller that can transfer application data, or a Remote
I/O Controller that can transfer I/O data. A Remote link network can consist of a
mixture of both types.
Resource manager
A component of TwidoSuite that monitors the memory requirements of an
application during programming and configuring by tracking references to software
objects made by an application. An object is considered to be referenced by the
application if it is used as an operand in a list instruction or ladder rung. Displays
status information about the percentage of total memory used, and provides an
indication if memory is getting low. See Memory Usage Indicator.
Reversible instructions
A method of programming that allows instructions to be viewed alternately as List
instructions or Ladder rungs.
Router
A device that connects two or more sections of a network and allows information to
flow between them. A router examines every packet it receives and decides whether
to block the packet from the rest of the network or transmit it. The router will attempt
to send the packet through the network by the most efficient path.
RTC
See Real-Time Clock.
RTU
Remote Terminal Unit. A protocol using eight bits that is used for communicating
between a controller and a PC.
Run
A command that causes the controller to run an application program.
Rung
A rung is located between two potential bars in a grid and is composed of a group
of graphical elements joined to each other by horizontal and vertical links. The
maximum dimensions of a rung are seven rows and eleven columns.
Rung header
A panel that appears directly over a Ladder rung and can be used to document the
purpose of the rung.
Scan
A controller scans a program and essentially performs three basic functions. First, it
reads inputs and places these values in memory. Next, it executes the application
program one instruction at a time and stores results in memory. Finally, it uses the
results to update outputs.
Scan mode
Specifies how the controller scans a program. There are two types of scan modes:
Normal (Cyclic), the controller scans continuously, or Periodic, the controller scans
for a selected duration (range of 2 - 150 msec) before starting another scan.
Schedule blocks
A function block used to program Date and Time functions to control events.
Requires Real-Time Clock option.
Server
A computer process that provides services to clients. This term may also refer to the
computer process on which the service is based.
Step
A Grafcet step designates a state of sequential operation of automation.
Stop
A command that causes the controller to stop running an application program.
Subnet
A physical or logical network within an IP network, which shares a network address
with other portions of the network.
Subnet mask
A bit mask used to identify or determine which bits in an IP address correspond to
the network address and which bits correspond to the subnet portions of the
address. The subnet mask is the network address plus the bits reserved for
identifying the subnetwork.
Switch
A network device which connects two or more separate network segments and
allows traffic to be passed between them. A switch determines whether a frame
should be blocked or transmitted based on its destination address.
Symbol
A symbol is a string of a maximum of 32 alphanumeric characters, of which the first
character is alphabetic. It allows you to personalize a controller object to facilitate
the maintainability of the application.
Symbol table
A table of the symbols used in an application. Displayed in the Symbol Editor.
TCP
Transmission Control Protocol.
TCP/IP
A protocol suite consisting of the Transmission Control Protocol and the Internet
Protocol; the suite of communications protocols on which the Internet is based.
Threshold outputs
Coils that are controlled directly by the very fast counter (%VFC) according to the
settings established during configuration.
Timer
A function block used to select a time duration for controlling an event.
Twido
A line of Schneider Electric controllers consisting of two types of controllers
(Compact and Modular), Expansion Modules to add I/O points, and options such as
Real-Time Clock, communications, operator display, and backup memory
cartridges.
TwidoSuite
A 32-Bit Windows, graphical development software for configuring and
programming Twido controllers.
UDP
A communications protocol (User Datagram Protocol) that is the part of the TCP/IP
suite used by applications to transfer datagrams. UDP is also the part of TCP/IP
responsible for port addresses.
Unresolved symbol
A symbol without a variable address.
Variable
Memory unit that can be addressed and modified by a program.
Warm restart
A power-up by the controller after a power loss without changing the application.
Controller returns to the state which existed before the power loss and completes
the scan which was in progress. All of the application data is preserved. This feature
is only available on modular controllers.
Index
B
AC
Symbols %S120, 709
%S121, 709
Closed loop adjustment, 647
%S13, 703
-, 659
%S17, 703
*, 659
%S18, 703
/, 659
%S19, 703
%Ci, 480
%S20, 703
%DR, 539
%S21, 704
%FC, 545
%S22, 704
%INW, 40
%S23, 704
%MSG, 560
%S24, 704
%PLS, 536
%S25, 705
%PWM, 532
%S26, 705
%QNW, 40
%S31, 705
%S, 702
%S33, 705
%S0, 702
%S38, 706
%S0=1
%S39, 706
Twido Extreme, 213
%S4, 702
%S1, 702
%S5, 702
Twido Extreme, 213
%S50, 706
%S10, 703
%S51, 706
%S100, 707
%S52, 706
%S101, 708
%S59, 706
%S103, 708
%S6, 702
%S104, 708
%S66, 707
%S11, 703
%S69, 707
%S110, 708
%S7, 702
%S111, 708
%S75, 707
%S112, 708
%S8, 702
%S113, 709
%S9, 702
%S118, 709
Twido Extreme, 213
%S119, 709
%S95, 707
%S12, 703
J M
JMP, 515 MAX_ARR, 688
Jump Instructions, 515 MEAN, 699
Memory
32K cartridge, 55
K 64K cartridge, 58
key switch Structure, 50
input, 167 without cartridge, 53
Memory bits, 25
Memory words, 27
L message object
Labeling indexes, 330
Indexed, 46 summary, 330
Ladder diagrams MIN_ARR, 688
blocks, 404 Modbus
graphic elements, 407 communication, 70
introduction, 400 Communications, 114
OPEN and SHORT, 410 Configuring the port, 117
programming principles, 402 Hardware configuration, 114
Ladder List Rung, 420 master, 71
Ladder program slave, 71
reversing to List, 417 Software configuration, 116
Ladder rungs, 400 Standard requests, 130
LD, 455 modbus function code
LDF, 452, 455 read device identification, 138
LDN, 455 Modbus Link
LDR, 451, 455 Example 1, 122
Life guarding, 265 Example 2, 126
Life time, 265 Mode: Operational, 261
LIFO Mode: pre-operational, 261
introduction, 525 MPP, 433
operation, 527 MPS, 433
Link elements MRD, 433
graphic elements, 407 Multiply, 500
List instructions, 427
N OR Instruction, 461
OUT_BLK, 419
Network
Output tab
Addressing, 40
PID, 626
Node guarding, 265
overflow, 501
Non-reversible programming, 523
Overflow
NOP, 514
Index, 47
NOP Instruction, 514
Overview
NOT instruction, 465
PID, 599
Numerical instructions
Assignment, 493
shift, 505 P
Numerical processing
Parameters, 472
Overview, 492
Parentheses
modifiers, 431
O nesting, 431
using in programs, 430
Object tables, 43
passive analog input
Object validation, 24
Twido Extreme, 175
Objects
PG (parameter group), 313
words, 27
PGN
Bit objects, 25
request, 346
Double word, 30
PGN (parameter group number), 313
Floating point, 30
Physical layer, 256
Function blocks, 41
CAN bus line, 256
Structured, 43
PID
OCCUR_ARR, 689
Animation tab, 630
OPEN, 410
AT tab, 621
Open loop adjustment, 648
Configuration, 607
opening the %PLS configuration table
Debugging, 629
Twido Extreme, 196
General tab, 608, 613
opening the %PWM configuration table
Input tab, 616
Twido Extreme, 203
Output tab, 626
Operands, 426
Overview, 599
operating modes
PID tab, 618
Twido Extreme, 213
Trace tab, 633
Operation blocks, 405
PID characteristics, 603
operation blocks
PID tab
graphic element, 409
PID, 618
Operator Display
Pin outs
Controller ID and states, 383
Communications cable female connec-
Overview, 380
tor, 75
Real-Time correction, 394
Communications cable male connector,
Serial port settings, 392
75
System objects and variables, 385
Time of day clock, 393
PLS R
Twido Extreme, 191
R, 457
PLS function block
RAD_TO_DEG, 665
Twido Extreme, 192
REAL_TO_DINT, 667
Potentiometer, 144
REAL_TO_INT, 667
Programming
Real-Time correction factor, 394
documenting your program, 421
Receiving messages, 559
Programming advice, 412
Registers
Programming grid, 402
FIFO, 528
Programming languages
LIFO, 527
overview, 19
programming and configuring, 529
Programming Principles, 523
Remainder, 500
Proportional action, 650
remote link
Protocol
communication, 70
Modbus TCP/IP, 71
Remote Link
protocols, 70
Communications, 90
Pulse generation, 536
Example, 98
pulse generator output
Hardware configuration, 90
Twido Extreme, 191
Master controller configuration, 92
Pulse width modulation, 532
Remote controller configuration, 93
PWM function block
Remote controller scan synchronization,
Twido Extreme, 198
93
PWM hydraulic output
Remote I/O data access, 95
Twido Extreme, 206
Software configuration, 92
PWM hydraulic output configuration
RET, 517
Twido Extreme, 206
Reversibility
PWM input
guidelines, 419
Twido Extreme, 179
introduction, 417
PWM input addresses
Reversible programming, 523
Twido Extreme, 179
ROL_ARR, 690
PWM input configuration
ROR_ARR, 690
Twido Extreme, 179
RTC correction, 565
PWM Input Configuration Example
Rung Header, 403
Twido Extreme, 181
comments, 422
PWM output
Rungs
Twido Extreme, 197
unconditional, 419
PWM output addresses
Twido Extreme, 197, 206
PWM output configuration S
Twido Extreme, 197
S, 457
Shift bit register, 485
Q Shift instructions, 505
SHORT, 410
Queue, 525
SIN, 663
Single/double word conversion instructions,
203
operating modes, 213
passive analog input, 175
PLS, 191
PLS function blockj, 192
pulse generator output, 191
PWM function block, 198
PWM hydraulic output , 206
PWM hydraulic output configuration, 206
PWM input , 179
PWM input addresses, 179
PWM input configuration, 179
PWM Input Configuration Example, 181
PWM output , 197
PWM output addresses, 197, 206
PWM output configuration, 197
ramp, 209
TwidoSuite
Introduction, 18
U
Unconditional rungs, 419
V
Very fast counters function block (%VFC),
548
W
Word Objects, 521
Word objects
Addressing, 35
Function blocks, 41
Overview, 27
X
XOR, 463