Twido Programming Guide
Twido Programming Guide
Programming Guide
09/2007
35011386.02
www.telemecanique.com
2
Table of Contents
Safety Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
About the Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
ASCII Communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Modbus Communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Standard Modbus Requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Modbus Function Codes 23 (MB FC) - Read/Write Multiple registers . . . . . . . . 141
Modbus Function Codes 43/14 (MB FC) - Read Device Identification . . . . . . . 143
Transparent Ready Implementation Class (Twido Serial A05, Ethernet A15) . . 148
Chapter 6 Built-In Analog Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Analog potentiometer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
Analog Channel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
Chapter 7 Managing Analog Modules . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Analog Module Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Addressing Analog Inputs and Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Configuring Analog Inputs and Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Analog Module Status Information. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Example of Using Analog Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
Chapter 8 Twido Extreme Input/Output Configuration . . . . . . . . . . . . . 167
8.1 An Introduction to Twido Extreme Inputs and Outputs . . . . . . . . . . . . . . . . . . . 168
Twido Extreme Addressing Inputs/Outputs (I/O) . . . . . . . . . . . . . . . . . . . . . . . . 168
8.2 Twido Extreme Input Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
At a Glance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Twido Extreme Discrete Input Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
Twido Extreme Analog Input Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
Twido Extreme PWM Input Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Twido Extreme PWM Input Configuration Example. . . . . . . . . . . . . . . . . . . . . . 184
8.3 Twido Extreme Output Configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
At a Glance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
Twido Extreme Discrete Output Configuration. . . . . . . . . . . . . . . . . . . . . . . . . . 191
Twido Extreme Pulse (PLS) Generator Output Configuration . . . . . . . . . . . . . . 194
Twido Extreme PWM Output Configuration in Standard Mode . . . . . . . . . . . . . 201
Twido Extreme PWM Output Configuration in Hydraulic Mode . . . . . . . . . . . . . 210
Twido Extreme Hydraulic PWM Output Configuration Example . . . . . . . . . . . . 218
Chapter 9 Installing the AS-Interface V2 bus . . . . . . . . . . . . . . . . . . . . . 221
Presentation of the AS-Interface V2 Bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
General Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
Software Set up Principles. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
Description of the Configuration Screen for the AS-Interface Bus. . . . . . . . . . . 227
Configuration of the AS-Interface Bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
4
Description of the AS-Interface Window in Online Mode . . . . . . . . . . . . . . . . . 234
Modification of Slave Address. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
Updating the AS-Interface Bus Configuration in Online Mode . . . . . . . . . . . . . 239
Automatic Addressing of an AS-Interface V2 Slave . . . . . . . . . . . . . . . . . . . . . 243
How to insert a Slave Device into an Existing AS-Interface V2 Configuration . 244
Automatic Replacement of a Faulty AS-Interface V2 Slave . . . . . . . . . . . . . . . 245
Addressing I/Os Associated with Slave Devices Connected to the AS-Interface V2
Bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
Programming and Diagnostics for the AS-Interface V2 Bus . . . . . . . . . . . . . . . 247
AS-Interface V2 Bus Interface Module Operating Mode: . . . . . . . . . . . . . . . . . 252
Chapter 10 Installing and Configuring the CANopen Fieldbus . . . . . . . . 253
10.1 CANopen Fieldbus Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
At a Glance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
Hardware Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
Configuration Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
Declaration of a CANopen Master. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
CANopen Configuration Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
CANopen Network Slave Declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
CANopen Objects Mapping (Slaves). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
CANopen Objects Linking (Master). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
CANopen Objects Symbols. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Addressing PDOs of the CANopen master . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
Programming and diagnostics for the CANopen fieldbus . . . . . . . . . . . . . . . . . 298
CANopen Hot Swap for Twido Controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
Chapter 11 Installing and Configuring the CANJ1939 Fieldbus . . . . . . . 307
11.1 CANJ1939 Fieldbus Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
At a Glance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
CANJ1939 Knowledge Base . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
CANJ19139 Parameter Group Number and Suspect Parameter Number . . . . 311
CANJ1939 Identifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
Communication on a CANJ1939 Network. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
11.2 Implementing the CANJ1939 Bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
CANJ1939 Implementation Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
Hardware Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
CANJ1939 Configuration Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
CANJ1939 Configuration Dialog Boxes (Element, Network, Port) . . . . . . . . . . 320
5
Creating or Deleting CANJ1939 Transmit/Receive Objects . . . . . . . . . . . . . . . 323
Viewing CANJ1939 Transmit/Receive objects. . . . . . . . . . . . . . . . . . . . . . . . . . 329
CANJ1939 Broadcast Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
CANJ1939 Peer-to Peer Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
CANJ1939 Configuration in Expert Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
CANJ1939 Input/Output Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
Request a PGN Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
Chapter 12 Configuring the TwidoPort Ethernet Gateway . . . . . . . . . . . 343
12.1 Normal Configuration and Connection of TwidoPort . . . . . . . . . . . . . . . . . . . . . 345
Normal Configuration with TwidoSuite. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
BootP Configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
12.2 TwidoPort’s Telnet Configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354
Introducing Telnet Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
Telnet Main Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
IP/Ethernet Settings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
Serial Parameter Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
Configuring the Gateway . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
Security Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
Ethernet Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
Serial Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362
Saving the Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
Restoring Default Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
Upgrading the TwidoPort Firmware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
Forgot Your Password and/or IP Configuration? . . . . . . . . . . . . . . . . . . . . . . . . 367
12.3 Communication Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
Ethernet Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
Modbus/TCP Communications Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370
Locally Supported Modbus Function Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
Chapter 13 Operator Display Operation . . . . . . . . . . . . . . . . . . . . . . . . . . 373
Operator Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374
Controller Identification and State Information. . . . . . . . . . . . . . . . . . . . . . . . . . 377
System Objects and Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
Serial Port Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
Time of Day Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386
Real-Time Correction Factor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
6
Part III Description of Twido Languages . . . . . . . . . . . . . . . . . 389
Chapter 14 Ladder Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391
Introduction to Ladder Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392
Programming Principles for Ladder Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . 394
Ladder Diagram Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
Ladder Language Graphic Elements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399
Special Ladder Instructions OPEN and SHORT . . . . . . . . . . . . . . . . . . . . . . . . 402
Programming Advice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
Ladder/List Reversibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
Guidelines for Ladder/List Reversibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409
Program Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411
Chapter 15 Instruction List Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413
Overview of List Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414
Operation of List Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416
List Language Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417
Using Parentheses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
Stack Instructions (MPS, MRD, MPP). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
Chapter 16 Grafcet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425
Description of Grafcet Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426
Description of Grafcet Program Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431
Actions Associated with Grafcet Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434
7
Shift Bit Register Function Block (%SBRi). . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471
Step Counter Function Block (%SCi). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473
17.3 Numerical Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475
Introduction to Numerical Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476
Assignment Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477
Comparison Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482
Arithmetic Instructions on Integers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484
Logic Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488
Shift Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489
Conversion Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491
Single/Double Word Conversion Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . 493
17.4 Program Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494
END Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495
NOP Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497
Jump Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498
Subroutine Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499
Chapter 18 Advanced Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501
18.1 Advanced Function Blocks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 502
Bit and Word Objects Associated with Advanced Function Blocks . . . . . . . . . . 503
Programming Principles for Advanced Function Blocks . . . . . . . . . . . . . . . . . . 505
LIFO/FIFO Register Function Block (%Ri). . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508
LIFO Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509
FIFO Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510
Programming and Configuring Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511
Pulse Width Modulation Function Block (%PWM) . . . . . . . . . . . . . . . . . . . . . . . 513
Pulse Generator Output Function Block (%PLS) . . . . . . . . . . . . . . . . . . . . . . . . 516
Drum Controller Function Block (%DR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519
Drum Controller Function Block %DRi Operation . . . . . . . . . . . . . . . . . . . . . . . 520
Programming and Configuring Drum Controllers. . . . . . . . . . . . . . . . . . . . . . . . 522
Fast Counter Function Block (%FC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524
Very Fast Counter Function Block (%VFC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527
Transmitting/Receiving Messages - the Exchange Instruction (EXCH). . . . . . . 538
Exchange Control Function Block (%MSGx) . . . . . . . . . . . . . . . . . . . . . . . . . . . 539
18.2 Clock Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542
Clock Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543
Schedule Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 544
Time/Date Stamping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546
Setting the Date and Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 548
18.3 Twido PID Quick Start Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 551
Purpose of Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552
Step 1 - Configuration of Analog Channels Used for Control . . . . . . . . . . . . . . 554
Step 2 - Prerequisites for PID Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . 556
Step 3 – Configuring the PID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558
Step 4 - Initialization of Control Set-Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564
Step 5 - Control Set-Up AT + PID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569
Step 6 - Debugging Adjustments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573
8
18.4 PID Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 575
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 576
Principal of the Regulation Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 577
Development Methodology of a Regulation Application . . . . . . . . . . . . . . . . . . 578
Compatibilities and Performances. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579
Detailed Characteristics of the PID Function. . . . . . . . . . . . . . . . . . . . . . . . . . . 580
How to Access the PID Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 583
PID Screen Elements of PID Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584
General Tab of PID function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 588
Input Tab of the PID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591
PID Tab of PID function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593
AT Tab of PID Function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595
Output Tab of the PID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 600
How to Access PID Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603
Animation Tab of PID Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604
Trace Screen of PID Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 606
PID States and Errors Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608
PID Tuning with Auto-Tuning (AT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612
PID Parameter Adjustment Method. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 620
Role and Influence of PID Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 622
Appendix 1: PID Theory Fundamentals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 626
Appendix 2: First-Order with Time Delay Model . . . . . . . . . . . . . . . . . . . . . . . . 628
18.5 Floating point instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 630
Arithmetic Instructions on Floating Point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 631
Trigonometric Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 634
Conversion instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 636
Integer Conversion Instructions <-> Floating . . . . . . . . . . . . . . . . . . . . . . . . . . 638
18.6 ASCII instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641
ROUND Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 642
ASCII to Integer Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 644
Integer to ASCII Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 646
ASCII to Float Conversion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 648
Float to ASCII Conversion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 650
18.7 Instructions on Object Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 652
Table Summing Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 653
Table Comparison Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 654
Table Search Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 656
Table Search Functions for Maximum and Minimum Values . . . . . . . . . . . . . . 658
Number of Occurrences of a Value in a Table . . . . . . . . . . . . . . . . . . . . . . . . . 659
Table Rotate Shift Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 660
Table Sort Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 662
Floating Point Table interpolation Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 663
Mean Function of the Values of a Floating Point Table . . . . . . . . . . . . . . . . . . 667
9
Chapter 19 System Bits and System Words . . . . . . . . . . . . . . . . . . . . . . . 669
System Bits (%S) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 670
System Words (%SW) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 677
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 693
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 705
10
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.
DANGER
DANGER indicates an imminently hazardous situation, which, if not avoided, will
result in death or serious injury.
WARNING
WARNING indicates a potentially hazardous situation, which, if not avoided, can result
in death, serious injury, or equipment damage.
CAUTION
CAUTION indicates a potentially hazardous situation, which, if not avoided, can result
in injury or equipment damage.
35011386 09/2007 11
Safety Information
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. This document is not intended
as an instruction manual for untrained persons. Assembly and installation
instructions are provided in the Twido Programmable Controllers Hardware Guide
(Modular and Compact Bases, Twido Extreme Bases, Discrete I/O Modules, Analog
I/O Modules or Communication Modules, as appropriate.)
© 2007 Schneider Electric All Rights Reserved
Additional Safety Those responsible for the application, implementation or use of this product must
Information ensure that the necessary design considerations have been incorporated into each
application, completely adhering to applicable laws, performance and safety
requirements, regulations, codes and standards.
12 35011386 09/2007
Safety Information
General
Warnings and
Cautions DANGER
HAZARD
Turn off all power before starting installation, removal, wiring, maintenance or
inspection of the smart relay system.
Failure to follow these instructions will result in death or serious injury.
WARNING
HAZARD OF ELECTRIC SHOCK, BURN OR EXPLOSION
! Substitution of components may impair suitability for Class I, Div 2 compliance.
! Do not disconnect equipment unless power has been switched off or the area
is known to be non-hazardous.
Failure to follow these instructions can result in death, serious injury, or
equipment damage.
WARNING
UNINTENDED EQUIPMENT OPERATION
! Turn power off before installing, removing, wiring, or maintaining.
! This product is not intended for use in safety critical machine functions. Where
personnel and or equipment hazards exist, use appropriate safety interlocks.
! Do not disassemble, repair, or modify the modules.
! This controller is designed for use within an enclosure.
! Install the modules in the operating environment conditions described.
! Use the sensor power supply only for supplying power to sensors connected to
the module.
! For power line and output circuits, use a fuse designed to Type T standards per
IEC60127. The fuse must meet the circuit voltage and current requirements.
Recommended: Littelfuse® 218 Series, 5x20mm time lag (slow blow) fuses.
Failure to follow these instructions can result in death, serious injury, or
equipment damage.
35011386 09/2007 13
Safety Information
Safe Battery The TWDLCA•40DRF compact bases use an optional external lithium battery for
Disposal longer duration of data backup. (Note: The lithium battery is not supplied with the
compact bases; you must purchase it separately.)
WARNING
EXPLOSION AND TOXIC HAZARD
! Do not incinerate a lithium battery for it may explode and release toxic
substances.
! Do not handle damaged or leaking lithium battery.
! Dead batteries shall be disposed of properly, for improper disposal of unused
batteries can cause harm, as well as environmental damage.
! In some areas, the disposal of lithium batteries with household or business trash
collection may be prohibited. In any case, it is your responsibility to always
conform to local regulations in your area, as regard to battery disposal.
Failure to follow these instructions can result in death, serious injury, or
equipment damage.
14 35011386 09/2007
Safety Information
CAUTION
RISK OF REVERSE-POLARITY DAMAGE AT TRANSISTOR OUTPUTS
! Make sure to conform to the polarity markings on the transistor output terminals.
! Use of a reverse polarity can permanently damage or destroy the output
circuits.
Failure to follow these instructions can result in injury or equipment damage.
35011386 09/2007 15
Safety Information
16 35011386 09/2007
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:
! Description of the Twido programming software and an introduction to the
fundamentals needed to program Twido controllers.
! Description of communications, managing analog I/O, installing the AS-Interface
bus interface module, the CANopen fieldbus master module and other special
functions.
! Description of the software languages used to create Twido programs.
! Description of instructions and functions of Twido controllers.
Validity Note The information in this manual is applicable only for Twido programmable
controllers.
The data and illustrations found in this book are not binding. We reserve the right to
modify our products in line with our policy of continuous product development. The
information in this document is subject to change without notice and should not be
construed as a commitment by Schneider Electric.
35011386 09/2007 17
About the Book
Product Related Schneider Electric assumes no responsibility for any errors that may appear in this
Warnings document. 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.
Copyright © Schneider Electric 2007. All rights reserved.
All pertinent state, regional, and local safety regulations must be observed when
installing and using this product. For reasons of safety and to ensure compliance
with documented system data, only the manufacturer should perform repairs to
components.
When controllers are used for applications with technical safety requirements,
please follow the relevant instructions.
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 product related warning can result in injury or equipment
damage.
User Comments We welcome your comments about this document. You can reach us by e-mail at
techpub@schneider-electric.com
18 35011386 09/2007
Description of Twido Software
I
At a Glance
Subject of this This part provides an introduction to the software languages and the basic
Part information required to create control programs for Twido programmable controllers.
35011386 09/2007 19
Twido Software
20 35011386 09/2007
Introduction to TwidoSuite
1
At a Glance
Subject of this This chapter provides a brief introduction to TwidoSuite, the programming and
Chapter configuration software for Twido controllers, and to the List, Ladder, and Grafcet
programming languages.
35011386 09/2007 21
TwidoSuite Languages
Introduction to TwidoSuite
Note: The Controller-PC link uses the TCP/IP protocol. It is essential for this
protocol to be installed on the PC.
22 35011386 09/2007
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 The following languages can be used to create Twido control programs:
Languages ! Instruction List Language:
An Instruction List program is a series of logical expressions written as a
sequence of Boolean instructions.
! Ladder Diagrams:
A Ladder diagram is a graphical means of displaying a logical expression.
! 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.
Instruction List A program written in Instruction List language consists of a series of instructions
Language executed sequentially by the controller. The following is an example of a List program.
0 BLK %C8
1 LDF %I0.1
2 R
3 LD %I0.2
4 AND %M0
5 CU
6 OUT_BLK
7 LD D
8 AND %M1
9 ST %Q0.4
10 END_BLK
35011386 09/2007 23
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.
%I0.1 %C8
N R E
%M1 %Q0.4
S ADJ Y D
%C8.P 777
%I0.2 %M0
CU F
CD
24 35011386 09/2007
TwidoSuite Languages
Grafcet The Grafcet analytical method divides any sequential control system into a series of steps,
Language with which actions, transitions, and conditions are associated. The following illustration shows
examples of Grafcet instructions in List and Ladder programs respectively.
0 -*- 3
1 LD %M10
2 # 4
3 # 5
4 -*- 4
5 LD %I0.7
6 # 6
7 -*- 5
8 LD %M15
9 # 7
10 ...
--*-- 3
%M10 4
--*-- 4
%I0.7 6
--*-- 5
%M15 7
35011386 09/2007 25
TwidoSuite Languages
26 35011386 09/2007
Twido Language Objects
2
At a Glance
Subject of this This chapter provides details about the language objects used for programming
Chapter Twido controllers.
35011386 09/2007 27
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.
28 35011386 09/2007
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:
! I/O bits
! Internal bits (memory bits)
! System bits
! Step bits
! Bits extracted from words
35011386 09/2007 29
Twido Language Objects
List of Operand The following table lists and describes all of the main bit objects that are used as
Bits operands in Boolean instructions.
Type Description Address or Maximum number Write
value access (1)
Immediate 0 or 1 (False or True) 0 or 1 - -
values
Inputs These bits are the "logical images" of the electrical %Ix.y.z (2) Note (3) No
Outputs states of the I/O. They are stored in data memory %Qx.y.z (2) Yes
and updated during each scan of the program logic.
AS-Interface These bits are the "logical images" of the electrical Note (4)
Inputs states of the I/O. They are stored in data memory %IAx.y.z No
Outputs and updated during each scan of the program logic. %QAx.y.z Yes
Internal Internal bits are internal memory areas used to store %Mi 128 TWDLC•A10DRF, Yes
(Memory) intermediary values while a program is running. TWDLC•A16DRF
Note: Unused I/O bits can not be used as 256 All other controllers
internal bits.
System System bits %S0 to %S127 monitor the %Si 128 According to i
correct operation of the controller and the
correct running of the application program.
Function The function block bits correspond to the %TMi.Q, Note (3) No (5)
blocks outputs of the function blocks. %Ci.P, and
These outputs may be either directly so on.
connected or used as an object.
Reversible Function blocks programmed using E, D, F, Q, Note (3) No
function reversible programming instructions BLK, TH0, TH1
blocks OUT_BLK, and END_BLK.
Word One of the 16 bits in some words can be Variable Variable Variable
extracts extracted as operand bits.
Grafcet Bits %X1 to %Xi are associated with Grafcet %Xi 62 TWDLC•A10DRF, Yes
steps steps. Step bit Xi is set to 1 when the TWDLC•A16 DRF
corresponding step is active, and set to 0 96 TWDLC•A24DRF,
when the step is deactivated. TWDLCA•40DRF and
Modular controllers
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 p. 246.)
5. Except for %SBRi.j and %SCi.j, these bits can be read and written.
30 35011386 09/2007
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:
! Immediate values
! Internal words (%MWi) (memory words)
! Constant words (%KWi)
! I/O exchange words (%IWi, %QWi%)
! AS-Interface analog I/O words (IWAi, %QWAi)
! System words (%SWi)
! 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:
Bit position
F E D C B A 9 8 7 6 5 4 3 2 1 0
0 1 0 1 0 0 1 0 0 1 0 0 1 1 0 1 Bit state
16384
8192
4096
2048
1024
512
256
128
Bit value
64
32
16
|+
8
4
2
1
In signed binary notation, bit 15 is allocated by convention to the sign of the coded value:
! Bit 15 is set to 0: the content of the word is a positive value.
! 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:
! Decimal
Min.: -32768, Max.: 32767 (1579, for example)
! Hexadecimal
Min.: 16#0000, Max.: 16#FFFF (for example, 16#A536)
Alternate syntax: #A536
! ASCII format rules as follows:
! The function always reads the Most Significant Byte first.
! 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.
! 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.
! If the first character of the operand is an "end" character, the value 0 is
returned and the bit %S18 is set to 1.
for example, "HELLO":
! %MW0 := "HE"
! %MW1 := "LL"
! %MW2 := "O "
35011386 09/2007 31
Twido Language Objects
32 35011386 09/2007
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 p. 246.)
3. Number is determined by the configuration.
35011386 09/2007 33
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.
Floating Point The floating format used is the standard IEEE STD 734-1985 (equivalent IEC 559). The length
Format and of the words is 32 bits, which corresponds to the single decimal point floating numbers.
Value Table showing the format of a floating point value:
Bit 31 Bits {30...23} Bits {22...0}
S Exponent Fractional part
The value as expressed in the above format is determined by the following equation:
S ! Exposant – 127 "
32-bit Floating Value = ! – 1 " * 2 * 1.Fractional part
Floating values can be represented with or without an exponent; but they must
always have a decimal point (floating point).
Floating values range from -3.402824e+38 to -1.175494e-38 and 1.175494e-38 to
3.402824e+38 (grayed values on the diagram). They also have the value 0, written 0.0
.
Note:
! the value "1285" is interpreted as a whole value; in order for it to be recognized
as a floating point value, it must be written thus: "1285.0"
34 35011386 09/2007
Twido Language Objects
Limit range of The following table describes the limit range of arithmetic functions on floating point objects
Arithmetic
Arithmetic Funtion Limit range and invalid operations
Functions on
Floating Point Type Syntax #QNAN (Invalid) #INF (Infinite)
Square root of an operand SQRT(x) x<0 x > 1.7E38
Power of an integer by a real EXPT(y, x) x<0 y.ln(x) > 88
EXPT(%MF,%MW) (where:
x^y = %MW^%MF)
Base 10 logarithm LOG(x) x <= 0 x > 2.4E38
Natural logarithm LN(x) x <= 0 x > 1.65E38
Natural exponential EXP(x) x<0 x > 88.0
Hardware Floating point and double word operations are not supported by all Twido controllers.
compatibility The following table shows hardware compatibility:
Twido controller Double words supported Floating points supported
TWDLMDA40DUK Yes Yes
TWDLMDA40DTK Yes Yes
TWDLMDA20DUK Yes No
TWDLMDA20DTK Yes No
TWDLMDA20DRT Yes Yes
TWDLC••40DRF Yes Yes
TWDLC•A24DRF Yes No
TWDLC•A16DRF Yes No
TWDLC•A10DRF No No
35011386 09/2007 35
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 an error in a floating operation:
Different bits of the word %SW17:
%SW17:X0 Invalid operation, result is not a number (1.#NAN or -1.#NAN)
%SW17:X1 Reserved
%SW17:X2 Divided by 0, result is infinite (-1.#INF or 1.#INF)
%SW17:X3 Result greater in absolute value than +3.402824e+38, result is infinite (-1.#INF or 1.#INF)
%SW17:X4 to X15 Reserved
This word is reset to 0 by the system on cold start, and also by the program for re-
usage purposes.
Description of The following table describes floating point and double word objects:
Floating Point
and Double Word
Objects
Type of object Description Address Maximum Write Indexed form
number access
Immediate values Integers (double word) or decimal - [-] No -
(floating point) numbers with
identical format to 32 bit objects.
Internal floating point Objects used to store values during %MFi 1500 Yes (ODM/T) %MFi[index]
Internal double word operation in data memory. %MDi 1500 Yes (ODM/T) %MDi[index]
Floating constant value Used to store constants. %KFi 128 Yes, (T) %KFi[index]
Double constant %KDi 128 Yes, (T) %KDi[index]
Note: 1. ODM: Write access using the Operator Display Module (see p. 373)
2. T: Write access using TwidoSuite
36 35011386 09/2007
Twido Language Objects
Possibility of Single, double length and floating words are stored in the data space in one memory
Overlap between zone. Thus, the floating word %MFi and the double word %MDi correspond to the
Objects single length words %MWi and %MWi+1 (the word %MWi containing the least
significant bits and the word %MWi+1 the most significant bits of the word %MFi).
The following table shows how floating and double internal words overlap:
Floating and Double Odd address Internal words
%MF0 / %MD0 %MW0
%MF1 / %MD1 %MW1
%MF2 / %MD2 %MW2
%MF3 / %MD3 %MW3
%MF4 / %MD4 %MW4
... %MW5
... ...
%MFi / %MDi %MWi
%MFi+1 / %MDi+1 %MWi+1
The following table shows how floating and double constants overlap:
Floating and Double Odd address Internal words
%KF0 / %KD0 %KW0
%KF1 / %KD1 %KW1
%KF2 / %KD2 %KW2
%KF3 / %KD3 %KW3
%KF4 / %KD4 %KW4
... %KW5
... ...
%kFi / %kDi %KWi
%KFi+1 / %KDi+1 %KWi+1
Example:
%MF0 corresponds to %MW0 and %MW1. %KF543 corresponds to %KW543 and %KW544.
35011386 09/2007 37
Twido Language Objects
Syntax Use the following format to address internal, system, and step bit objects:
% M, S, or X i
Description The following table describes the elements in the addressing format.
Group Item Description
Symbol % The percent symbol always precedes a software variable.
Type of M Internal bits store intermediary values while a program is
object running.
S System bits provide status and control information for the
controller.
X Step bits provide status of step activities.
Number i The maximum number value depends on the number of objects
configured.
Bit Objects TwidoSuite is used to extract one of the 16 bits from words. The address of the word
Extracted from is then completed by the bit row extracted according to the following syntax:
Words k
WORD :X
Examples:
! %MW5:X6 = bit number 6 of internal word %MW5
! %QW5.1:X10 = bit number 10 of output word %QW5.1
38 35011386 09/2007
Twido Language Objects
Introduction Addressing word objects, except for input/output addressing (see p. 42) and
function blocks (see p. 45), follows the format described below.
Syntax Use the following format to address internal, constant and system words:
% M, K or S W i
Description The following table describes the elements in the addressing format.
Group Item Description
Symbol % The percent symbol always precedes an internal address.
Type of object M Internal words store intermediary values while a program is running.
K Constant words store constant values or alphanumeric messages.
Their content can only be written or modified by using TwidoSuite.
S System words provide status and control information for the controller.
Syntax W 16-bit word.
Number i The maximum number value depends on the number of objects configured.
35011386 09/2007 39
Twido Language Objects
Introduction Addressing floating objects, except for input/output addressing (see p. 42) and function
blocks (see p. 45), follows the format described below.
Syntax Use the following format to address internal and constant floating objects:
% M or K F i
Description The following table describes the elements in the addressing format.
Group Item Description
Symbol % The percent symbol always precedes an internal address.
Type of M Internal floating objects store intermediary values while a program is running.
object K Floating constants are used to store constant values. Their content can only
be written or modified by using TwidoSuite.
40 35011386 09/2007
Twido Language Objects
Introduction Addressing double word objects, except for input/output addressing (see p. 42) and
function blocks (see p. 45), follows the format described below.
Syntax Use the following format to address internal and constant double words:
% M or K D i
Description The following table describes the elements in the addressing format.
Group Item Description
Symbol % The percent symbol always precedes an internal address.
Type of M Internal double words are used to store intermediary values while a
object program is running.
K Constant double words store constant values or alphanumeric messages.
Their content can only be written or modified by using TwidoSuite.
Syntax D 32 bit double word.
Number i The maximum number value depends on the number of objects
configured.
35011386 09/2007 41
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:
! Controller configured as Remote Link Master
! Controller configured as Remote I/O
! 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:
! For TWDNOI10M3, see p. 246.
! For TWDNCO1M, see p. 296.
Multiple In a program, you can have multiple references to a single output or coil. Only the
References to an result of the last one solved is updated on the hardware outputs. For example,
Output or Coil %Q0.0.0 can be used more than once in a program, and there will not be a warning
for multiple occurrences. So it is important to confirm only the equation that will give
the required status of the output.
CAUTION
UNINTENDED OPERATION
No duplicate output checking or warnings are provided. Review the use of the
outputs or coils before making changes to them in your application.
Failure to follow this instruction can result in injury or equipment damage.
42 35011386 09/2007
Twido Language Objects
35011386 09/2007 43
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
p. 69 for more details.
44 35011386 09/2007
Twido Language Objects
Introduction Function blocks provide bit objects and specific words that can be accessed by the program.
S D
ADJ Y
%Ci.P 9999
CU
CD F
Bit Objects Bit objects correspond to the block outputs. These bits can be accessed by Boolean
test instructions using either of the following methods:
! Directly (for example, LD E) if they are wired to the block in reversible
programming (see p. 457).
! 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:
! 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).
! Current values: for example, %Ci.V, the current count value.
35011386 09/2007 45
Twido Language Objects
Double word Double word objects increase the computational capability of your Twido controller
Objects while executing system functions, such as fast counters (%FC), very fast counters
(%VFC) and pulse generators (%PLS).
Addressing of 32-bit double word objects used with function blocks simply consists
in appending the original syntax of the standard word objects with the "D" character.
The following example, shows how to address the current value of a fast counter in
standard format and in double word format:
! %FCi.V is current value of the fast counter in standard format.
! %FCi.VD is the current value of the fast counter in double word format.
Note: Double word objects are not supported by all Twido controllers. Refer to
p. 35 to find out if your Twido controller can accommodate double words.
Objects See the following appropriate sections for a list of objects that are accessible by the program.
Accessible by ! For Basic Function Blocks, see p. 455.
the Program ! For Advanced Function Blocks, see p. 503.
46 35011386 09/2007
Twido Language Objects
Structured Objects
Introduction Structured objects are combinations of adjacent objects. Twido supports the
following types of structured objects:
! Bit Strings
! Tables of words
! Tables of double words
! 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
%M8 %M9 %M10 %M11 %M12 %M13
Bit strings can be used with the Assignment instruction (see p. 477).
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.
2. Maximum of i+L for TWWDLCAA10DRF and TWDLCAA16DRF is 62
3. Maximum of i+L for TWWDLCAA10DRF and TWDLCAA16DRF is 128
35011386 09/2007 47
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
%KW10 16 bits
%KW16
Word tables can be used with the Assignment instruction (see p. 477).
Tables of double Double word tables are a series of adjacent words of the same type and of a defined
words length (L).
Example:Double word table %KD10:7
%KD11 %KD13 %KD15 %KD17 %KD19 %KD21
16 Bit
Double word tables can be used with the Assignment instruction (see p. 477).
48 35011386 09/2007
Twido Language Objects
Tables of floating Floating word tables are a series of adjacent words of the same type and of a defined
words length (L).
Example: Floating point table %KF10:7
%KF11 %KF13 %KF15 %KF17 %KF19 %KF21
16 Bit
Floating point tables can be used with the Assignment instruction (see Advanced
instructions).
35011386 09/2007 49
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:
! Direct addressing
! Indexed addressing
Direct A direct address of an object is set and defined when a program is written.
Addressing Example: %M26 is an internal bit with the direct address 26.
Objects The following are the available types of objects for indexed addressing.
Available for
Type Address Maximum size Write access
Indexed
Addressing Internal words %MWi[MWj] 0# i+%MWj<3000 Yes
Constant words %KWi[%MWj] 0# i+%MWj<256 No
Internal double words %MDi[MWj] 0# i+%MWj<2999 Yes
Double constant words %KDi[%MWj] 0# i+%MWj<255 No
Internal floating points %MFi[MWj] 0# i+%MWj<2999 Yes
Constant floating points %KFi[%MWj] 0# i+%MWj<255 No
Indexed objects can be used with the assignment instructions (see Assignment
Instructions, p. 477 for single and double words) and in comparison instructions (see
p. 482 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.
50 35011386 09/2007
Twido Language Objects
Index Overflow An overflow of the index occurs when the address of an indexed object exceeds the
System Bit %S20 limits of the memory zone containing the same type of object. In summary:
! The object address plus the content of the index is less than 0.
! The object address plus the content of the index is greater than the largest word
directly referenced in the application. The maximum number is 2999 (for words
%MWi) or 255 (for words %KWi).
In the event of an index overflow, the system sets system bit %S20 to 1 and the
object is assigned an index value of 0.
Note: The user is responsible for monitoring any overflow. Bit %S20 must be read by
the user program for possible processing. The user must confirm that it is reset to 0.
%S20 (initial status = 0):
! On index overflow: set to 1 by the system.
! Acknowledgment of overflow: set to 0 by the user, after modifying the index.
35011386 09/2007 51
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.
52 35011386 09/2007
User Memory
3
At a Glance
Subject of this This chapter describes the structure and usage of Twido user memory.
Chapter
35011386 09/2007 53
User Memory
Introduction The controller memory accessible to your application is divided into two distinct sets:
! Bit values
! 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.
Memory Storage The following are the different types of memory storage for Twido controllers.
Types ! Random Access Memory.
Internal volatile memory: Contains dynamic words, memory words, program and
configuration data.
! EEPROM
An integrated 32 kB EEPROM that provides internal program and data backup.
Protects program from corruption due to battery failure or a power outage lasting
longer than 30 days. Contains program and configuration data. Holds a maximum
of 512 memory words. Program is not backed up here if a 64 kB extended
memory cartridge is being used and Twido has been configured to accept the
64 kB extended memory cartridge. The Twido Extreme TWDLEDCK1 has no
extended memory cartridge.
! 32 kB backup cartridge
An optional external cartridge used to save a program and transfer that program
to other Twido controllers. Can be used to update the program in controller RAM.
Contains program and constants, but no memory words. The Twido Extreme
TWDLEDCK1 has no backup cartridge.
! 64 kB extended memory cartridge
An optional external cartridge that stores a program up to 64 kB. Must remain
plugged into the controller as long as that program is being used. The
Twido Extreme TWDLEDCK1 has no extended memory cartridge.
54 35011386 09/2007
User Memory
Saving Memory Your controller’s program and memory words can be saved in the following:
! RAM (for up to 30 days with good battery)
! 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.
Twido Compact The following tables describe the types of memory configurations possible with
and Modular Twido compact and modular controllers.
Memory
Compact Controllers
Configurations
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***
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
Twido Extreme The following table describes the possible types of memory configuration for the
Memory Twido Extreme controllers.
Configurations
Twido Extreme controller
Memory Type TWDLEDCK1
External RAM 32 kB
Internal EEPROM 32 kB
Maximum program size 32 kB
56 35011386 09/2007
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 TWDLEDCK1 PLC 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 Here is a diagram of a controller’s memory structure. The arrows show what can be
Structure backed up to the EEPROM from RAM:
Dynamic words
%MWs
RAM
Program
Configuration data
%MWs
EEPROM
Program
Configuration data
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.
35011386 09/2007 57
User Memory
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):
! The RAM program is not valid
To restore a program manually from EEPROM do the following:
! From the TwidoSuite window, select Memory Cartridge Commands from
Program$%$Debug , select a connection and click Restore.
Data (%MWs) Here are the steps for backing up data (memory words) into the EEPROM:
Backup
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.
58 35011386 09/2007
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 TWDLEDCK1 PLC 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.
Memory Here is a diagram of a controller’s memory structure with the backup cartridge
Structure attached. The arrows show what can be backed up to the EEPROM and cartridge
from RAM:
Dynamic words
%MWs
RAM
Program
Configuration data
%MWs
EEPROM
Program
Configuration data
Backup Program
cartridge
Configuration data
35011386 09/2007 59
User Memory
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.
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.
Data (%MWs) Here are the steps for backing up data (memory words) into the EEPROM:
Backup
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.
60 35011386 09/2007
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.
Dynamic words
%MWs
RAM
Program (1st)
Configuration data
EEPROM
%MWs
Extended
memory Program (2nd)
cartridge
35011386 09/2007 61
User Memory
Configure Before you begin writing your extended program, you must install the 64K extended
Software and memory cartridge into your controller. The following four steps show you how:
Install Extended
Step Action
Memory
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.
Save your Once your 64K extended memory cartridge has been installed and your program
program. written:
! From the TwidoSuite window, select Memory Cartridge Commands from
Program$%$Debug, select a connection and click Backup.
Data (%MWs) Here are the steps for backing up data (memory words) into the EEPROM:
Backup
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.
62 35011386 09/2007
Event task management
4
At a Glance
Subject of this This chapter describes event tasks and how they are executed in the controller.
Chapter
Note: Event tasks are not managed by the Twido Brick 10 controller
(TWDLCAA10DRF).
35011386 09/2007 63
Event task management
Introduction The previous chapter presented periodic ( Periodic Scan, Twido Hardware Guide,
Modular and Compact Bases) and cyclic ( Cyclic Scan, Twido Hardware Guide,
Modular and Compact Bases) 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:
! is a part of a program executed when a given condition is met (event source),
! has a higher priority than the main program,
! guarantees a rapid response time enabling the overall response time of the
system to be reduced.
64 35011386 09/2007
Event task management
Overview of An event source needs to be managed by the software to make the sure the main
Different Event program is properly interrupted by the event, and to call the programming section linked
Sources to the event. The application scan time has no effect on the execution of the events.
The following 9 event sources are allowed:
! 4 conditions linked to the VFC function block thresholds (2 events per %VFC instance),
! 4 conditions linked to the physical inputs of a controller base,
! 1 periodic condition.
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.
Physical Input Inputs %I0.2, %I0.3, %I0.4 and %I0.5 can be used as event sources, provided they
Events of a are not locked and that the events are allowed during configuration.
Controller Base Event processing can be activated by inputs 2 to 5 of a controller base (position 0),
on a rising or falling edge.
For further details on configuring this event, refer to the section entitled "Hardware
Configuration -> Input Configuration" in the "TwidoSuite Operation Guide" on-line help.
Output Event of a Outputs TH0 and TH1 of the %VFC function block are event sources. Outputs TH0
%VFC Function and TH1 are respectively set:
Block ! to 1 when the value is greater than threshold S0 and threshold S1,
! to 0 when the value is less than threshold S0 and threshold S1.
A rising or falling edge of these outputs can activate an event process.
For further details on configuring this event, refer to the section entitled "Software
Configuration -> Very Fast Counters" in the "TwidoSuite Operation Guide" on-line help.
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.
35011386 09/2007 65
Event task management
Event Management
Events Queue Events have 2 possible priorities: High and Low. But only one type of event (thus only
and Priority one event source) can have High priority. The other events therefore have Low priority,
and their order of execution depends on the order in which they are detected.
To manage the execution order of the event tasks, there are two event queues:
! in one, up to 16 High priority events can be stored (from the same event source),
! in the other, up to 16 Low priority events can be stored (from other event sources).
These queues are managed on a FIFO basis: the first event to be stored is the first
to be executed. But they can only hold 16 events, and all additional events are lost.
The Low priority queue is only executed once the High priority queue is empty.
Event Queue Each time an interrupt appears (linked to an event source), the following sequence
Management is launched:
Step Description
1 Interrupt management:
! recognition of the physical interrupt,
! event stored in the suitable event queue,
! 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 p. 669):
! %S31: used to execute or delay an event,
! %S38: used to decide whether or not to place events in the events queue,
! %S39: used to find out if events are lost,
! %SW48: shows how many events have been executed since the last cold start
(counts all events except periodic events.)
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 09/2007
Special Functions
II
At a Glance
Subject of this This part describes communications, built-in analog functions, managing analog I/O
Part modules, installing the AS-Interface V2 bus and the CANopen fieldbus for Twido
controllers.
35011386 09/2007 67
Special Functions
68 35011386 09/2007
Communications
5
At a Glance
Subject of this This chapter provides an overview of configuring, programming, and managing
Chapter communications available with Twido controllers.
35011386 09/2007 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.
70 35011386 09/2007
Communications
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.
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.
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.
Modbus TCP/IP
Note: Modbus TCP/IP is solely supported by TWDLC•E40DRF series of compact
controllers with built-in Ethernet network interface.
35011386 09/2007 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:
! By TSX PCX cable,
! By telephone line: Modem connection,
! 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:
! By direct cable connection via a UTP Cat5 RJ45 Ethernet crossover cable (not
recommended),
! 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.
CAUTION
EQUIPMENT DAMAGE
TwidoSuite may not sense the disconnection when the TSX PCX1031,
TSX CRJMD25 or Ethernet communication cable is physically removed from one
controller and rapidly reinserted into another. To avoid this condition, use
TwidoSuite to disconnect before removing the cable.
Failure to follow this instruction can result in injury or equipment damage.
72 35011386 09/2007
Communications
Serial Cable The EIA RS232C port on your personal computer can be connected to the
Connection controller's Port 1 using the TSX PCX1031 cable. (For the Twido Extreme
TWDLEDCK1 PLC this serial connection is a VW3 A8106 cable.) This cable
converts signals between EIA RS232 and EIA RS485. The TSX PCX1031 cable is
equipped with a 4-position rotary switch to select different modes of operation. The
switch designates the four positions as "0-3", and the appropriate setting for
TwidoSuite to Twido controller is location 2.
This connection is illustrated in the diagram below.
Port 1
RS485 TSX PCX1031
Serial
Minidin 2 EIA RS232
PC Serial Port
1 3
0
Serial Port
Serial
PC Serial Port
VW3 A8106
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 09/2007 73
Communications
USB Cable The USB port on your personal computer can be connected to the controller's Port 1 using
Connection the TSX CUSB485 and TSX CRJMD25 communication cables. (For the Twido Extreme
TWDLEDCK1 PLC this connection is made with TSX CUSB485 and TWD XCAFJ010
cables.) The TSX CUSB485 cable converts signals between USB and EIA RS485.
This connection is illustrated in the diagram below.
Port 1 PC USB Port
RS485
TSX CRJMD25
Female RJ45
USB
PC USB Port
Serial Port
TSX CUSB485
TWD XCAFJ010
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 09/2007
Communications
Pin outs of Male The following figure shows the pin outs of a male 8-pin miniDIN connector and of a terminal:
and Female Mini DIN Terminal block
Connectors TWD NAC232D, TWD NAC485D TWD NAC485T
TWD NOZ485D, TWD NOZ232D TWD NOZ485T
A B SG
Pin outs Base RS485 RS485 option RS232-C Pin outs RS485
1 D1 (A+) D1 (A+) RTS A D1 (A+)
2 D0 (B-) D0 (B-) DTR B D0 (B-)
3 NC NC TXD SG 0V
4 /DE NC RXD
5 /DPT NC DSR
6 NC NC GND
7 0V 0V GND
8 5V 5V 5V
Note: Maximum total consumption for 5V mode (pin 8): 180mA
Note: There is no relation between the Twido RS485 A and B terminals and the D(A)
and D(B) terminals on other equipment such as ATV drives, XBT, Premium, etc.
The following figure shows the pin outs of a SubD female 9-pin connector for the
TSX PCX1031.
35011386 09/2007 75
Communications
Telephone Line A modem (see p. 79) connection enables programming of and communication with the
Connection controller using a telephone line.
The modem associated with the controller is a receiving modem connected to port
1 of the controller. The modem associated with the PC can be internal, or external
and connected to a COM serial port.
This connection is illustrated in the diagram below.
PC Serial Port
Port 1
EIA RS232
RS485
External
Modem
modem
Telephone line
SUB-D female
connector
TSX PCX1031 position 2,
with Tx/Rx inversion
Note: Caution. Remember to install the software provided with the modem, as
TwidoSuite only takes into account the installed modems.
Ethernet
Network Note: Although direct cable connection (using a Ethernet crossover cable) is
Connection supported between the Twido TWDLC•E40DRF and the PC running the
TwidoSuite programming software, it is not recommended. Therefore, for Ethernet
connection we recommend that you always use an Ethernet network hub/switch.
The following figure shows a PC-to-Twido connection via a network Ethernet hub/switch:
Ethernet
TwidoTWDLC•E40DRF
RJ45 Ethernet Port Hub/Switch PC Ethernet Network Port
RJ45
RJ45 male
connector
SFTP Cat5 RJ45 Ethernet cable RJ45 male
connector
76 35011386 09/2007
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.
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:
Pinout Function Polarity
8 NC
7 NC
6 RxD (-)
5 NC
4 NC
3 RxD (+)
2 TxD (-)
1 TxD (+)
Note:
! The same connector and pinout is used for both 10Base-T and 100Base-TX.
! When connecting the Twido controller to a 100Base-TX network, you should
use at least a category 5 Ethernet cable.
35011386 09/2007 77
Communications
Example The following diagram shows an example of the connection between the PC running
Ethernet the TwidoSuite application program and a Twido Extreme TWDLEDCK1 controller
Connection for via an XGS Z33ETH connection box . It is possible to connect up to 3 Twido Extreme
Twido Extreme bases on an Ethernet network using this connection box. This type of connection is
only possible with the Twido Extreme TWDLEDCK1 controller.
PC Twido Extreme
RJ45 Ethernet RJ45 Ethernet
XGS Z33ETH
connection box
RJ45 male
Ethernet hub/switch
78 35011386 09/2007
Communications
Twido
TDRD
RTSDTR
DCD
PWR
WESTERMO
TD-33
V24/RS-232-C
TEL.LINE
POWER
Installing the All modems the user wishes to use with TwidoSuite must be installed running
Modem Windows from your PC.
To install your modems running Windows, follow the Windows documentation.
This installation is independent from TwidoSuite.
35011386 09/2007 79
Communications
Bluetooth Bluetooth connection is also possible for Twido controllers, via a Bluetooth adapter
Connection (dongle) VW3 A8114. PCs not fitted with integrated Bluetooth can be used with the
Bluetooth PC adapter VW3 A8115.
Twido
For the Twido Extreme this Bluetooth adapter can be connected to the PLC’s serial
port with a TWD XCAFJ010 cable
TWD XCAFJ010
80 35011386 09/2007
Communications
Establishing The default communication connection between TwidoSuite and the Twido
Connection controller is made by a serial communication port, using the TSX PCX1031 cable
and a crossed adapter (see Appendix 1, p. 89). 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.
Clear Dark
Default project image Default image
Personalized image C:\Documents and Settings\Administrator\My documents\
Default functional levels of applications Automatic Automatic management
The very highest
The very lowest
Manual Manual management
Level 1.0
Level 2.0
Level 2.5
Level 3.0
Connection management
Name Connection type IP / Phone Punit / Address Baud rate Parity Stop bits Timeout Break timeout
COM1 Serial COM1 Punit 5000 20
COM2 Serial COM1 Punit 5000 20
My connection 1 Serial 192.168.1.1 Direct 5000 20
Modem connection Ethernet xxxxxxxxxx 19200 None 1 5000 20
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 09/2007
Communications
Configuring the The procedure for configuring a modem in a Twido controller is as follows.
Modem To add a modem to an open application, follow the procedure described in
(Positioning a Modem, Twido Programmable Controllers, TwidoSuite Programming
Software, Online Help)
Once the modem is configured on port 1, the properties must be defined. In the
Modem
Types: My Modem
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".
35011386 09/2007 83
Communications
Add/Modify Modem
Types: My Modem
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.
84 35011386 09/2007
Communications
Connection Once TwidoSuite and the Twido controller are ready, establish connection as
Sequence 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.
35011386 09/2007 85
Communications
Internal, External If you are communicating with a Twido controller within your company premises, you
and International can use just the line extension needed to dial, such as: 8445
Calls Connection management
Name Connection type IP / Phone Punit / Address Baud Rate Parity Stop bits Timeout Break Timeout
USB Serial USB Punit 5000 20
sdfsdfsdf Ethernet 192.168.1.1 244 5000 20
My connection 1 Ethernet 192.168.1.1 Direct 5000 20
Modem connection MODEM: TOSHIBA 8445 19200 None 1 5000 20
Apply Restore
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
Connection management
Name Connection type IP / Phone Punit / Address Baud Rate Parity Stop bits Timeout Break Timeout
USB Serial USB Punit 5000 20
sdfsdfsdf Ethernet 192.168.1.1 244 5000 20
My connection 1 Ethernet 192.168.1.1 Direct 5000 20
Modem connection MODEM: TOSHIBA 0,xxxxxxxxxx 19200 None 1 5000 20
Apply Restore
For international calls, the syntax is: +1xxxxxxxxxx, for example. And if you are using
a switchboard: 0,+ 1xxxxxxxxxx
Connection management
Name Connection type IP / Phone Punit / Address Baud Rate Parity Stop bits Timeout Break Timeout
USB Serial USB Punit 5000 20
sdfsdfsdf Ethernet 192.168.1.1 244 5000 20
My connection 1 Ethernet 192.168.1.1 Direct 5000 20
Modem connection MODEM: TOSHIBA 0,+1xxxxxxxxxx 19200 None 1 5000 20
Apply Restore
86 35011386 09/2007
Communications
Frequently When your communication has been established for a few minutes, you can
Asked Questions experience some communication errors. In this case, you must adjust the
communication parameters.
TwidoSuite uses a modbus driver to communicate via serial ports or internal
modems. When communication starts, the modbus driver is visible in the toolbar.
Double-click on the modbus driver icon to open the window. You now have access
to the modbus driver parameters, and the "runtime" tab gives you information on the
frames exchanged with the remote controller.
If the "Number of timeouts" increases or is other than 0, change the value using
"Connection management" table, accessible using TwidoSuite by clicking
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.
MODBUS Driver - MODBUS01
Communication
Mode RTU
Connections 1
Frames Sent 17
Bytes Sent 158
Frames Received 17
Bytes Received 404
Number of Timeouts 0
Checksum Errors 0
Reset
Hide
35011386 09/2007 87
Communications
Toshiba Portege
3490CT Cable:
Modem integrated TSX PCX1031
Crossed
adaptor
TDRD
RTS
DTR
DCD
PWR
WESTERMO
TD-33
Westermo TD-33
SR1 MOD01
V24/RS-232-C
TEL.LINE
POWER
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.
88 35011386 09/2007
Communications
Crossed
adaptor
Westermo TD-33
TD
RDRTSDTR
DCD
PWR
WESTERMO
TD-33
SR1 MOD01
V24/RS-232-C
TEL.LINE
POWER
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 Westermo TD-33 modem:
5
1
9
6
6
9
1
35011386 09/2007 89
Communications
Appendix 2 Modem Westermo TD-33, Schneider reference number SR1 MOD01(1). This
modem manages four DIP switches, which must all be set to OFF:
Factory Settings
ON
Use stored configuration (speed & format etc.)
Disable DTR Hotcall, Auto Baud
1 2 3 4
Note:
1. Certain products may not be compatible and/or available in all areas. Please
contact your local Schneider representative for availability.
90 35011386 09/2007
Communications
Appendix 3 Wavecom WMOD2B modem, Schneider reference number SR1 MOD02(1) double
band (900/1800Hz):
Note:
1. Certain products may not be compatible and/or available in all areas. Please
contact your local Schneider representative for availability.
Note:
1. Certain products may not be compatible and/or available in all areas. Please
contact your local Schneider representative for availability.
35011386 09/2007 91
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: 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.
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 observe this precaution may lead to
corrupted data or unexpected and ambiguous results.
! Be sure that all slaves have unique addresses. No two slaves should have the
same address. Failure to observe this precaution may lead to corrupted data or
unexpected and ambiguous results.
Failure to follow this instruction can result in injury or equipment damage.
Note: The remote link requires an EIA RS485 connection and can only run on one
communications port at a time.
92 35011386 09/2007
Communications
Hardware A remote link must use a minimum 3-wire EIA RS485 port. It can be configured to
Configuration 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.
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 09/2007 93
Communications
Cable
Connection to Note: The DPT signal on pin 5 must be tied to 0V on pin 7 in order to signify the
Each Device use of remote link communications. When this signal is not tied to ground, the
Twido controller as either the master or slave will default to a mode of attempting
to establish communications with TwidoSuite.
Note: The DPT to 0V connection is only necessary if you are connected to a base
controller on Port 1.
The cable connections made to each remote device are shown below.
Mini-DIN connection
Twido Remote Remote
controller peripheral ... peripheral
D1(A+) D0(B-) 0V DPT D1(A+) D0(B-) 0V DPT D1(A+) D0(B-) 0V DPT
1 2 7 5
Software There must be only one master controller defined on the remote link. In addition, each
Configuration 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 observe this precaution may lead to
corrupted data or unexpected and ambiguous results.
Failure to follow this instruction can result in injury or equipment damage.
94 35011386 09/2007
Communications
Master The master controller is configured using TwidoSuite to manage a remote link
Controller network of up to seven remote controllers. These seven remote controllers can be
Configuration configured either as remote I/Os or as peer controllers. The address of the master
configured using TwidoSuite corresponds to address 0.
To configure a controller as a Master Controller, use TwidoSuite to configure port 1
or port 2 as remote links and select the address 0 (Master).
Then, from the "Add remote controller" window, you can specify the slave controllers
either as remote I/O, or as peer controllers, as well as their addresses.
Not even a simple "END" statement Only the local I/O of the controller is
RUN mode is coupled to the Master's. accessible (and not its I/O extension).
Peer controller Yes %INW and %QNW
Remote The update cycle of the remote link is not synchronized with the master controller's
Controller Scan scan. The communications with the remote controllers is interrupt driven and
Synchronization happens as a background task in parallel with the running of the master controller's
scan. At the end of the scan cycle, the most up to date values are read into the
application data to be used for the next program execution. This processing is the
same for remote I/O and peer controllers.
Any controller can check for general link activity using system bit %S111. But to
achieve synchronization, a master or peer will have to use system bit %S110. This
bit is set to 1 when a complete update cycle has taken place. The application
program is responsible for resetting this to 0.
The master can enable or disable the remote link using system bit %S112.
Controllers can check on the proper configuration and correct operation of the
remote link using %S113. The DPT signal on Port 1 (used to determine if TwidoSuite
is connected) is sensed and reported on %S100.
35011386 09/2007 95
Communications
Slave Controller If a slave controller restarts, one of the following events happens:
Restart ! A cold start (%S0 = 1) forces a re-initialization of the communications.
! A warm start (%S1 = 1) forces a re-initialization of the communications.
! In Stop mode, the slave continues communicating with the master. If the master
indicates a Stop state:
! The remote I/Os apply a Stop state.
! A peer controller continues in its current state.
96 35011386 09/2007
Communications
Master When the master controller enters Stop mode, all slave devices continue
Controller Stop communicating with the master. When the master indicates a Stop is requested,
then a remote I/O controller will Stop, but peer controllers will continue in their
current Run or Stop state.
Remote I/O Data The remote controller configured to be a remote I/O does not have or execute its
Access own application program. The remote controller's base discrete inputs and outputs
are a simple extension of the master controller's. The application must only use the
full three digit addressing mechanism provided.
Illustration
Remote Controller Address
Modular Number
Channel Number
%Q2.0.2
%I7.0.4
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 09/2007 97
Communications
Illustration
Remote link
%I2.0.0 %I0.0.0
... ...
%I2.0.23 %I0.0.23
%Q2.0.0 %Q0.0.0
... ...
%Q2.0.15 %Q0.0.15
%I4.0.0 %I0.0.0
... ...
%I4.0.23 %I0.0.23
%Q4.0.0 %Q0.0.0
... ...
%Q4.0.15 %Q0.0.15
98 35011386 09/2007
Communications
Peer Controller To communicate with peer controllers, the master uses network words %INW and
Data Access %QNW to exchange data. Each peer on the network is accessed by its remote address
"j" using words %INWj.k and %QNWj.k. Each peer controller on the network uses
%INW0.0 to %INW0.3 and %QNW0.0 to %QNW0.3 to access data on the master.
Network words are updated automatically when the controllers are in Run or Stop mode.
The example below illustrates the exchange of a master with two configured peer controllers.
Remote link
%INW1.0 %QNW0.0
... ...
%INW1.3 %QNW0.3
%QNW1.0 %INW0.0
... ...
%QNW1.3 %IWN0.3
%QNW0.0
%INW3.0 ...
... %QNW0.3
%INW3.3
%INW0.0
%QNW3.0
...
...
%INW0.3
%QNW3.3
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 09/2007 99
Communications
Status In addition to the system bits explained earlier, the master maintains the presence
Information 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 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
I0.1
Q0.0
Q0.1
Master controller Remote I/O Peer controller
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.
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.
TSX CUSB485
Note: The cable needs to be moved after each controller configuration and
application transfer.
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".
Controller comm. settings
Type: Remote link
Address: 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".
Controller comm. settings
Type: Remote link
Address: 2
LD %I0.0
ST %Q1.00.0
LD %I1.0.0
ST %Q0.0
LD %I0.1
ST %Q1.0.1
LD %I1.0.1
ST %Q0.1
For the controller configured as a remote I/O, do not write any application program.
For the controller configured as peer, write the following application:
LD 1
[%QNW0.0 := %INW0.0]
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:
! Transmission Only
! Transmission/Reception
! Reception Only
The maximum size of frames transmitted and/or received using the EXCHx
instruction is 256 bytes.
Hardware An ASCII link (see system bits %S103 and %S104 (see System Bits (%S), p. 669))
Configuration 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:
Device Port Specifications
TWDLC•A10/16/24DRF, 1 Base controller equipped with a 3-wire EIA RS485 port with
TWDLC••40DRF, a miniDIN connector.
TWDLMDA20/40DTK,
TWDLMDA20DRT
TWDLEDCK1 1 Base controller equipped with non-isolated EIA RS485
type, maximum length limited to 200 m.
Note: The following configuration options are not possible
! 7 bit, no parity, 1 stop bit
! 8 bit, even parity, 2 stop bits
! 8 bit, odd parity, 2 stop bits
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.
Twido Remote
controller peripheral
TXD RXD GND TXD RXD GND
3 4 7
Software To configure the controller to use a serial connection to send and receive characters
Configuration 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.
1The following configuration options are not possible for the Twido Extreme TWDLEDCK1
PLC:
! 7 bit, no parity, 1 stop bit
! 8 bit, even parity, 2 stop bits
! 8 bit, odd parity, 2 stop bits
Configuring the A Twido controller can use its primary port 1 or an optionally configured port 2 to use
Port the ASCII protocol. (The Twido Extreme TWDLEDCK1 PLC has only one serial
port.)To configure a serial port for ASCII:
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 ( How to Create
a Network (Modbus Example), TwidoSuite Online Help) and for ASCII).
3 Select Port 1 (or Port 2 if installed) to configure in the Describe window (see (
Configuring an Object, TwidoSuite Online Help)).
4 To configure the ASCII element, use any of the two methods:
! Click the Configure icon from the toolbar then select the ASCII element in the
describe graphic,
! Double click the ASCII element in the describe graphic.
5 To bring up the Feature dialog box ( Configuring an Object, TwidoSuite Online Help)
associated to the ASCII link hardware parameters, use any of the two methods:
! Click the Configure icon from the toolbar then select the ASCII link in the describe graphic,
! Double click the ASCII link in the describe graphic.
Step Action
6 Configure the Feature dialog box that appears, as explained in the subsequent steps:.
Configuration
Network
Type: Name: ASCII1
ASCII
Parameters
Baudrate: 19200 Stop Bits: 1
Cancel Advanced... OK
Configuring the The maximum size of the transmitted and/or received frames is 256 bytes. The word
Transmission/ table associated with the EXCHx instruction is composed of the transmission and
Reception table reception control tables.
for ASCII mode
Most significant byte Least significant byte
Control table Command Length (transmission/reception)
Reserved (0) Reserved (0)
Transmission table Transmitted Byte 1 Transmitted Byte 2
...
...
Transmitted Byte n
Transmitted Byte n+1
Reception table Received Byte 1 Received Byte 2
...
...
Received Byte p
Received Byte p+1
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:
! 0: Transmission only
! 1: Send/receive
! 2: Reception Only
Transmission/ When in Transmit Only mode, the Control and Transmission tables are filled in prior to
reception tables 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 (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.
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 The EXCHx instruction allows the Twido controller to send and/or receive
Instruction 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:
Syntax: [EXCHx %MWi:L]
where: x = port number (1 or 2)
L = number of words in the control words and transmission and
reception tables
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.
%MSGx Function The use of the %MSGx function block is optional; it can be used to manage data
Block exchanges. The %MSGx function block has three purposes:
! Communications error checking
The error checking verifies that the parameter L (length of the Word table)
programmed with the EXCHx instruction is large enough to contain the length of
the message to be sent. This is compared with the length programmed in the
least significant byte of the first word of the word table.
! Coordination of multiple messages
To ensure the coordination when sending multiple messages, the %MSGx
function block provides the information required to determine when transmission
of a previous message is complete.
! Transmission of priority messages
The %MSGx function block allows current message transmissions to be stopped
in order to allow the immediate sending of an urgent message.
The %MSGx function block has one input and two outputs associated with it:
Input/Output Definition Description
R Reset input Set to 1: re-initializes communication or
resets block (%MSGx.E = 0 and %MSGx.D =
1).
%MSGx.D Communication 0: Request in progress.
complete 1: communication done if end of
transmission, end character received, error,
or reset of block.
%MSGx.E Error 0: message length OK and link OK.
1: if bad command, table incorrectly
configured, incorrect character received
(speed, parity, and so on.), or reception table
full.
Error and If an error occurs when using the EXCHx instruction, bits %MSGx.D and %MSGx.E
Operating Mode are set to 1 and system word %SW63 contains the error code for Port 1, and
Conditions %SW64 contains the error code for Port 2.
System Words Use
%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.
Serial Port
VW3 A8106
Note: On the PC side of the cable, additional connections (such as Data Terminal
Ready and Data Set Ready) may be needed to satisfy the handshaking. No
additional connections are required to satisfy the Twido controller.
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.
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. 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
! Be sure that there is only one Modbus master controller on the bus and that
each Modbus slave has a unique address. Failure to observe this precaution
may lead to corrupted data or unexpected and ambiguous results.
! Be sure that all Modbus slaves have unique addresses. No two slaves should
have the same address. Failure to observe this precaution may lead to
corrupted data or unexpected and ambiguous results.
Failure to follow this instruction can result in injury or equipment damage.
Hardware A Modbus link can be established on either the EIA RS232 or EIA RS485 port and
Configuration 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 System Bits (%S), p. 669).
The table below lists the devices that can be used:
Device Port Specifications
TWDLC•A10/16/24DRF, 1 Base controller supporting a 3-wire EIA RS485 port with a
TWDLC••40DRF, miniDIN connector.
TWDLMDA20/40DTK,
TWDLMDA20DRT
TWDLEDCK1 1 Base controller equipped with non-isolated EIA RS485
type, maximum length limited to 200 m.
Note: The following configuration options are not possible
! 7 bit, no parity, 1 stop bit
! 8 bit, even parity, 2 stop bits
! 8 bit, odd parity, 2 stop bits
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.
Mini-DIN connection
RS232 EIA cable
Twido Remote
controller peripheral
TXD RXD COM TXD RXD COM
3 4 7
Software To configure the controller to use a serial connection to send and receive characters
Configuration 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.
1The following configuration options are not possible for the Twido Extreme TWDLEDCK1 PLC:
! 7 bit, no parity, 1 stop bit
! 8 bit, even parity, 2 stop bits
! 8 bit, odd parity, 2 stop bits
Configuring the A Twido controller can use its primary port 1 or an optionally configured port 2 to use
Port the Modbus protocol. (The Twido Extreme TWDLEDCK1 PLC has only one serial
port.) To configure a serial port for Modbus:
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 (see ( How to Create
a Network (Modbus Example), TwidoSuite Online Help).
3 Select Port 1 (or Port 2 if installed) to configure in the Describe window (see (
Configuring an Object, TwidoSuite Online Help).
4 To configure the Modbus element, use any of the two methods:
! Click the Configure icon from the toolbar then select the Modbus element in the
describe graphic,
! Double click the Modbus element in the describe graphic.
5 To bring up the Feature dialog box ( Configuring an Object, TwidoSuite Online Help)
associated to the Modbus link hardware parameters, use any of the two methods:
! Click the Configure icon from the toolbar then select the Modbus link in the
describe graphic,
! Double click the Modbus link in the describe graphic.
6 Configure the Feature dialog box that appears, as explained in the subsequent steps:.
TwidoSuite
Network
Type: Name: Modb1
Modbus
Parameters
Baudrate: 19200 Stop Bits: 1
Cancel Advanced... OK
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.
Most significant byte Least significant byte
Control table Command Length (Transmission/Reception)
Reception offset Transmission offset
Transmission table Transmitted Byte 1 Transmitted Byte 2
... ...
... Transmitted Byte n
Transmitted Byte n+1
Reception table Received Byte 1 Received Byte 2
... ...
... Received Byte p
Received Byte p+1
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/ When using either mode (Modbus ASCII or Modbus RTU), the Transmission table
reception tables 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:
! timeout on a character or frame has been detected,
! end of frame character(s) received in ASCII mode,
! 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.
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:
! Address 1-247
! Bits: 128 bits on request
! Words: 125 words of 16 bits on request
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 The EXCHx instruction allows the Twido controller to send and/or receive information
Instruction 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:
Syntax: [EXCHx %MWi:L]
where: x = port number (1 or 2)
L = number of words in the control words, transmission and reception tables
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.
%MSGx Function The use of the %MSGx function block is optional; it can be used to manage data
Block exchanges. The %MSGx function block has three purposes:
! Communications error checking
The error checking verifies that the parameter L (length of the Word table)
programmed with the EXCHx instruction is large enough to contain the length of
the message to be sent. This is compared with the length programmed in the
least significant byte of the first word of the word table.
! Coordination of multiple messages
To ensure the coordination when sending multiple messages, the %MSGx
function block provides the information required to determine when transmission
of a previous message is complete.
! Transmission of priority messages
The %MSGx function block allows current message transmissions to be stopped
in order to allow the immediate sending of an urgent message.
The %MSGx function block has one input and two outputs associated with it:
Input/Output Definition Description
R Reset input Set to 1: re-initializes communication or resets block
(%MSGx.E = 0 and %MSGx.D = 1).
%MSGx.D Communication 0: request in progress.
complete 1: communication done if end of transmission, end
character received, error, or reset of block.
%MSGx.E Error 0: message length OK and link OK.
1: if bad command, table incorrectly configured, incorrect
character received (speed, parity, and so on.), or
reception table full.
Error and If an error occurs when using the EXCHx instruction, bits %MSGx.D and %MSGx.E
Operating Mode are set to 1 and system word %SW63 contains the error code for Port 1, and
Conditions %SW64 contains the error code for Port 2.
VW3 A8106
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:
1The
following configuration options are not possible for the Twido Extreme
TWDLEDCK1 PLC:
! 7 bit, no parity, 1 stop bit
! 8 bit, even parity, 2 stop bits
! 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.
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.
Modbus Link The diagram below illustrates the use of Modbus request 16 to write output words to
Example 2 a slave. This example uses two Twido Controllers.
Step 1: Configure the Hardware:
VW3 A8106
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.
Step 5:Initialize the Animation Table Editor:
Create the following animation table on the master:
Address Current Retained Format
1 %MW0 010C 0000 Hexadecimal
2 %MW1 0007 0000 Hexadecimal
3 %MW2 0210 0000 Hexadecimal
4 %MW3 0010 0000 Hexadecimal
5 %MW4 0002 0000 Hexadecimal
6 %MW5 0004 0000 Hexadecimal
7 %MW6 6566 0000 Hexadecimal
8 %MW7 6768 0000 Hexadecimal
9 %MW8 0210 0000 Hexadecimal
10 %MW9 0010 0000 Hexadecimal
11 %MW10 0004 0000 Hexadecimal
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.
Format Reference number
Bit %Mi
Word %MWi
(*) 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:
! This request does not need the use of offset.
! The response frame is the same as the request frame here (in a normal case).
! 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:
! This request does not need the use of offset.
! The response frame is the same as the request frame here (in a normal case).
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.
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.
Description The Read/Write Multiple Registers function code performs a combination of one
read operation and one write operation in a single Modbus transaction.
Request The request specifies the starting address and the number of holding registers to be
Parameters 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:
Parameter Number of Bytes Values
Function code 1 Byte 0x17
Read Starting Address 2 Bytes 0x0000 to 0xFFFF
Quantity to Read 2 Bytes 0x0000 to approx. 0x0076
Write Starting Address 2 Bytes 0x0000 to 0xFFFF
Quantity to Write 2 Bytes 0x0000 to approx. 0x0076
Write Byte Count 1 Byte N* x 2
Write Registers Value N* x 2 Bytes
Response The standard response contains the data from the group of registers that were read.
Parameters 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:
Parameter Number of Bytes Values
Function code 1 Byte 0x17
Byte Count 1 Byte N* x 2
Read Register Value N* x 2 Bytes
Error Parameters The following table gives the values for the returned errors.
Parameter Number of Bytes Values
Error code 1 Byte 0x97
Exception code 1 Byte 01, 02, 03 or 04
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 The request for Read Device Identification function code is composed of the
Parameters 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:
! 01 - request to retrieve the basic device identification (stream
access)
! 02 - request to retrieve regular device identification (stream
access)
! 03 - request to retrieve extended device identification (stream
access)
! 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 The table below describes the response parameters returned for Read Device
Parameters 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:
! 01 - basic identification (stream access only)
! 02 - regular identification (stream access only)
! 03 - extended identification (stream access only)
! 81 - basic identification (stream access and individual access)
! 82 - regular identification (stream access and individual access)
! 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:
! 00 : no more objects are available
! 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).
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).
Parameter Description
......... .........
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).
Error Parameters The following values can be found in error codes returned:
Value Table
Parameter Bytes Possible values
Function Code 1 byte 0xAB:
Fc 0x2B + 0x80
MEI Type 1 byte 14
Exception code 1 byte 01 / 02 / 03 / 04
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
Twido Supported The following table describes function codes supported by both Twido serial and
Modbus TCP/IP Modbus:
Function Codes
Supported MB FC Supported Sub-fc code Function
(MB FC)
1 — Read multiple internal bits %M
2 — Read multiple internal bits %M
3 — Read multiple internal registers %MW
4 — Read multiple internal registers %MW
5 — Force single internal bit %M
6 — Write single internal register %MW
8 00 only Echo diagnostics
15 — Write multiple internal bits %M
16 — Write multiple internal registers %MW
23 — Read/write multiple internal registers %MW
43 14 Read device identification (regular service)
6
At a Glance
Subject of this This chapter describes how to manage the built-in analog channel and
Chapter potentiometers.
Analog potentiometer
Programming The numerical values, from 0 to 1023 for analog potentiometer 1, and from 0 to 511
for analog potentiometer 2, corresponding to the analog values provided by these
potentiometers are contained in the following two input words:
! %IW0.0.0 for analog potentiometer 1 (on left)
! %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.
5s
0 1023
The following parameters are selected at configuration for the time-delay block
%TM0:
! Type TON
! 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.
Code for the above example:
%MW0:=%IW0.0.0/2
LD 1
[%MW0:=%IW0.0.0/2]
%TM0.P:=%MW0+500 [%TM0.P:=%MW0+500]
BLK %TM0
LD %I0.0
%TM0 IN
%I0.0 %Q0.0 OUT_BLK
IN Q
LD Q
ST %Q0.0
END_BLK
...................
Analog Channel
Programming Controlling the temperature of an oven: The cooking temperature is set to 350°C.
Example 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 511 is
used in this example. Analog setting for the temperature set points are:
Temperature (°C) Voltage System Word %IW0.0.1
0 0 0
347.5 7.72 395
350 7.77 398
352.5 7.83 401
450 10 511
7
At a Glance
Subject of this This chapter provides an overview of managing analog modules for Twido
Chapter 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:
Name Points Signal Range Encoding
TWDAMI2HT 2 In 0 - 10 Volts or 4 - 20 mA 12 Bit
TWDAMI2LT 2 In Inputs - Thermocouple 16 bit
TWDAMO1HT 1 Out 0 - 10 Volts or 4 - 20 mA 12 Bit
TWDAMM3HT 2 In, 1 Out 0 - 10 Volts or 4 - 20 mA 12 Bit
TWDAMM6HT 4 In, 2 Out 0 - 10 Volts or 4 - 20 mA 12 Bit
TWDALM3LT 2 In, 1 Out 0 - 10 Volts, Inputs Th or PT100, Outputs 4 - 20 mA 12 Bit
TWDAVO2HT 2 Out +/- 10 Volts 11 Bit + sign
TWDAMI4LT 4 In 0 - 10 Volts, 0 - 20 mA, NI or PT 3-wire sensors 12 Bit
TWDAMI8HT 8 In 0 - 10 Volts or 0 - 20 mA 10 Bit
TWDARI8HT 8 In NTC or PTC sensors 10 Bit
Operating Input and output words (%IW and %QW) are used to exchange data between the
Analog Modules user application and any of the analog channels. The updating of these words is
done synchronously with the controller scan during RUN mode.
CAUTION
UNEXPECTED START-UP OF DEVICES
When the controller is set to STOP, the analog output is set to its fall-back position.
As is the case with discrete output, the default setpoint is zero.
Failure to follow this instruction can result in 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.
Configuring Use the Configuration Editor ( Configuration Editor, TwidoSuite Online Help) to set
Analog I/O parameters of analog I/O modules that you added as expansion modules when you
described the system (see ( Positioning a Module, TwidoSuite Online Help)).
Note: All analog I/O configuration parameters can be modified online and offline.
For example, for the TWDAMI2LT module the Type of input (J, K or T) can be
modified both offline and online.
@1 My Twido
TWDLCAE40DRF @1
TWDAMI2LT
Address : 1
The table shows: Address, Symbol, Type, Range, Minimum, Maximum and Units
! In TWDAMI4LT and TWIDAMI8HT, the table is preceded by an Input type list box.
! In TWDAVO2HT and TWDAMI8HT, the Type column is replaced by a
Configured column with check boxes.
! In TWDARI8HT, 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.
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.
Module Name Address
TWDAMI2LT 2 Inputs (%IWi.0, %IWi.1)
TWDALM3LT 2 Inputs (%IWi.0, %IWi.1), 1 Output (%QWi.0)
TWDAMM3HT 2 Inputs (%IWi.0, %IWi.1), 1 Output (%QWi.0)
TWDAMM6HT 4 Inputs (%IWi.0 to %IWi.3), 2 Outputs (%QWi.0, %QWi.1)
TWDAMI2HT 2 Inputs (%IWi.0, %IWi.1)
TWDAMO1HT 1 Output (%QWi.0)
TWDAVO2HT 2 Outputs (%QWi.0, %QWi.1)
TWDAMI4LT 4 Inputs (%IWi.0 to %IWi.3)
TWDAMI8HT 8 Inputs (%IWi.0 to %IWi.7)
TWDARI8HT 8 Inputs (%IWi.0 to %IWi.7)
Input and Output This identifies the mode of a channel. The choices depend on the channel and type of module.
Type For the TWDAMO1HT, TWDAMM3HT and TWDALM3LT, you can configure the
single output channel type as:
Type
Not in use
0 - 10 V
4 – 20 mA
For the TWDAMM6HT, you can configure the 4 input and the 2 output channel types as:
Input type
0 - 10 V
4 – 20 mA
For the TWDAMI2HT and TWDAMM3HT, you can configure the 2 input channel
types as:
Type
Not in use
0 - 10 V
4 – 20 mA
For the TWDAMI2LT*, 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 TWDLAMI2LT module, make sure your PLC firmware is
version 4.0 or later.
For the TWDALM3LT, you can configure the 2 input channel types as:
Type
Not in use
Thermocouple K
Thermocouple J
Thermocouple T
PT 100
For the TWDAMI4LT, you can configure the 4 input types as:
Input type Type
Not in use
Voltage
0-10 V
Not in use
Current
0-20 mA
Not in use
PT 100
Temperature PT 1000
NI 100
NI 1000
For the TWDAMI8HT, you can configure the 8 input types as:
Input type
0 - 10 V
0 - 20 mA
For the TWDARI8HT, 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
EQUIPMENT DAMAGE
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. Ensure that the wiring is in agreement with the TwidoSuite
configuration.
Failure to follow this instruction 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.
Range (NTC sensors) Minimum Maximum Units I/O Analog Modules
TWDAMI2LT
TWDALM3LT
TWDAMO1HT
0 4095 TWDAMM3HT
TWDAMM6HT
Normal None TWDAMI2HT
TWDAMI4LT
-2048 2047 TWDAVO2HT
TWDAMI8HT
0 1023
TWDARI8HT
User defined with a min. User defined with a
Custom None All I/O Analog Modules
of -32768 max. of 32767
Celsius K: -2700 K: 13700 0.1 &C TWDAMI2LT
J: -2000 J: 7600
T: -2700 T: 4000
K: 0 K: 13000 TWDALM3LT
J: 0 J: 12000
T: 0 T: 40000
Dynamically updated by TwidoSuite according to TWDARI8HT
user-defined parameters
TWDAMI4LT
-2000 6000
(Pt sensor)
TWDAMI4LT
-500 1500
(Ni sensor)
Chart or Formula In TWDARI8HT, each channel (0-7) is configured individually within a tab. Check the
Method Used box then choose between Chart and Formula configuration methods.
! Chart (graphical) method
(R1, T1) and (R2, T2) correspond to float format coordinates of two points
belonging to the curve.
R1(default 8700) and R2 (default 200) values are expressed in Ohms.
T1 (default 233.15) and T2 (default 398.15) values can have their unit set in the
Unit list box: Kelvin (default), Celsius or Fahrenheit.
Note: Changing the temperature unit after setting the T1 and T2 values will not
automatically recalculate T1 and T2 values with the new unit.
! Formula method
Provided you know Rref, Tref and B parameters, you can use this method to
define sensor characteristics.
Rref (default 330) is expressed in Ohms.
B is default 3569 (min. 1, max. 32767).
Tref (default 298.15) can have its unit set in the Unit list box: Kelvin (default),
Celsius or Fahrenheit.
Here is a table of corresponding min./max. Tref values between units:
Unit Min. value Max. value
Kelvin 1 650
Celsius -272 376
Fahrenheit -457 710
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 or warning 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 warning 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.
System Function Description
Word
%SW80 Base I/O Status For standard analog module, %SW8x is described as follows:
Bit [0] All analog channels in normal state
Bit [1] Module in initialization state
Bit [2] Power supply default
Bit [3] Configuration default
Bit [4] Conversion in running for input channel 0
Bit [5] Conversion in running for input channel 1
Bit [6] Invalid parameter for input channel 0
Bit [7] Invalid parameter for input channel 1
Bit [8 & 9] Not used
Bit [10] Overflow value for input channel 0
Bit [11] Overflow value for input channel 1
Bit [12] Underflow value for input channel 0
Bit [13] Underflow value for input channel 1
Bit [14] Not used
Bit [15] Invalid parameter for output channel
%SW80 Base I/O Status For TWDAMI4LT and TWDAMM6HT analog modules, %SW8x is described as
cont’d cont’d follows:
Bit [0 & 1] Channel 0 state
0 0: Analog channel in normal state
0 1: Invalid parameter for input channel
1 0: Unavailable input value (module in initialization state, conversion in running),
1 1: Invalid value for input channel (overflow or underflow value)
Bit [2 & 3] Channel 1 state (same description as bit [0 & 1])
Bit [4 & 5] Channel 2 state (same description as bit [0 & 1])
Bit [6 & 7] Channel 3 state (same description as bit [0 & 1])
Bit [8 to 15] Not used
Introduction This section provides an example of using Analog modules available with Twido.
Example: analog This example compares the analog input signal with five separate threshold values.
input A comparison of the analog input is made and a bit is set on the base controller if it
is less than or equal to the threshold.
LD [%IW1.0 < 16]
%IW1.0 < 16 %Q0.0 ST %Q0.0
Example: analog The following program uses an analog card in slot 1 and 2. The card used in slot 1
output has a 10-volt output with a "normal" range:
LD 1
%QW0.1.0:=4095 [%QW0.1.0:=4095
LD 1
[%QW0.2.0:=%MW0
%QW0.2.0:=%MW0
Subject of this This chapter provides an overview of the Twido Extreme base inputs and outputs
Chapter and describes input and output addressing.
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, IW, Q 0 . j
Symbol Type of object 0 indicates Channel
Twido Extreme number
base
%I is used for discrete input, %IW for analog (and PWM) input and %Q is used for
discrete (and PWM) output.
Types of Input/ The following table provides a summary of the type and number of Twido Extreme
Output inputs and outputs and their addresses:
KEY SWITCH INPUT (total of 1)
INPUTS (total of 22)
Type Maximum Address Range
Number
Discrete Switch to Ground (source) 11 %I0.0 - %I0.10
Switch to Battery (sink) 2 %I0.11, %I0.12
Analog Active Analog Sensor 4 %IW0.0 - %IW0.3
Passive Analog Sensor 3 %IW0.4 - %IW0.6
Analog/ Active Analog Sensor or Pulse Width 1 %IW0.7
PWM 1
Modulation (1 kHz maximum)
PWM Pulse Width Modulation (5 kHz maximum) 1 %IW0.8
OUTPUTS (total of 19)
Type Number Address
Discrete 1 A discrete current sourcing driver 1 %Q0.4
50 mA discrete current sourcing driver, 1 %Q0.3
Dedicated SECU, PLC status output
12/24 V 300 mA digital current sinking 14 %Q0.5 - %Q0.18
driver
PLS/PWM PLS or PWM (10 Hz to 1 kHz) 2 %Q0.0, %Q0.1
PLS or PWM (10 Hz to 5 kHz 1 %Q0.2
1
Note: The input %IW0.7 can be used as either an active analog input or a PWM input
For further information on the specification and pin position for these inputs and
outputs see (Contacts Location on the Connector, Twido Extreme, Programmable
Controller, Hardware Guide).
Key Switch The key switch is a special (physical) input which is used to:
! turn the Twido Extreme on and off
! 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.
At a Glance
Subject of this This section describes the input configuration for the Twido Extreme PLC.
Section
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 (Forcing Input/Output Values, Twido Programmable
Controllers, TwidoSuite Programming Software, Online Help).
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:
! TON '1 ms
! The input signal period (P) must be at least twice the maximum program scan
time (%SW31):
P ' 2 x %SW31
The following figure shows the input signal requirements when latching input is
used:
T ' 1ms
ON
P ' 2 ( %SW31
Discrete Input The following table shows the addresses assigned to Twido Extreme discrete
Addresses inputs:
DISCRETE INPUTS (total of 13)
Type Max Number Address Range
Switch to Ground (source) 11 %I0.0 - %I0.10
Switch to Battery (sink) 2 %I0.11, %I0.12
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 p. 168).
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.
Discrete Input Discrete inputs used in the ladder/list program may be viewed and configured in the
Configuration Program$%$Configure$%$Configure the Hardware Module Configuration pane of
TwidoSuite.
The Module Configuration Input tab lists all inputs used and available, as shown
below:
Module configuration.
Apply Cancel
Inputs Outputs CAN J1939 CANopen
Table of inputs
Used Address Symbol Used By Filtering Latch? Run/Stop? Deactivation High Priority SR Number
%I0.0 3 ms Not used
%I0.1 3 ms Not used
%I0.2 3 ms Not used
%I0.3 3 ms Not used
%I0.4 3 ms
%I0.5 3 ms
%I0.6 3 ms
%I0.7 3 ms
%I0.8 3 ms
%I0.9 3 ms
%I0.10 3 ms
%I0.11 3 ms
%I0.12 3 ms
%I0.13 No Filter
%I0.14 No Filter
%I0.15 No Filter
%I0.16 No Filter
%I0.17 No Filter
%I0.18 No Filter
%I0.19 No Filter
The first 4 inputs %I0.0 - %I0.3 can be either latched or used for events (rising edge,
falling edge or both) and thus can be linked to a subroutine.
The first 13 inputs %I0.0 - %I0.12 can be filtered (3 ms or 12 ms) and one of these
may be used for a RUN/STOP function.
%I0.0 to %I0.10 are Switch to Ground inputs.
%I0.11 to %I0.13 are Switch to Battery inputs.
The analog inputs %IW0.0 to %IW0.6 are associated with the discrete inputs %I0.13
to %I0.19 which change state depending on the corresponding analog values, as
shown in the table below :
Discrete Input Change of State Corresponding Analog Value
1 to 0 #1.2 V DC
0 to 1 '3.1 V DC
Input The input configuration fields displayed in the above figure are detailed in the
Configuration following table. As indicated certain fields in this table are for display purposes only
Fields and cannot be modified.
Field Possible Values Function
Used Check box selected or not. For display purposes only. Displays inputs
Selected relates to used. used by the program.
Cleared relates to unused.
Address Input Addresses %I0.0-%I0.19 Address of each discrete input.
Symbol User defined value: alphanumeric max 32 To provide name for input. This field can be
characters. edited. When applied, this name is then
displayed in the Ladder/List program.
Used by user logic, Event For display purposes only. Lists any
function blocks using this input, or indicates
whether the input is used to trigger an
event.
Filter Drop-down list box with following options: Filters are used to reduce the effect of
! No filter noise on the PLC input.
! 3 ms
! 12 ms
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
Inputs with filters cannot be latched. scan 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
! Not used by an input.
! Rising edge
! Falling edge
! Both edges
High Priority Check box selected or not. To make an event high priority (triggered).
Only one input (%I0.0 to %I0.3) can be chosen.
This can only be selected if there is an event
triggered, (i.e., Deactivation field is anything other
than "Not Used").
Introduction This section describes the configuration of analog inputs and provides an example.
Analog Input The following table shows the addresses assigned to Twido Extreme analog inputs:
Addresses
ANALOG INPUTS (total of 9)
Type Max Number Address Range
Active 4 %IW0.0 - %IW0.3
Passive 3 %IW0.4 - %IW0.6
Analog/PWM 1 %IW0.7
PWM 1 %IW0.8
Analog Input Analog inputs used in the ladder/list program may be viewed and configured in the
Configuration Program$%$Configure$%$Configure the Hardware Module Configuration pane of
TwidoSuite.
Scrolling down in the Module Configuration Input tab lists the analog inputs used and
available, as shown below :
Table of analog inputs
Input The input configuration fields displayed in the above figure are detailed in the
Configuration following table. As indicated, certain fields in this table are for display purposes only
Fields and cannot be modified.
Field Possible Values Function
Used Check box selected or not. For display purposes only. Displays inputs
Selected relates to used. used by the program. This field cannot be
Cleared relates to unused. edited.
Address Input Addresses %IW0.0-%IW0.6 Address of each analog input.
Symbol User defined value: alphanumeric max 32 characters. To provide name for input. This field can
be edited. When applied, this name is
then displayed in the Ladder/List program.
Equivalent to %I0.13 to %I0.19 For display purposes only. Lists
equivalent discrete mappings.
Scope Drop-down list box with following options: Enables the voltage range to be selected
! Normal (default) (normal mode) or altered (customized
! Customized mode) in the subsequent fields.
Maximum/ Normal mode: min 0, max 5120 %IW range: min 0, max 5120
Minimim corresponding to
voltage range: min 0, max 5 V.
These fields cannot be edited.
Customized mode: min -32,768, max +32,767 in user Enables customization of analog input. In
defined units. customized mode these fields can be
edited.
Example: Analog This example compares the analog input signal with five separate threshold values.
Input A comparison of the analog input is made and if it is less than the threshold a bit is
set in Twido Extreme.
1 LD
Enter your comments here. Enter your com-
2 LD SUBROUTINE 2 ments here.
Rung 0 %IW0.1 < 16
%IW0.1 < 16 %Q0.0
<
Rung 1
%IW0.1 < 32
%IW0.1 < 32 %Q0.1
<
Rung 2
%IW0.1 < 64
%IW0.1 < 64 %Q0.2
<
Rung 3
%IW0.1 < 128
%IW0.1 < 128 %Q0.3
<
Rung 4
%IW0.1 < 256
%IW0.1 < 256 %Q0.4
<
Note: In ladder programs the I/O address syntax is %IW0.i (i=0...8) 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.
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 p. 184) 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.
PWM Input The adresses %IW0.7 and %IW0.8 are dedicated to Twido Extreme PWM inputs,
Addresses but %IW0.7 may also be used as an Analog input.
PWM Input PWM outputs can be viewed and configured in the Program$%$Configure$%$
Configuration Configure the Hardware Module Configuration pane of TwidoSuite.
Scroll down the Configuration pane to display the Table of PWM Inputs as shown
below:
Table of PWM inputs
Input The PWM input configuration fields are described in the following table. As
Configuration indicated, certain fields in this table are for display purposes only (read-only) and
Fields cannot be modified.
Field Possible Values Function
Used Check box selected or not. For display purposes only. Displays inputs
Selected relates to used. used by the program. This field cannot be
Cleared relates to unused. edited.
Address Input Addresses %IW0.7,%IW0.8 Address of each Analog/PWM input.
Symbol User defined value: alphanumeric max 32 characters. To provide name for input. This field can be
edited. When applied, this name is then
displayed in the Ladder/List program.
Type Drop-down list box with following options: Select Analog if this is to be used as analog
! Analog input.
! Frequency (default) If input is PWM choose which parameter
! Ratio you want to convert the PWM input signal
! Pulse width into.
Scope Drop-down list box with following options: Enables the range to be customized in the
! Normal (default) subsequent fields.
! Customized
Maximum/ Normal mode: In normal mode, these fields cannot be
Minimum Frequency: min 0, max 20000 edited.
Ratio: min 0, max 100
Pulse width: min 0, max 20000
Customized mode: Enables analog/PWM input to be
For all Types: min -32768, max 32767 customized. In customized mode these
fields can be edited.
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:
! configure a PWM input to accept a single-axis lever, and
! use this input to control the speed and direction of a motor.
PWM Input As illustrated below, a motor is controlled via a single-axis lever with PWM output
Example and an ATV31 drive. The lever position provides the speed and rotation direction
(forwards or reverse).
2 5 4
3
8 9 10
The different hardware labelled in this example are listed below:
Diagram Reference Description
label
1 TWDLEDCK1 Twido Extreme PLC
2 TWDXPUJ1A Single-axis lever
3 VW3A8114 BlueTooth dongle - to enable wireless transfer from PC to
PLC
4 ATV31H037M2A Altivar ATV31 drive - to change speed and direction of
motor
5 VW3CANTAP2 CANopen junction box (TAP) - to connect the ATV31 drive
to the PLC
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.
Creating Follow the steps below to create the example previously described in this section
Application using TwidoSuite.
Example
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 Implementing the CANopen Bus, p. 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,
p. 254.
2 Configure the PWM input using TwidoSuite, to convert the PWM signal generated by
the single axis lever to a ratio.
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 Twido Extreme PWM Input Configuration, p. 182).
PWM Input The program is shown here first in ladder and then in list. The program uses the
Programming macro DRIVE to control the Altivar drive.
Example 1 LD
START MACRO DRIVE
Rung 0
D_MANAGER 0
SHORT D_MANAGER 0
D_RUN-FWD 0
D_RUN-FWD 0
%Q0.6
%Q0.7
%MW100 := 30 * %MW101
%MW100 := 30 * %MW101
%MW100 := 30 * %MW101
%MW100 := 30 * %MW101
D_SETPOINT_0 := %MW100
%MW4 := %MW100
D_SELECT_SPEED 0
D_SELECT_SPEED 0
Ladder/List I/O
Syntax
Note: In ladder programs the I/O address syntax is %IW0.i (i=0...8) 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.
Note: For more information about the single-axis lever and I/O connections (see
(Wiring Rules and Recommendations, Twido Extreme, Programmable Controller,
Hardware Guide)).
At a Glance
Subject of this This section describes the output configuration for the Twido Extreme PLC.
Section
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.
Discrete Output The following table shows the addresses assigned to Twido Extreme discrete
Addresses outputs:
DISCRETE OUTPUTS (total of 19)
Type Max Number Address Range
PLS/PWM 3 %Q0.0 - %Q0.2
Normal (1A)/PLC Status (limited to 1 %Q0.3
50mA)
Normal (1A) 1 %Q0.4
Normal ( 300 mA) 13 %Q0.5 - %Q0.17
Reverse 1 %Q0.18
Note: %Q0.3 is the only address that can be used to provide PLC Status but
alternatively this address could be used as a Normal Discrete address.
Discrete Output Discrete outputs used in the ladder/list program may be viewed and configured in
Configuration the Program$%$Configure$%$Configure the Hardware Module Configuration pane
of TwidoSuite.
Scrolling down in the Module Configuration Output tab lists the discrete outputs used
and available, as shown below:
Module configuration.
Apply Cancel
Inputs Outputs CAN J1939 CANopen
Table of outputs
The first 3 outputs %Q0.0 - %Q0.2 are dedicated to PLS/PWM function blocks.
Outputs %Q0.3 - %Q0.17 are normal discrete outputs with different possible levels
of output current and protection.
Output %Q0.3 can be used to provide PLC status.
Output %Q0.18 is the reverse logic output (a value of 1 relates to a 0 (or low) voltage
and a value of 0 relates to a high voltage).
Outputs %Q0.10 to %Q0.17 are only available with a 12 V DC power supply and
when the 12 V DC power supply check box is selected. These outputs are not
available with 24 V DC.
Output The output configuration fields displayed in the above figure are detailed in the
Configuration following table. Some fields in this table are for display purposes only and cannot be
Fields modified.
Field Possible Values Function
12V Power Check box selected or not. Selected if 12 V DC power supply is
Supply check To activate 12 V DC power supply, select this used.
box check box and a pop-up message informs you that If 12 V DC check box is selected, all
outputs are %Q0.10 to %Q0.17 are now active. outputs are available.
To de-activate 12 V DC power supply, clear this If 12 V DC check box is cleared, power
check box and a pop-up message informs you that supply is 24 V and %Q0.10 to %Q0.17 are
outputs are %Q0.10 to %Q0.17 are no longer not available.
active.
Used Check box selected or not. For display purposes only. Displays outputs
used by the program.
Address Output Addresses %Q0.0-%Q0.18 Address of each discrete output.
Symbol User defined value: alphanumeric max 32 characters. To provide name for the output. This field
can be edited. When applied, this name is
then displayed in the Ladder/List program.
Status Check box: selected or not Used to indicate PLC status.
This is applied by selecting and clicking Apply (or by If the PLC is in RUN, output is set to 1.
changing window in which case you will be asked if If the PLC is in STOP or in error, output is
you wish to apply changes). set to 0.
Used by user logic For display purposes only. Lists any function
blocks or program logic that uses this
output.
Introduction This section describes the configuration of PLS output for the Twido Extreme PLC.
Pulse (PLS) PLS is a special function that has %Q0.0 - %Q0.2 as dedicated outputs on a
Generator Twido Extreme PLC. A user-defined function block generates a pulse signal on
Output these outputs. This square signal has a constant (user-configurable) period P with
a constant (non-configurable) duty cycle. The duty cycle of the PLS generator is
factory-set to 50%(TON / P).
Illustration of PLS duty cycle = 50%(TON / P):
TON
Configurable period P
P
Dedicated PLS/ The outputs %Q0.0 - %Q0.2 are dedicated to either a %PLS or a %PWM function
PWM Outputs block. For example, creating the function block %PLSi (i=0...2) automatically
assigns the output %Q0.i to this function block. Once this output has been used for
%PLSi it cannot be reused by a %PWMi function block or elsewhere in the program.
%PLS Function The figure below presents the ladder representation of a %PLS function block for the
Block Twido Extreme PLC.
%PLS0
IN Q
TYPE DOUBLE
ADJ Y
%PLSi.P
0
R D
A %PLS function block has several variables which are summarized in the following
table Configuring a %PLS Function Block (see p. 197) describes how to configure
these variables.
The %PLSi (i = 0...2) function block has the following variables:
Object Description Possible values Write access
IN Enable function 0,1 N
If IN=1, the pulse generation is
produced at PLSi.Q
IF IN=0, PLSi.Q is set to 0
PLSi.R Reset to 0 0,1 N
If PLSi.R=1, outputs %PLSi.Q and
%PLSi.D are set to 0.
PLSi.Q Generation in program 0,1 N
If PLSi.Q=1, the pulse signal is
generated at the configured
dedicated output %Q0.i.
PLSi.D End of cycle 0,1 N
If PLSi.D=1, signal generation is
complete. The number of desired
pulses has been reached.
TYPE This defines the possible range for the Single or Double (word) Y
number of pulses that can be defined.
ADJUSTABLE This defines whether or not the preset Y/N Y
period value can be modified. Y enables modification of preset
value.
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.
PLSi.ND1 Total No. of pulses (double word format) 0 # PLSi.ND # 4 294 967 295 Y
to be generated.
Note
1The 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.
Input IN
Number of pulses
Dedicated Output
%PLSi.Q
%PLSi.D
Configuring a The following table shows you how to configure a %PLS function block.
%PLS Function
Step Action
Block
1 Create a %PLSi function block in the ladder/list editor (i = 0..2) Ladder Diagram
Blocks (see Ladder Diagram Blocks, p. 396).
2 Example: Ladder program with function block in section 2 and %PLSi.N
variable configured in section 1 (1).
1 LD
Rung 0
%PLS0.N:=10
SHORT %PLS0.N:=10
2 LD
Enter your comments here. Enter your comments
2 LD SUBROUTINE 2 here.
Enter your comments here. Enter your comments
Rung 0
%I0.1 %PLS0 %Q0.3
IN Q
ADJ Y
%CO.P
%I0.1
R D
(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 IL
0 LD 1
1 [ %PLS0.N := 10 ]
2 IL
0 BLK %PLS0
1 LD %I0.0.1
2 IN
3 LD %I0.0.1
4 R
5 OUT_BLK
6 LD Q
7 ST %Q0.0.3
8 END_BLK
(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 Opening the %PLS Configuration Table,
p. 200)
Result:
Define objects
Allocation Automatic Number of objects 0 Affected: 0 Maxi: 3
Table
tOFF
Progressive Hydraulic
Relative Hydraulic
Dedicated Output
%Q0.0 = Pulse Output
N
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.
Step Action
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.
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),
! select Type %PLS
! 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
! select or clear Double word
! select or clear Adjustable
The number of pulses cannot be configured in this window.(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.
(2)
Entering a frequency value that is outside the range will result in an error
message.
(3)
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.
7 To configure all other required PLS outputs (including those not yet used in the
program), repeat steps 3 and 4.
When selecting another %PLS you will be asked whether or not you wish to
apply changes, to which you reply "yes".
8 Click Apply (or change window and you will be asked whether or not you wish
to apply changes).
9
If you return to previous screen using the button, previous windows are
displayed in their prior state.
Opening the The table below shows you how to open the %PLS configuration table
%PLS
Step Action
Configuration
Table 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:
configurable period P
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.
%PWM Function The figure below presents the ladder representation of a %PWM function block for
Block the Twido Extreme PLC.
%PWM0
IN
%PWM0.P
100
A %PWM function block has several variables which are summarized in the
following table Configuring a %PWM Function Block (see p. 205) describes how to
configure these variables.
The %PWMi (i = 0...2) function block has the following variables:
Object Description Possible values Write
access
IN Enable function 0,1 N
If IN=1, the pulse generation is produced at the
configured dedicated output %Q0.i (i=0,1,2).
IF IN=0, the output channel is set to 0
%PWMi.R Duty cycle This value gives the percentage of the signal in Y
Modifying the % PWMi.R duty state 1 in a period P. The pulse width TON is thus
cycle in the program modulates equal to:
the width of the signal. TON = P * (%PWMi.R/100).
(P is the period in 10 )s).
The default value is 0 and values greater than 100
are considered to be equal to 100.
For Q0.0 and Q0.1 the duty cycle values must be
between 5% and 95%.
For Q0.2, duty cycle values must be between 20%
and 80%.
%PWMi.R must be defined in the ladder/list
program using, for example, an operator block, as
shown below in step 1.
PWM0.P and Preset period Frequency range: 10...1000 Hz Y
PWM1.P (This is calculated from the user which gives the following
defined Frequency in the Period range: 100...10 000 (in 10 )s).
configuration table.)
PWM function The following illustration shows a pulse diagram for the PWM function block with
block with varying duty cycles.
varying duty
cycles
Input IN
80%
50%
20%
Ratio
Dedicated Output
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:
%I0.0 %I0.1 %PWM0.R:=20 LDN %I0.0.0
/ / ANDN %I0.0.1
[%PWM0.R:=20]
%I0.0 %I0.1 %PWM0.R:=50 LD %I0.0.0
/ ANDN %I0.0.1
[%PWM0.R:=50]
%I0.0 %I0.1 %PWM0.R:=80 LD %I0.0.0
AND %I0.0.1
[%PWM0.R:=80]
%PWM0 BLK %PWM0
%I0.2 LD %I0.0.2
IN
IN
END_BLK
%PWM0.P
Configuring a The following table shows you how to configure a %PWM function block.
%PWM Function
Step Action
Block
1 Create a %PWMi function block in the ladder/list editor (i = 0..2) Ladder Diagram
Blocks (see p. 396).
Example: Ladder program with function block in section 2 and duty cycle
%PWM0.R variable configured in section 1.
1 LD
Rung 0
%PWM0.R:= 80
SHORT %PWM0.R:= 80
2 LD
Rung 0
%I0.1 %PWM0
IN
%PWM0.P
100
1 IL
0 LD 1
1 [ %PWM0.R:= 80 ]
2 IL
0 BLK %PWM0
1 LD %I0.0.1
2 IN
3 END_BLK
Step Action
2 Open the PMW Configuration table (see p. 207)
Result:
Table
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 p. 201).
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 p. 210).
In the right hand side pane (General tab),
! select Type %PWM
! 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
! select or clear Adjustable
! 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.
Step Action
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"
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.
Opening the The table below shows you how to open the %PWM configuration table
%PWM
Step Action
Configuration
Table 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
tON=P %PLS
*(R/100) Double Word
%PWM
Adjustable
Progressive Hydraulic
tON tOFF
Relative Hydraulic
Dedicated Output
PWM Output The PWM Output configuration fields are described in the following table. As
General Tab indicated, certain fields in this table are for display purposes only (read-only) and
Configuration cannot be modified.
Fields
Field Possible Values Function
Filter Box Drop-down list box with following options: Enables you to view/hide the used/unused
! All objects.
! Used
! Unused
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.
! %PWM0
! %PWM1
! %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 PLS/ 3 options, to choose: To choose PLS or PWM generation.
PWM ! Not Used
! %PLS
! %PWM
Frequency User defined value in the following range: Frequency of the PWM output signal.
! For %PLS0 and %PLS1 : 10 ... 1000 Hz in
standard mode.
For %PLS2: 10 ... 5000 Hz in standard mode.
! 50 Hz ... 400 Hz in hydraulic mode (see p. 210).
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 p. 210) Enable/Disable the Hydraulic Mode.
Hydraulic Note: Checking these boxes enables the
Progressive Hydraulic and Input tabs.
Hydraulic
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.
PWM Output in The PWM is a special function that can be assigned to an output. This rectangular
Hydraulic Mode signal has a constant (user-configurable) period with the possibility of varying the
duty cycle. PWM output (see p. 201) describes this in more detail.
PWM in hydraulic mode allows the Twido Extreme to control a hydraulic system.
Note: In hydraulic mode, other discrete inputs and outputs can also be used. The
three outputs %Q0.0-%Q0.2, however are reserved for signal output for %PWM0-
%PWM2 and thus may not be reused.
tON=P %PLS
*(R/100) Double Word
%PWM
Adjustable
Progressive Hydraulic
tON tOFF
Relative Hydraulic
Dedicated Output
tON tOFF
P=1/F
PWM Output The PWM output hydraulic tab configuration fields are described in the following
Hydraulic Tab table.
Configuration
Fields
Field Possible Values Function
Command Choose one of the 2 following options: see Definition of Dither, p. 212 and
! Dither Definition of Ramp, p. 213
! Ramp
Displacement Ramp mode: Set the value in the range [0 s...9 s] for: To set the duration of the rising and the
! slow ramp falling of the ramp (ramp mode) or to set
! fast ramp the dither frequency (dither mode).
Dither mode: Set the value in the range [2 Hz...400 Hz]
for:
! slow dither
! fast dither
Frequency/ User defined value in the following range: To modify the frequency value set in the
Period ! [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
! Apply to confirm and save changes TwidoSuite project
! Cancel to discard changes
Definition of Stiction and hysteresis can make controlling a hydraulic valve seem erratic and
Dither unpredictable:
! stiction can prevent the valve spool from moving when input signal changes are
small, and
! 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:
! In the constant zone (see p. 216), 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.
! In a rising or falling ramp (see p. 216), 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 Ramps are used to slow down the response of a valve driver to a changing input
Ramp 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.
tON=P
*(R/100)
Fast Fast
P=1/F
The PWM Configuration Table, Input tab obtained after selecting Progressive
Hydraulic mode in the General tab is displayed below:
Define objects
Allocation Automatic Number of objects 0 Affected: 0 Maxi: 3
Table
tON=P
*(R/100)
tON tOFF
Ramp Current ratio Setpoint
Slow
Fast
P=1/F
PWM Ramp Input The PWM ramp configuration fields are described in the following table. The Input
Tab tab is available only if one of the hydraulic check boxes (Progressive or Relative) is
Configuration selected in the General tab. Entering addresses in these fields enables you to
Fields specify four ramps.
Hydraulic Field Possible Values Function
mode
Relative Slow rising When the trigger is set to 1, the
ramp slow rising ramp transition
starts. The ratio increases
slowly from 5% to 95%.
Fast rising When the trigger is set to 1, the
ramp fast rising ramp transition
choose the trigger for the ramp: starts. The ratio increases
! Memory bit %Mi (i=0...99) rapidly from 5% to 95%.
Slow falling ! Digital input %I0.j (j=0...19) When the trigger is set to 1, the
ramp ! Digital output %Q0.k (k=0...18)) slow falling ramp transition
starts. The ratio decreases
slowly from 95% to 5%.
Fast falling When the trigger is set to 1, the
ramp fast falling ramp transition
starts. The ratio decreases
rapidly from 95% to 5%.
Relative/ Current Ratio ! %MWi (i=0...99) Current value of the PWM ratio.
Progressive ! %QWCxyz (x= 0 or 1; y = 0...31; z = 0...7)
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:
! fast falling
! slow falling
! slow rising
! 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%.
Hydraulic PWM In online mode you can monitor the state of the PWM output ramp from Program$%$
Output in Online Debug$%$Monitor software configuration:
Mode Define objects
Allocation Automatic Number of objects 0 Affected: 0 Maxi: 3
Table
2 6
3 5
1 1
There are 6 different states in the PWM signal in online mode, as shown below:
State State Online diagram
number
1 Dead zone
4
2 6
3 5
1 1
2 6
3 5
1 1
2
6
5
3
1 1
4 Constant zone
4
2 6
3 5
1 1
2 6
3
5
1 1
2 6
3 5
1 1
Effect of
Twido Extreme
System bit Operating mode Effect
Operating Modes
state
on PWM Outputs
%S0=1 Cold restart The output is reset to its initial state and the
output signal is null.
%S1=1 Warm restart The output restarts in the same state as is was
prior to the power cut.
%S9=1 PLC in STOP mode The outputs %Q0.0, %Q0.1 and %Q0.2 are set
or to 0 regardless of the state of system bit %S8.
Outputs reset in RUN mode
Overview This section explains how to configure PWM output in hydraulic mode through an
application example
Hydraulic PWM Follow the steps below to configure the PWM output to control a hydraulic system:
Output
Stage Description
Configuration
Process 1 Configure the PWM output General tab
2 Configure the PWM output Hydraulic tab
3 Configure the PWM output Input tab
Apply Cancel
Apply Cancel
Command Displacement
Apply Cancel
Slow Slow
Fast Fast
9
At a Glance
Subject of this This chapter provides information on the software installation of the AS-Interface
Chapter Master module TWDNOI10M3 and its slaves.
General For the AS-Interface configuration, TwidoSuite software allows the user to:
Introduction ! Manually configure the bus (declaration of slaves and assignment of addresses
on the bus)
! Adapt the configuration according to what is present on the bus
! Acknowledge the slave parameters
! 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).
AS-Interface The AS-Interface module includes data fields that allow you to manage the lists of slaves
Master Structure and the images of input / output data. This information is stored in volatile memory.
The figure below shows TWDNOI10M3 module architecture.
TWDNOI10M3
1 I/O data
Parameters
2
current AS-Interface bus
3 Configuration /
Identification
4 LDS
5 LAS
6 LPS
7 LPF
Key:
Address Item Description
1 I/O data Images of 248 inputs and 186 outputs of AS-Interface V2 bus.
(IDI, ODI)
2 Current parameters Image of the parameters of all the slaves.
(PI, PP)
3 Configuration/ This field contains all the I/O codes and the identification
Identification codes for all the slaves detected.
(CDI, PCD)
4 LDS List of all slaves detected on the bus.
5 LAS List of slaves activated on the bus.
6 LPS List of slaves provided on the bus and configured via
TwidoSuite.
7 LPF List of slaves having a device fault.
2 Parameters P2
P0
Configuration/
3 Identification AS-Interface bus
4 Address
Key:
Address Item Description
1 Input/output Input data is stored by the slave and made available for the AS-
data Interface master.
Output data is updated by the master module.
2 Parameters The parameters are used to control and switch internal operating
modes to the sensor or the actuator.
3 Configuration/ This field contains:
Identification ! the code which corresponds to I/O configuration,
! the slave identification (ID) code,
! the slave identification codes (ID1 and ID2).
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 p. 244).
The following table shows the different software implementation phases of the AS-Interface bus.
Mode Phase Description
Local Declaration of module Choice of the slot for the AS-Interface Master module TWDNOI10M3 on the
expansion bus.
Configuration of the Choice of "master" modes.
module channel
Declaration of slave Selection for each device:
devices ! of its slot number on the bus,
! of the type of standard or extended address slave.
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.
Precautions Before connecting (via the software) the PC to the controller and to avoid any
Prior to detection problem:
Connection ! Ensure that no slave is physically present on the bus with address 0
! Ensure that 2 slaves are not physically present with the same address.
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.
Module configuration.
Description of This screen groups all data making up the bus in three blocks of information:
the Screen in
Blocks Description
Offline Mode
AS-interface Bus image desired by the user: view of standard and extended address
configuration 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:
! Characteristics: IO code, ID code, ID1 and ID2 codes (profiles), and
comments on the slave,
! Parameters: list of parameters (modifiable), in binary (4 check boxes) or
decimal (1 check box) form, at the discretion of the user,
! 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.
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.
Procedure for Procedure for creating or modifying a slave on the AS-Interface V2 bus:
Declaring and
Configuring a
Slave
Step Action
1 Select the desired address cell (from those available) in the bus image:
Module Configuration
Step Action
2 In the slave configuration screen, enter or modify:
! the name of the new profile (limited to 13 characters),
! a comment (optional).
Or click Insert from catalog button in the function bar and select a slave from the pre-configured AS-
Interface profile family.
Illustration of a Configuration Screen for a slave:
Apply Cancel
Comment Comment
Permanent parameters
Bits 0 Parameter 1 2 Parameter 3
Master mode
Activate data exchange Network down
Automatic addressing
Note:
! 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
! For a modification, the slave configuration screen is displayed with fields containing the values previously
defined for the selected slave
3 Enter:
! the IO code (corresponds to the input/output configuration),
! 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:
! the system's acknowledgement (box checked in "Bits" view, or decimal value between 0 and 15 in
"Decimal" view),
! 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.
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.
Step Action
6 Confirm the slave configuration by clicking on the Apply button.
The result is the check that:
! the IO and ID are authorized,
! 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 an 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 error).
Note: About the Schneider AS-Interface catalog: when you click Insert from
catalog, you can create and configure slaves in "Private family" (other than those
in the Schneider AS-Interface catalog.
AS-Interface
Catalog The Insert from catalog button can be used to facilitate configuration of
slaves on the bus. When you use a slave from the Schneider products family, use
this button to simplify and speed up configuration.
Clicking on Insert from catalog opens the following pane:
AS-Interface profile family:
6: Illuminated indicator banks Insert
AS-Interface Catalog: Illuminated indicator banks
Reference:XVBC21A
Profile AS-Interface... @ Comment
7.F.F.F XVBC21A std Illuminated indicator bank XVB AS-i adaptator unit for illuminated indicator banks
7.F.F.F XVBC21B std Illuminated indicator bank XVB XVB = MAXIMO.
This adaptator must be the lowest unit on the stack.
Version:
Supplier:Telemecanique
AS-i Profil:7.F.F.F
I/O Configuration:
Inputs:
D0: Status unit 1 : 1 = "OK", 0 = "NOK"
D1: Status unit 2 : 1 = "OK", 0 = "NOK"
D2: Status unit 3 : 1 = "OK", 0 = "NOK"
D3: Status unit 4 : 1 = "OK", 0 = "NOK"
Outputs:
Fallback = 0 by watchdog
D0: Unit 1 : "Off" = 0 / "On" = 1
D1: Unit 2 : "Off" = 0 / "On" = 1
The drop-down menu gives you access to all product families of the Schneider AS-
Interface catalog:
AS-Interface profile family:
6:Keyboards
Illuminated
Up/Down
5: indicator banks
Counter Insert
AS-Interface
5: Keyboards Catalog: Illuminated
6: Illuminated indicator banks @
Profi AS-Interface Comment Reference:XVBC21A
7: Command and signaling
7.F.F. XVBC21A
4: Motor-starters
std Illuminated indicator bank
7.F.F. XVBC21B std Illuminated indicator AS-i adaptator unit for illuminated indicator banks
11: Inductive sensors
9: Phototronic sensors
XVB = MAXIMO.
1: Private family This adaptator must be the lowest unit on the stack.
18: Compact IP20 interfaces
12: Telefast IP20 interfaces Version:
Supplier:Telemecanique
AS-i Profil:7.F.F.F
I/O Configuration:
Inputs:
D0: Status unit 1 : 1 = "OK", 0 = "NOK"
D1: Status unit 2 : 1 = "OK", 0 = "NOK"
D2: Status unit 3 : 1 = "OK", 0 = "NOK"
D3: Status unit 4 : 1 = "OK", 0 = "NOK"
Outputs:
Fallback = 0 by watchdog
D0: Unit 1 : "Off" = 0 / "On" = 1
D1: Unit 2 : "Off" = 0 / "On" = 1
D2: Unit 3 : "Off" = 0 / "On" = 1
D3: Unit 4 : "Off" = 0 / "On" = 1
After you have selected a product, the list of corresponding slaves appears. Click on
the required slave and validate by clicking "Insert"
Note:
! Click the product name in the AS-Interface catalog to display its characteristics
in the right pane.
! You can add and configure slaves that are not part of the Schneider catalog.
Simply select the private family and configure the new slave.
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:
! List of expected slaves (entered) during configuration with their name, and the list
of detected slaves (with unknown names, but otherwise expected),
! Status of the AS-Interface module and the slave devices,
! Image of the profile, parameters and input/output values of the selected slaves.
It also enables the user:
! To obtain diagnostics of the slaves on which an error has occurred (see p. 236),
! To modify the address of a slave in online mode (see p. 237),
! To transmit the image of the slaves to the configuration screen (see p. 239),
! To address all the slaves with the desired addresses (during the first debugging).
Illustration of the The illustration of the AS-Interface Window (in online mode only) looks like this:
AS-Interface
Window
Module configuration.
05 INOUT24/12
Comment Comment
06
WXA36 07 Permanent parameters
AS-Interface Bus
Configuration OK OFF Auto addressing possible OFF Slaves at Adr 0 Detected OFF ASI PWR Supply Cut OFF
Slaves OK ON Protected Mode OFF Auto Addressing Active ON Network Down OFF
Description of The AS-Interface Window provides the same information as the configuration
the AS-Interface screen (see p. 228).
Window The differences are listed in the following table:
Schedule Description
AS-interface V2 Image of the physical bus.
configuration Includes slave status:
! Green indicator lamp: the slave with this address is active.
! Red indicator lamp: an error has occurred 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:
! Characteristics: image of the profile detected (unavailable, non-modifiable),
! Parameters: image of the parameters detected. The user can select
only the parameter display format,
! Inputs/Outputs: the input/output values detected are displayed, non-
modifiable.
Error on the Informs you of the error type, if an error has occurred on the selected slave.
network
AS-Interface Bus Information resulting from an implicit "Read Status" command.
! 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,
! 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.
Displaying Slave When the indicator lamp associated with an address is red, there is an error on the
Status slave associated with this address. The "Error on the network" window then provides
the diagnostics of the selected slave.
Description of errors:
! The profile specified by the user by the configuration of a given address does not
correspond to the actual profile detected for this address on the bus (diagnostics:
"Profile error"),
! A new slave, not specified at configuration, is detected on the bus: a red indicator
lamp is then displayed for this address and the slave name displayed is
"Unknown" (diagnostics: "Slave not projected"),
! Peripheral fault, if the slave detected supports it (diagnostics: "Peripheral fault"),
! A configured profile is specified but no slave is detected for this address on the
bus (diagnostics: "Slave not detected").
At a Glance From the AS-Interface Window, the user can modify the address of a slave in online mode.
Modification of The following table shows the procedure for modifying a slave address:
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
Module configuration.
00
Slave 1A 01
02
03 ASI20MT4IE
04
05 INOUT24/12
06
WXA36 07
08
09
ASI20MT41E
10
11 Unknown
12
13
14
15
16
17
18
19
20
Step Description
Result:
All the slave parameters are automatically checked to see if the operation is possible.
Illustration of result:
Module configuration.
00
XVBC21A 01
02
03 ASI20MT4IE
04
05 INOUT24/12
06
WXA36 07
08
09
10
11 Unknown
12
13
14
15 Unknown
16
17
18
19
20
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.
Transfer of a In the case when a slave that is not specified in the configuration is detected on the
Slave Image to bus, an "Unknown" slave appears in the "AS-interface V2 Configuration zone" of the
the AS-Interface window for the detected address.
Configuration The following table describes the procedure for transferring the image of the
Screen. "Unknown" slave to the configuration screen:
Step Description
1 Access the AS-Interface window.
2 Select the desired slave in the "AS-interface V2 Configuration" zone.
3 Right click on the mouse to select "Transfer Conf".
Illustration:
Module configuration.
00
XVBC21A 01
02
03 ASI20MT4IE
04
05 INOUT24/12
06
WXA36 07
08
09
10
11 Unknown
12 Transfer Conf
13
14
15 Unknown
16
17
18
19
20
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.
Return to the When the user returns to the configuration screen, all the new slaves (unexpected)
Configuration which have been transferred are visible.
Screen Illustration of the configuration screen following the transfer of all slaves:
Module configuration.
00
XVBC21A 01
02
03 ASI20MT4IE
04
05 INOUT24/12
06
WXA36 07
08
09
10
11 Unknown
12
13
14
15 Unknown
16
17
18
19
20
Key:
! 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.
! 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 p. 237)), 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.
Procedure for Before transferring a new application to the module, the user can, for each slave, accept the
Transferring the detected profile and parameters (transferred to the configuration screen) or modify the
Definitive configuration "manually" (see p. 229).
Application to The following table describes the steps to follow to confirm and transfer the definitive
the Module 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:
! Select "Accept Conf" to accept the detected profile of the selected slave.
Illustration:
Module configuration.
00
XVBC21A 01
02
03 ASI20MT4IE
04
05 INOUT24/12
06
Cut
WXA36 07
Copy
08
09
Paste
10 Delete
11 Unknown
Accept Conf.
12
13
14
15 Unknown
16
17
18
19
20
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.
! 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:
! replacing a faulty slave,
! 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.
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 faulty, 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 p. 243).
Two options are available:
! The replacement slave is programmed with the same address using the pocket
programmer, and has the same profile and sub-profile as the faulty slave. It is
thus automatically inserted into the list of detected slaves (LDS) and into the list
of active slaves (LAS),
! The replacement slave is blank (address 0 (A), new slave) and has the same
profile as the faulty 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).
Addressing I/Os Associated with Slave Devices Connected to the AS-Interface V2 Bus
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.
Specific Values The table below gives specific values to AS-Interface V2 slave objects:
Part Values Comment
IA - Image of the physical discrete input of the slave.
QA - Image of the physical discrete output of the slave.
IWA - Image of the physical analog input of the slave.
QWA - Image of the physical analog output of the slave.
x 1 to 7 Address of AS-Interface module on the expansion bus.
n 0A to 31B Slot 0 cannot be configured.
i 0 to 3 -
Implicit The objects described below are exchanged implicitly, in other words they are
Exchanges exchanged automatically on each PLC cycle.
Explicit Objects (words and bits) associated with the AS-Interface bus contribute data (for
Exchanges 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:
! At the request of the program user by way of the instruction: ASI_CMD (see
"Presentation of the ASI_CMD" instruction below)
! Via the AS-Interface window or the animation table.
Reserved System words reserved in the Twido controller for the AS-Interface Master modules
Specific System enable you to determine the status of the network: %SW73 is reserved for the first
Words AS-Interface expansion module, and %SW74 for the second. Only the first 5 bits of
these words are used; they are read-only.
The following table shows the bits used:
System Bit Description
Words
0 system status ( = 1 if configuration OK, otherwise 0)
%SW73 1 data exchange ( = 1 data exchange is enabled, 0 if in mode Data Exchange
and Off (see p. 252))
%SW74
2 system stopped ( = 1 if the Offline (see p. 252) mode is enabled, otherwise 0)
3 ASI_CMD instruction terminated ( = 1 if terminated, 0 if in progress)
4 ASI_CMD error instruction ( = 1 if there is an error in the instruction,
otherwise 0)
Presentation of For each user program, the ASI_CMD instruction allows the user to program his
the ASI_CMD network and obtain the slave diagnostics. The instruction parameters are passed by
Instruction internal words (memory words) %MWx.
The syntax of the instruction is as follows:
ASI_CMDn %MWx:l
Legend:
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).
Using the The following table describes the action of the ASI_CMD instruction according to the
ASI_CMD value of the parameters %MW(x), and %MW(x+1) when necessary. For slave
Instruction diagnostics requests, the result is returned in %MW(x+1).
%MWx %MWx+1 Action
1 0 Exits Offline mode.
1 1 Switches to Offline mode.
2 0 Prohibits the exchange of data between the Master and its slaves
(enters Data Exchange Off mode).
2 1 Authorizes the exchange of data between the Master and its slaves
(exits Data Exchange Off mode).
3 Reserved -
4 Result Reads the list of active slaves (LAS table) with addresses from 0A to
15A (1 bit per slave).
5 Result Reads the list of active slaves (LAS table) with addresses from 16A to
31A (1 bit per slave).
6 Result Reads the list of active slaves (LAS table) with addresses from 0B to
15B (1 bit per slave).
7 Result Reads the list of active slaves (LAS table) with addresses from 16B to
31B (1 bit per slave).
8 Result Reads the list of detected slaves (LDS table) with addresses from 0A
to 15A (1 bit per slave).
9 Result Reads the list of detected slaves (LDS table) with addresses from 16A
to 31A (1 bit per slave).
10 Result Reads the list of detected slaves (LDS table) with addresses from 0B
to 15B (1 bit per slave).
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.
Details of the In the case when bus status is read by the ASI_CMD instruction (value of the %MWx
results of the parameter is equal to 16), the format of the result in the %MWx+1 word is as follows:
ASI_CMD
%MWx+1 Designation (1=OK, 0=NOK)
instruction to
read bus status least significant bit 0 Configuration OK
bit 1 LDS.0 (slave present with address 0)
bit 2 Auto addressing active
bit 3 Auto addressing available
bit 4 Configuration Mode active
bit 5 Normal operation active
bit 6 APF (power supply problem)
bit 7 Offline ready
most significant bit 0 Peripheral OK
bit 1 Data exchange active
bit 2 Offline Mode
bit 3 Normal mode (1)
bit 4 Communication fault with the AS-Interface Master
bit 5 ASI_CMD instruction in progress
bit 6 ASI_CMD instruction error
Details of the In the case of slave diagnostics by ASI_CMD instruction (%MWx value between 4 and
results of the 15), the slaves' status is returned in the bits (1=OK) of the %MWx+1 word. The following
ASI_CMD table gives the detail of the results according to the value of the %MWx word:
instruction to
read slave status
%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.
Programming To force the AS-Interface Master (positioned at 1 on the expansion bus) to switch to
Examples for the Offline mode:
ASI_CMD LD 1
Instruction
[%MW0 := 16#0001 ]
[%MW1 := 16#0001 ]
LD %SW73:X3 //If no ASI_CMD instruction is in progress, then continue
[ASI_CMD1 %MW0:2] //to force the switch to Offline mode
To read the table of slaves active for addresses 0A to 15A:
LD 1
[%MW0 := 16#0004 ]
[%MW1 := 16#0000 //optional]
LD %SW73:X3 //If no ASI_CMD instruction is in progress, then continue
[ASI_CMD1 %MW0:2] //to read the LAS table for addresses 0A to 15A
At a Glance The AS-Interface bus interface module TWDNOI10M3 has three operating modes,
each of which responds to particular needs. These modes are:
! Protected mode,
! Offline mode,
! Data Exchange Off mode.
Using the ASI_CMD (see p. 248) 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:
! continually checks that the list of detected slaves is the same as the list of
expected slaves,
! 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
p. 251) instruction, which also allows you to exit the mode and return to protected
mode.
Data Exchange When the Data Exchange Off mode is engaged, exchanges on the bus continue to
Off Mode function, but data is no longer refreshed.
This mode can only be accessed by using the ASI_CMD (see p. 248) instruction.
Subject of this This chapter describes how to install and configure the TWDNCO1M CANopen
Chapter master module, the Twido Extreme integrated CANopen bus and its slave devices
on the CANopen fieldbus.
At a Glance
Subject of this This section is intended to provide you with general knowledge about the CANopen
Section fieldbus technology and to introduce CAN-specific terminology that will be used
throughout the remainder of this chapter.
Introduction The following describes useful technical terms and acronyms for CANopen network
communication.
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.
About CANopen
The CANopen The CANopen protocol was created as a subset of CAL (CAN Application Layer
Protocol Protocol). By defining profiles, it can be more specifically adapted to use with
standard industrial components. CANopen is a CiA (CAN in Automation) standard
which was widely accepted by the motion industry as soon as it became available.
In Europe, CANopen is now recognized as the industry standard for industrial
systems based on a CAN design.
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.
Device The ability to configure devices via the CAN bus is a basic requirement made by
Configuration via manufacturers (for each profile family) to ensure autonomy.
the CAN Bus
General CANopen is a set of profiles for CAN systems with the following specifications:
Specifications ! open bus system,
for CANopen ! real-time data exchange without protocol overload,
Profiles ! modular design with possibility of resizing,
! interoperability and interchangeability of devices,
! supported by a large number of international manufacturers,
! standardized network configuration,
! access to all device parameters,
! synchronization and circulation of cyclical process data and/or event-driven data
(possibility of short system response times).
CANopen All manufacturers offering CANopen-certified products on the market are members
Product of the CiA group. As an active member of the CiA group, Schneider Electric
Certification Industries SAS develops its products in compliance with the standardization
recommendations set by this association.
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
Initialization
Reset Application
Reset Communication
Init
7 Pre-operational 6
4 5
4 3 Stopped 6
3 5
7 Operational 6
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
5 NMT service indication: STOP REMOTE NODE
6 NMT service indication: RESET NODE
7 NMT service indication: RESET COMMUNICATION
Active CANopen The crosses in the table below indicate which CANopen objects are active in each state.
Objects
Initialization Pre-operational Operational Stopped
depending on
State Machine PDO object X
SDO object X X
Emergency X X
Boot-Up X X
NMT X X X
Init The device goes into "Init" mode after being in the "Reset Communication" state.
This state enables you to:
! define the required communication objects (SDO, PDO, Emergency),
! install the corresponding CAL services
! 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.
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.
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.
PDO Producers PDOs are based on a "Producer / Consumer" model. The device that sends out a PDO
and Consumers is called the "producer" whilst the one that receives it is known as the "consumer".
Thus, writing an output to the TWDNCO1M master module, or to the Twido Extreme
integrated CANopen bus master, sends a TPDO associated with the master, which
contains the value of the output to be updated. In this case, the master is the PDO
"producer" (while the slave device is the PDO "consumer").
In contrast, an input is updated by the transmission of a RPDO by the master module
which is then the "consumer".
consumer(s)
Change of state "Change of state" corresponds to the modification of an input value (event control).
(Modes 254 Immediately after the change, the data is sent onto the bus. Event control makes it
and 255) possible to make optimal use of bus bandwidth, as only the modification is
transmitted, rather than the whole process image. This makes it possible to achieve
a very short response time, as when an input value is modified, it is not necessary
to wait for the next request from the master.
When selecting "change of state" PDO transmission, you should however bear in
mind that a number of events will probably occur at the same time, generating
delays whilst lower priority PDOs wait their turn to be transmitted to the bus. You
should also avoid a situation where continual modification of an input with a high-
priority PDO blocks the bus (this is known as a "babbling idiot").
Note: As a general rule, you should only choose to use PDO transmission with
analog input modules if the Delta mode (object 6426H) or the inhibit time (objects
1800H to 1804H, sub-index 3) are set to avoid a bus overload.
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.
Activation of If one of these two parameters is set to "0" (default configuration) the module does
Monitoring 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 These two monitoring mechanisms are particularly important to the CANopen
Monitoring system, given that devices do not usually operate in event-controlled mode.
Master If the master requests "Guarding" messages on a strictly cyclical basis, the slave
Monitoring can detect a master failure.
If the slave does not receive a request from the master within the defined "Life Time" interval
(Guarding error), it considers the a master failure has occurred ("Watchdog" function).
In this case, the corresponding outputs go into the 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" The value of the ''Toggle Bit'' (t) sent in the first ''Guarding'' message is ''0''.
Protocol 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:
Network state Response
Stopped 0x04 or 0x84
Pre-operational 0x7F or 0xFF
Operational 0x05 or 0x85
Switching the The internal bus automatically switches from the ''Stop'' to the ''Run'' state when the
Internal Bus to communication module switches from the "Pre-operational" to the "Operational" state.
the "Stop" State When the internal bus switches to the "Stop" state all the expansion module* outputs
are set to zero.
The communication module outputs are maintained in their current state.
Configuration of The internal bus is used to update the configuration of the discrete and analog
Expansion expansion module* parameters.
Modules The parameters are sent to the communication module when the bus is in the ''Stop'' state.
These new configuration parameters are acknowledged when the bus goes into the
''Run'' state.
Note: * Twido Extreme TWDLEDCK1 PLC does not support expansion modules.
Overview
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 and The following hardware and software is required to implement a CANopen bus on
Software your Twido compact or modular base:
Requirements
Hardware Requirements
Twido PLC compact or modular Compact base:
base controller ! TWDLC•24DRF
! TWDLC••40DRF
Modular base:
! TWDLMDA20•••
! TWDLMDA40•••
Software Requirements
Twido PLC configuration TwidoSuite
software
Software Requirements
Twido PLC configuration TwidoSuite
software
CANopen The following procedure will guide you through the installation, configuration and
Implementation use of your CANopen network:
Procedure
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
Twido Extreme For Twido Extreme base controller see (Network Wiring, Twido Extreme,
CANopen Wiring Programmable Controller, Hardware Guide).
Installing the For other compact or modular base controllers install the TWDNCO1M master
TWDNCO1M module on a Twido PLC system (DIN-rail or panel mounting) and connect it to the
Master Module Twido PLC internal bus (the connection method is the same as for Assembling an I/
O Expansion Module (Assembling an Expansion I/O module to a Base, Twido,
Programmable Controllers, Hardware Guide, Discrete I/O Modules)). Follow these
steps:
Step Action Description
1 Installation Preparation Consult the Twido Programmable Controllers
Hardware Reference Guide (TWD USE 10AE) for
instructions on:
! correct mounting positions for Twido modules,
! adding and removing Twido components from a
DIN rail,
! direct mounting on a panel surface,
! minimum clearances for modules in a control
panel.
2 Mounting the Install the TWDNCO1M master module on a DIN rail
TWDNCO1M Module or panel. For more details, see TwdoHW - Installing
an expansion module.
3 Module Connection to Connect the CANopen master module to the Twido
the Twido PLC’s Bus PLC internal bus (for more details, see TwdoHW -
Installing an expansion module).
4 CANopen Wiring and Follow the wiring and connections directions
Connections outlined in CANopen Wiring and Connections to
connect the CAN bus power supply and signal lines.
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 The following table describes the different software implementation phases of the
Methodology CANopen bus:
Mode Phase Description
Local CANopen master In the describe window, add a TWDNCO1M
declaration CANopen master module to your Twido
application.1
1
This is not needed in the case of the Twido Extreme TWDLDCK1, as the
CANopen master bus is integrated in the base controller.
Configuration of the Configure the CANopen network by:
CANopen network ! importing EDS files of all slave devices to the
network catalog,
! adding the slave devices from the catalog to the
CANopen network.
PDO mapping Perform the mapping of TPDOs and RPDOs
objects of each slave device declared on the
network.
PDO Linking Link each slave PDO to the corresponding master
module PDO.
Local or Symbolization Symbolization of the variables associated with the
connected (optional) slave devices.
Programming Programming the CANopen function.
Connected Transfer Transfer of the application to the PLC.
Debugging Debugging the application with the help of
animation and monitoring screens
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.
Precautions Before connecting (via the software) the PC to the controller and to avoid any
Prior to detection problem:
Connection ! Ensure that no slave is physically present on the bus with address 127 (127 is a
reserved, factory-set address assigned to the TWDNCO1M master module or to
the Twido Extreme integrated CANopen bus master).
! Ensure that there a no slaves installed on the CANopen bus with duplicate
addresses.
Overview This section explains how to declare a CANopen bus master module on your
compact or modular controller internal bus.
Procedure The table below shows the different steps when declaring the master CANopen.
Step Action Comment
1 Select Describe step from the TwidoSuite See (Describe Application Window, Twido Programmable
interface. Controllers, TwidoSuite Programming Software, Online
Help).
2 Display the product catalog and select a See (Positioning a Module, Twido Programmable
TWDNCO1M module to add to the system Controllers, TwidoSuite Programming Software, Online
description. Help).
Note: A TWDNCO1M master module can be inserted in
any available expansion position. It can be subsequently
moved to the left or right of other expansion modules.
You may continue adding other expansions module (up to
7 including the TWDNCO1M module).
Note: Only one TWDNCO1M CANopen master module is
allowed.
Only TWDC•A24DRF, TWDC••40DRF, TWDLMDA20•••
and TWDLMDA40••• controllers are supported.
Overview This section describes how to access the CANopen configuration tool.
CANopen The CANopen configuration tool is accessed from the Describe window by clicking
Configurator on the appropriate CANopen element as follows:
CANopen Action Result
element
CANopen double click (or
slave linked to right click and Mapping --> Slave_0
CANopen select
Available Objects PDO
master CANopen Type Transmit
3008 - digital io
Configuration) 3009 - digital io Name Index COD-ID
on slave 300A - capture 1 PDO RX1 1A00 182
301B - dev control 1A03 482
2 PDO RX4
301C - status
301F - monitor target
6041 - Statusword
6063 - position actual value int
6064 - position actual value Mapped Objects
606C - velocity actual value
16
# Name Index Size
1 Statusword 6041 16
OK Cancel
Name my network 1
Parameters
Supervision 300 ms
OK Cancel
Name Slave 0
Protocol
Type CANopen
Address 1
Supervision None
OK Cancel
OK Cancel
The Master CANopen configuration screen can also be viewed (but not edited) by
selecting Program$%$Configure$%$Configure the Hardware task.
! for Twido Extreme TWDLEDCK1, select the CANopen tab and click Configure.
! 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.)
Importing Slave The table below describes how to import new CANopen slaves profiles (.EDS files)
Profiles into the CANopen Configuration Tool catalog:
Step Action
1 Right click on CANopen Elements in the Catalog of the Describe window and
select Import as shown below.
Network Elements
Modbus Element
CANopen Elements
Import
(DS-401) I/O Modules
Advantys FTB (V1.0)
Advantys OTB (V1.0)
(DS-402) Drives and Motion Control
Lexium05 (V1.12)
BASIC_LXM05 (V1.0)
Lexium05 (V1.12)
ATV61_V1.2 (V1.1)
BASIC_ATV61 (V1.2)
ATV61_V1.2 (V1.1)
ATV71_V1.1 (V1.1)
BASIC_ATV71 (V1.0)
ATV71_V1.21 (V1.1)
ATV31_V1.2 (V1.2)
BASIC_ATV31 (V1.0)
ATV31_V1.2 (V1.2)
ASCII element
Result: The operating system’s Open dialog box appears.
2 Browse to the location of the folder containing the EDS files of CANopen slave
devices you want to add to the catalog.
Result: The name of available EDS files appears in the Open dialog box:
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
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:
Catalog
Place
Network Elements
Modbus Element
CANopen Elements
(DS-401) I/O Modules
Advantys FTB (V1.0)
Advantys OTB (V1.0)
(DS-402) Drives and Motion Control
Lexium05 (V1.12)
BASIC_LXM05 (V1.0)
Lexium05 (V1.12)
ATV61_V1.2 (V1.1)
BASIC_ATV61 (V1.2)
ATV61_V1.2 (V1.1)
ATV71_V1.1 (V1.1)
BASIC_ATV71 (V1.0)
ATV71_V1.21 (V1.1)
ATV31_V1.2 (V1.2)
BASIC_ATV31 (V1.0)
ATV31_V1.2 (V1.2)
ASCII element
Remote Twido
CANJ1939 Elements
BASIC_ATV371 (V1.0)
Vendor: Telemecanique
Description: EDS of the ATV71
Author: S.T.I.E.
Creation: 01-20-2004
Note: The device properties of the selected CANopen slave are shown in the
lower half of the Catalog area, these are:
! the vendor’s name (for example, Telemecanique),
! the slave profile (for example, EDS file for ATV 31 CANopen Slave),
! the author’s name (for example, Author S.T.I.E.),
! 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.
CANopen Elements
(DS-401) I/O Modules
Advantys FTB (V1.0)
Advantys OTB (V1.0)
(DS-402) Drives and Motion Control
Lexium05 (V1.12)
BASIC_LXM05 (V1.0)
Lexium05 (V1.12)
ATV61_V1.2 (V1.1)
Delete
BASIC_ATV61 (V1.2)
ATV61_V1.2 (V1.1)
ATV71_V1.1 (V1.1)
BASIC_ATV71 (V1.0)
ATV71_V1.21 (V1.1)
ATV31_V1.2 (V1.2)
BASIC_ATV31 (V1.0)
ATV31_V1.2 (V1.2)
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.
Building the The table below describes how to declare slave devices on a Twido CANopen
CANopen network. Note that you can only declare slaves whose EDS profiles have been
Network previously added to or are already stored in the Catalog. Some slaves (e.g.
Advantys FTB and OTB modules) require an external configuration tool. Such
slaves must be configured externally prior to connecting the slave to the master. If
the necessary tool is not installed on your PC, you will not be able to add these
slaves to the Describe graphical workspace..
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.
Catalog
Place
Bases
Expansion modules
Serial Expension Modules
Serial Adapters
RTC Cartridges
Memory Cartridges
Operation Display
Network Elements
Modbus Element
CANopen Elements
(DS-401) I/O Modules
Advantys FTB (V1.0)
Advantys OTB (V1.0)
(DS-402) Drives and Motion Control
Lexium05 (V1.12)
BASIC_LXM05 (V1.0)
Lexium05 (V1.12)
ATV61_V1.2 (V1.1)
BASIC_ATV61 (V1.2)
ATV61_V1.2 (V1.1)
ATV71_V1.1 (V1.1)
BASIC_ATV71 (V1.0)
ATV71_V1.21 (V1.1)
ATV31_V1.2 (V1.2)
BASIC_ATV31 (V1.0)
ATV31_V1.2 (V1.2)
Step Action
2 Drag and drop the desired number of slave devices from the Catalog. (See
Positioning Methods and Rules (Positioning Methods and Rules, Twido
Programmable Controllers, TwidoSuite Programming Software, Online Help))
Result: The devices appear unconfigured in the graphical workspace of the
Describe window.
Notes:
! 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 p. 290).
! A maximum of 16 slaves can be declared on a Twido CANopen network.
Element
Name Slave 0
Protocol
Type CANopen
Address 1
Supervision None
OK Cancel
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 (Creating a
Link, Twido Programmable Controllers, TwidoSuite Programming Software,
Online Help).
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 p. 279).
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 The error control protocol you wish to use to manage communications between the
Options 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:
! Node Guarding
! Heartbeat
! 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:
! disconnection of the expansion TWDNCO1M CANopen master module from the
Twido PLC base controller (not applicable to Twido Extreme controller),
! disconnection of this CANopen slave from the Twido CANopen bus,
! a faulty bus cable,
! a TwidoSuite "Reset" command (Online % Firmware / Reset),
! a TwidoSuite load configuration command (Online % Download),
! a command for firmware download to the TWDNCO1M master module (or to
Twido Extreme base controller) via TwidoSuite (Online % Firmware Download)
(not applicable to Twido Extreme controller.
Configuring the The procedure below describes how to configure network management parameters
Network such as the Baudrate (network speed) and life-time. (Error control protocols are
Management defined in the slave configuration)
Parameters
Step Action
1 To configure network management parameters, right click on the network
link and select Configure.
Result:
Configuration
CANopen network
Name my network 1
Parameters
Supervision 300 ms
OK Cancel
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.
Mapping To access the Mapping dialog box, double click (or right click and select CANopen
Dialog box Configuration) on a linked slave. This option is unavailable if the slave is not linked
to a CANopen Master.
Result: The Mapping dialog box appears on screen, as shown in the following
figure:
Mapping --> Slave_0
Cancel OK
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:
Mapping --> Slave_0
OK Cancel
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
56
right in the Mapped Objects frame: .
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.
Linking To access the Linking dialog box, double click (or right click and select CANopen
Dialog Box Configuration) the CANopen Master port on the TWDNCO1M master module or
the Twido Extreme integrated CANopen bus master.
Result: The Linking dialog box appears on screen, as shown in the following figure:
Linking
SDO
Memory space 18%
OK Cancel
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:
Linking
OK Cancel
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
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:
Module configuration.
2 Edit the entries in the Symbol column: give descriptive names for the variables.
You can use up to to 32 characters:
! Letters a-z
! Numbers 0-9
! Underscore _
All other characters and spaces are forbidden.
Note: For more information about editing symbols, please refer to Symbolizing
Objects, p. 52.
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.
Specific Values The table below gives specific values to CANopen slave objects:
Part Values Comment
IWC - Image of the physical PDO input.
QWC - Image of the physical PDO output.
IWCD - Same usage as IWC, but in double-word
format.
QWCD - Same usage as QWC, but in double-word
format.
IWCF - Same usage as IWC, but in float format.
QWCF - Same usage as QWC, but in float format.
x 1 to 7 Address of TWDNCO1M CANopen
master module on the Twido expansion
bus.
For Twido Extreme x=1
n 0 to 15 PDO number (according to PDO index.)
i 0 to 7 Channel number (according to PDO sub-
index.)
Implicit The objects described below are exchanged implicitly, in other words they are
Exchanges exchanged automatically on each PLC cycle.
Explicit Objects (words and bits) associated with the CANopen fieldbus contribute data (for
Exchanges 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:
! at the request of the program user by way of the instruction: CAN_CMD (see
"Presentation of the CAN_CMD" instruction below)
! via the debug screen or the animation table.
CANopen Master System words reserved in the Twido controller for the TWDNCO1M CANopen
Reserved Master module enable you to determine the status of the network: %SW8x (x=1-7)
Specific System is reserved for the CANopen master moduled installed at expansion address x on
Words the Twido bus. Only the first 7 bits of these words are used; they are read-only.
For the Twido Extreme integrated CANopen bus master the reserved specific
system word is always %SW81 (%SW82 ... %SW87 are unused).
The following table shows the bits used:
System Bit Description
Words
0 Configuration status of CANopen master ( = 1 if configuration OK,
%SW8x otherwise 0)
(x=1-7) 1 Operational mode of CANopen master ( = 1 data exchange is
enabled, otherwise 0)
2 System stopped ( = 1 if the Offline mode is enabled, otherwise 0)
3 CAN_CMD instruction complete ( = 1 if command complete,
otherwise 0 when command is in progress)
4 CAN_CMD instruction error ( = 1 if there is an error in the
instruction, otherwise 0)
5 Initialization error ( = 1)
6 Loss of message, power supply error ( = 1)
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.
CANopen Slave %SW20 to %SW27 are reserved system words that allow you to know the current
Reserved state of the 16 CANopen slaves with node addresses ranging from 1 to 16. The
Specific System content of these memory words is read-only.
Words The following table describes system words %SW20 to %SW27:
Node address
System (slave number)
Word content / Description
words Bit Bit
[15-8] [7-0]
%SW20 2 1 When %SW2x takes the following value:
%SW21 4 3 ! = 0 => All modules were missing on the CANopen bus at
Node address
System (slave number)
Word content / Description
words Bit Bit
[15-8] [7-0]
! = 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".
! = 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".
! = 8 => Wrong module (a module was detected with
different device identity information):
- "error free".
! = 9 => Wrong module (a module was detected with
different device identity information):
- "not error free".
! = 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".
! = 11 => Slave configuration error:
- "not error free".
! = 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]
! = 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)
! = 14 => Unexpected module (a module was detected that
is not in the configuration table):
- "error free".
! = 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:
! =0, for a slave means that all slaves are missing,
! =13, for a slave means that this slave is missing and at least 1 slave is
present on the CANopen bus.
Presentation of For each user program, the CAN_CMD instruction allows the user to program his
the CAN_CMD network and obtain the slave diagnostics. The instruction parameters are passed by
Instruction internal words (memory words) %MWx.
The syntax of the instruction is as follows:
CAN_CMDn %MWx:l
Legend:
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).
Using the The CAN_CMD instruction allows you to program and manage the CANopen
CAN_CMD network and to perform diagnostic checks of individual slave devices. Command
Instruction parameters are passed via memory words %MWx.
The following table describes the action of the CAN_CMD instruction according to
the value of the parameters %MW(x) to %MW(x+5) as needed:
%MWx %MWx+1 %MWx+2 %MWx+3 %MWx+4 %MWx+5
Bit Bit Bit Bit Bit Bit Bit Bit Bit Bit
Action
[15- [7-0] [15- [7-0] [15- [7-0] [15- [7-0] [15- [7-0]
8] 8] 8] 8] 8]
Reset CANopen
1 0
communication.
1 1 Reset CANopen nodes.
–
Switch from operational to pre-
2 0
operational mode.
2 1 Switch to operational mode.
3 => Start Read SDO
command.
3 or 4
4 => Start Write SDO
command.
Node Node = 1-16 => Node address
Index PDO object index.
Sub = 0-255 => Object sub-
Sub Len index
Len = Length of data in byte
Payload according to the
Data 1
length field (Len) value
Payload according to the
Data 2
length field (Len) value
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.
Programming Example 1:
Examples for the To force the TWDNCO1M CANopen Master (located at address 1 on the Twido
CAN_CMD expansion bus) or the Twido Extreme integrated CANopen bus master to switch to
Instruction Init mode:
LD 1
[%MW0 := 16#0001]
[%MW1 := 16#0001]
LD %SW81:X3 (* If no CAN_CMD instruction is in *)
(* progress, then continue *)
[CAN_CMD1 %MW0:2] (* To force the CANopen master to *)
(* switch to Init mode *)
----
LDN %SW81:X4 (* (optional) To know if the CAN_CMD *)
(* instruction has been succesfully completed, before *)
(* sending a new one. *)
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*)
CANopen Hot The CANopen network with a Twido Controller and CANopen master TWDNCO1M
Swap (with firmware version 2.0 or higher) supports hot swap. The Twido Extreme also
supports hot swap. Hot swap means that you can disconnect and reconnect a
CANopen slave without switching off/on the master (or without disconnecting it from
the PLC in the case of a Twido Extreme controller).
Hot Swap The hot swap functionality is available only if node supervision (Guard Time or
Compatibility HeartBeat) has been configured. For more details on how to configure node
supervision see p. 288.
Subject of this This chapter describes how to install and configure a CANJ1939 Fieldbus with a
Chapter Twido Extreme TWDLEDCK1 base controller.
At a Glance
Subject of this This section provides general information on the CANJ1939 fieldbus and introduces
Section CANJ1939-specific terminology that will be used throughout the remainder of this chapter.
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.
Electronic Electronic Control Unit (ECU) is a computer based electronic assembly from which
Control Unit CANJ1939 messages may be sent or received.
(ECU) In the remainder of this document ECUs are called CANJ1939 elements.
Parameter Group In the CANJ1939 specification, similar or related parameters (signals) are grouped
Number (PGN) together into a Parameter Group (PG). Each Parameter Group can be identified via
a unique number: its Parameter Group Number (PGN) (see p. 311).
Note: A detailed list of all SPNs and PGNs is provided by the SAE committee in a
MS Excel spreadsheet (see http://www.sae.org/).
Additional Form more details about CANJ1939, please refer to the following SAE literature:
Sources
Document Document Name
Reference Number
SAE J1939 Recommended Practice for a Serial Control and Communications
Vehicle Network
SAE J1939-11 Physical Layer—250K Bits/s, Shielded Twisted Pair
SAE J1939-13 Off-Board Diagnostic Connector
SAE J1939-15 Reduced Physical Layer, 250K Bits/s, Un-Shielded Twisted Pair (UTP)
SAE J1939-21 Data Link Layer
SAE J1939-31 Network Layer
SAE J1939-71 Vehicle Application Layer
SAE J1939-73 Application Layer - Diagnostics
SAE J1939-81 Network Management Protocol
Introduction This section presents information relating to the Parameter Group Number and
Suspect Parameter Number usage on a CANJ1939 network.
Parameter Group Parameter Group (PG) is a collection of parameters that are conveyed in a
(PG) CANJ1939 message.
Parameter Groups include:
! commands
! data
! requests
! acknowledgments
! negative-acknowledgments
The PG is not dependent on the source address field: any source is allowed to send
any PG.
Parameter Group The Parameter Group Number (PGN) is a 24-bit representation that identifies a
Number (PGN) particular PG.
The PGN structure permits a total of up to 8672 different parameter groups. With the
transmission of a parameter group, the PGN is coded in the CAN identifier.
Suspect A Suspect Parameter Number (SPN) is a 19-bit number used to identify a particular
Parameter element, component, or parameter associated with an ECU (CANJ1939 element).
Number (SPN) This capability is especially useful for diagnostics, permitting an ECU which has
detected a fault associated with a particular component, such as a sensor, to
transmit a fault message identifying the faulty component. SPNs are assigned by the
SAE (Society of Automotive Engineers) Committee. The first 511 SPNs are reserved
and will be later assigned to correspond to the exact same number as the Parameter
Identifier (PID) of J1587.
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:
! A value of 000 has the highest priority. Higher priority messages would typically
be used for high speed control messages.
! 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.
PDU Format (PF) The PF field (8 bits) identifies one of two message formats that can be transmitted:
! If 0 # PF # 239, then PDU1 format is used for peer-to-peer (see p. 314)
communication methods.
! If 240 # PF # 255, then PDU2 format is used for broadcast communication (see
p. 314) methods.
PDU Specific The PS field (8 bits) is dependent on the value of the PDU:
(PS) ! If PDU1 format is used then the PS field contains a Destination Address (DA). 240
Parameter Groups are provided in each data page of PDU1 format
! If PDU2 format is used then the PS field contains a Group Extension (GE). The
Group Extension field, in conjunction with the four least significant bits of the PDU
Format field, provide for 4096 Parameter Groups for each Data Page (DP)
Source Address The Source Address field (8 bits) contains the unique address of the ECU
(CANJ1939 element) transmitting the message.
Other Fields ! SOF (Start Of Frame): The initial bit in a CAN frame used only to indicate the
beginning of the frame.
! SRR (Substitute Remote Request): This bit is entirely defined and controlled by
CAN and therefore not described or modified by CANJ1939.
! IDE (Identifier Extension Bit): This bit is entirely defined and controlled by CAN
and therefore not described or modified by CANJ1939.
! 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 CANJ1939 uses the CAN protocol which permits any device to transmit a message
Detection 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 For a given network, each network element address must be unique (0 to 254, 255
Assignment 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.
At a Glance
Introduction This section describes how to implement a CANJ1939 fieldbus using the
Twido Extreme TWDLEDCK1 base controller.
Hardware and The following hardware and software is required to implement a CANJ1939 bus on
Software your Twido PLC system:
Requirements
Hardware Requirements
Twido Extreme PLC base Extreme base
! TWDLEDCK1
Programming cable for the Twido Extreme PLC PC to controller programming cable: serial
! VW3 A8106
Software Requirements
Twido PLC configuration software TwidoSuite V2.0 or higher
CANJ1939 The following procedure will guide you through the installation, configuration and
Implementation use of your CANJ1939 network:
Procedure
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 p. 329).
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.
CANJ1939 The following table describes the different software implementation phases for a
Configuration CANJ1939 network. For a more detailed description of how to create and configure
Methodology a CANJ1939 network in TwidoSuite (see Creating a CANJ1939 Network, Twido
Programmable Controllers, TwidoSuite Programming Software, Online Help).
Mode Phase Description
Local Hardware Create a CANJ1939 network, in the graphical workspace of the
selection Describe window of TwidoSuite, by selecting a Twido Extreme
TWDLEDCK1 base controller and the desired number of
CANJ1939 devices from the Product Catalog.
Configuring the Configure the CANJ1939 network in the Describe window by:
CANJ1939 ! allocating a unique address (0 to 254, 255 is available for
network Broadcast) (2) to each CANJ1939 element. A single
CANJ1939 device may have multiple addresses. In which
case several elements with the same name should be created
in TwidoSuite but with different addresses. For further details
of these dialog boxes (see p. 320),
! connecting the elements together in the graphical workspace
(see (Creating a CANJ1939 Network, Twido Programmable
Controllers, TwidoSuite Programming Software, Online
Help)),
! defining appropriate (receive or transmit) message objects
(maximum 8 bytes of data) for each relevant CANJ1939
element. For further details see p. 323.
Viewing Previously defined message objects may be viewed in the
CANJ1939 Program$%$Configure$%$Configure the Hardware window
message (Module Configuration pane, select CANJ1939 tab).
objects For further details of this configuration pane (see p. 329),
Renaming Message objects have predefined descriptive names. You can,
message however, edit these names (maximum 32 characters) in the
objects Program$%$Configure$%$Configure the Hardware window
(optional) (Module Configuration pane, select CANJ1939 tab).
Programming Programming the CANJ1939 function.
Online Transfer Transfer of the application to the PLC.
Debugging Debugging the application with the help of animation and
monitoring screens
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 p. 309).
2. Element addresses are restricted to values 0 to 254. See p. 309
Overview This section details the CANJ1939 Configuration Dialog boxes used in the Describe
window of TwidoSuite.
Configuring a The following table shows how to configure a CANJ1939 element, network or port
CANJ1939 that you have previously created and details the corresponding dialog box fields:
Element/
Network/Port
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
Configuration
Port
Type CANJ1939 Address 234
Expert Mode
List of objects on transmission
# Periodic
Priority mode
Periodic mode Period Descr.
0 A/C High Pressure Fan Switch 6 100 See
Cancel OK
Step Action
3 Element Configuration dialog box
Configuration
Element
Name Element 1
Protocol
Type CANJ1939 Address 1
Expert Mode
List of objects on transmission
# Priority Periodic mode Period Descr.
Cancel OK
Network
Name my network 1
Type CANJ1939
Cancel OK
Step Action
5 The following fields can be modified (optional):
! Name: the default name is "Element 1" (for element) and "My network 1"(for network) and this field is
limited to 32 characters.
! Address: the default value is 0. Element addresses are restricted to values 0 to 255.
! 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.
! #: this takes values from 0 to 31 and provides a simple identification number for different types of messages (see
p. 309). 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.
! 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 p. 309). 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 #.
! 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 #.
! 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.
! 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.
! Descr: press this button to display a description of the message object (SPN).
! Processor instance:(1) indicates to the CANJ1939 element which PLC will send it messages. Authorized
values are 0 and 1.
! 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.
! 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 p. 314.
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.
Creating Transmit/ The following steps show how to create transmit/receive objects.
Receive Objects
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).
Configuration
Port
Type CANJ1939 Address 234
Expert Mode
List of objects on transmission
# Periodic
Priority mode
Periodic mode Period Descr.
Cancel OK
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 p. 320.
Step Action
2 Click "Add an object".
Result: the following dialog box opens:
Configuration
Adding an object
User Receive Source address All
Object A/C High Pressure Fan Switch
Description
Switch signal which indicates that the pressure in the coolant circuit of an air conditioning
system is high and the fan may be engaged.
00 - Pressure normal
01 - Pressure high, fan may be engaged
10 - Error
11 - Not available
Cancel OK
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
p. 327) 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 p. 335.
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:
Configuration
Port
Type CANJ1939 Address 0
Cancel OK
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 conflict errors 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).
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 p. 320
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.
Message Object This table summarizes what it means to add transmit/receive objects on the
Summary CANJ1939 or on the CANJ1939 port.
Transmit object added Receive object added
on an Element Twido Extreme sends a message to Twido Extreme will deal with this message if this element
(Peer-to-Peer) an element. (This enables the sends it
element to receive this message)
on the CANJ1939 Twido Extreme sends a message to Twido Extreme will deal with this message if it appears on
Port an element configured to receive it the network
(Broadcast) (i.e., the element has the same Note: you can configure Twido Extreme to deal with this
message object declared as a message from All CANJ1939 elements or from just one
transmit object) CANJ1939 element
Message Object The # field is a TwidoSuite index for the created object groups (PGNs) and takes
Indexes values from 0 to 31. If two or more message objects come from the same parameter
group, they will share the same #. Thus 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. It is not possible to create a message object
with an # index that has already been used by another element or port (TwidoSuite
produces an error message in such cases). To resolve this, you can manually edit
the # field and assign a new index number.
Note: To ensure that all the added SPNs are later accessible in the Program$%$
Configure$%$Configure the Hardware (Module Configuration pane, CANJ1939
tab) window, make sure that the created message objects have consecutive #
indexes. 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.
Deleting Transmit/ The following steps show how to delete transmit/receive objects.
Receive Objects
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:
Configuration
Element
Expert Mode
List of objects on transmission
# Priority Periodic mode Period Descr.
0 Engine Requested Speed/Speed Limit 6 100 See
Cancel OK
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 p. 335.
3 Repeat steps 1 and 2 for each message object you wish to delete.
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.
See p. 318 for general configuration information and see p. 323 to add and delete
message objects.
?
010
01
10
10 10
0 10
0 01 1 0 01 0 0 10 0
101 01 01 0 0 0
0 10 010 1 0 00 01 01 0 0 0 0 1 00 1 0 0 0
010 1 0 00 11 1 0 0 1 0 01 0 1 0 0 0
110 0 0 10 01 1 0 0 11 1 0 0 1 0
011 0 00 01
0 01 0 1 0 0
1
010 01
Project Describe Program Report
My Twido @1 Configure
the Hardware
Configure
the data
Configure
the behavior
Define
TWDLECK1
the Protections
Module configuration.
Apply Cancel
Inputs Outputs CAN J1939 CANopen
TwidoSuite
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
p. 327) 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 p. 336.
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.
Broadcast In a CANJ1939 network each device (element) has at least one address. Most
Messages messages, however, are broadcast, and, therefore not directed to a specific
destination address.
CANJ1939 Messages consist of a 29-bit identifier (see p. 312 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 p. 312).
Broadcast messages are created in TwidoSuite by adding message objects on the
port in the Describe window of TwidoSuite.
Broadcast The table below shows how to create a CANJ1939 message that will be broadcast
Messages by the Twido Extreme to all network devices.
Transmitted by
Step Action
Twido Extreme
1 Create and configure your CANJ1939 network in the Describe window of TwidoSuite.
See ( Describing Applications, TwidoSuite Online Help) and ( Creating a CANJ1939
Network, TwidoSuite Online Help).
2 Add the desired Transmit object(s) to the port. This will be broadcast to all elements
on the network (see p. 323). 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 p. 329.
Broadcast Twido Extreme can be configured to receive messages that are broadcast on the
Messages CANJ1939 network. TwidoSuite can only be used to configure Twido Extreme
Received by controllers. Other non-Twido products connected on the CANJ1939 network cannot be
Twido Extreme configured using TwidoSuite. The table below shows how to configure the
Twido Extreme to receive messages that will be broadcast by the CANJ1939 element.
Step Action
1 Create and configure the CANJ1939 network in the Describe window of TwidoSuite.
See ( Describing Applications, TwidoSuite Online Help) and ( Creating a CANJ1939
Network, TwidoSuite Online Help).
2 Add the desired Receive object(s) to the port (see ( Creating a CANJ1939 Network,
TwidoSuite Online Help)). 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.
Seep. 323.
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 p. 329.
Peer-to-Peer The table below shows how to create a CANJ1939 message that will be sent by the
Messages Twido Extreme to a specific address.
Transmitted by
Step Action
Twido Extreme
Defined on an 1 Create and configure your CANJ1939 network in the Describe window of TwidoSuite.
Element See Describing Applications, TwidoSuite Programming Software, Online Help and
Creating a CANJ1939 Network, TwidoSuite Programming Software, Online Help.
2 Add the desired Transmit object(s) to the element (see p. 323). 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 p. 329.
Peer-to-Peer Twido Extreme can be configured to receive messages that are sent by another
Messages device (Peer-to-Peer) on the CANJ1939 network. TwidoSuite can only be used to
Received by configure Twido Extreme controllers. Other non-Twido products connected on the
Twido Extreme CANJ1939 network cannot be configured using TwidoSuite. The table below shows
Defined on an how to configure the Twido Extreme to receive messages that are sent by another
Element device (Peer-to-Peer) on the CANJ1939 network.
Step Action
1 Create and configure your CANJ1939 network in the Describe window of TwidoSuite.
See Describing Applications, TwidoSuite Programming Software, Online Help and
Creating a CANJ1939 Network, TwidoSuite Programming Software, Online Help.
2 Add the desired Receive object(s) to the element (see p. 323). 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 p. 329.
Messages Sent Only messages sent by the Twido Extreme can be created in TwidoSuite. Messages
by Other Devices sent by other CANJ1939 elements (devices) cannot be configured in TwidoSuite.
These must be created in the device firmware.
Selecting Expert In the TwidoSuite Describe Window, double-click the network, element or port that you wish
Mode to configure to open the Configuration dialog box. Select the Expert Mode check box.
Result: The Add/Delete an Object buttons are now called Add/Delete an SPN. The
corresponding PGNs/SPNs are revealed. All objects that are added are displayed
with their PGNs and SPNs.
PGNs and SPNs 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 p. 311
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 p. 339 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.
Specific Values The table below gives specific values to CANJ1939 objects:
Part Values Comment
IWC - Image of the physical PGN input.
QWC - Image of the physical PGN output.
IWCD - Same usage as IWC, but in double-word format.
QWCD - Same usage as QWC, but in double-word format.
IWCF - Same usage as IWC, but in floating point format.
QWCF - Same usage as QWC, but in floating point format.
0 0 This is always O for CANJ1939 (and always 1 for CANopen).
i 0 to 31 PGN index (# in the Describe Configuration dialog box)
j 0 to 7 for word Channel number (the position (in bytes) of the SPN)
0 to 6 otherwise
Note: 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. This address cannot be used directly in an SPN Request
program. The SPN size, however, can be used in such a program.
Double Word and Single, double length and floating point words share the same memory zone. Thus, the
Floating Point I/Os floating point word %IWCF0.i.1 and the double word %IWCD0.i.1 correspond to the single
length words %IWC0.i.j and %IWC0.i.j+1 (the word %IWC0.i.j containing the least significant
bits and the word %IWC0.i.j+1 the most significant bits of the word %IWCF0.i.j)
The table below shows the overlap of memory allocation for single and double
floating point words of type %IWC. The same applies for %QWC.
Double and Floating Point format Single word format
Even address Odd address
%IWCD0.i.0/ ... %IWC0.i.0
%IWCF0.i.0 %IWCD0.i.1/ %IWC0.i.1
%IWCD0.i.2/ %IWCF0.i.1 %IWC0.i.2
%IWCF0.i.2 %IWCD0.i.3/ %IWC0.i.3
%IWCD0.i.4/ %IWCF0.i.3 %IWC0.i.4
%IWCF0.i.4 %IWCD0.i.5/ %IWC0.i.5
%IWCD0.i.6/ %IWCF0.i.5 %IWC0.i.6
%IWCF0.i.6 ... %IWC0.i.7
Note: There are no special instructions (like CAN_CMD for CANopen) in CANJ1939.
%SW33 to %SW40 provide status information concerning the 32 PGN input/output objects.
The following table illustrates these I/O system words
%SWx PGN object number Content
%SW33 3 -2 1-0 4 bits per PGN :
%SW34 7-6 5-4 0 = Normal state
1 = PGN received without error
%SW35 11- 10 9-8
2 = Forces PGN output to be written
%SW36 15 -14 13- 12 4 = PGN error (input or output)
%SW37 19 - 18 17 - 16 There are 3 types of PGN error
! error on PGN reception
%SW38 23 - 22 21 - 20
! time out on PGN reception
%SW39 27 - 26 25 -24
! error on PGN transmission
%SW40 31 -30 29 - 28
For example, to force the PGN output to be written for a particular PGN, set bit 2 in
the corresponding %SW.
CANJ1939 Ladder or List programs are created in a similar way to other Twido applications.
Programming See p. 391 and p. 413. 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.
CANJ19393 Error The following conditions will produce error messages in a program concerning
messages CANJ1939 I/O objects:
! When entering an object (%IWC0, %QWC0, %IWCD0, %QWCD0, %IWCF0 and
%QWCF0) the SPN number i (0 to 31) or channel number j (0 to 7) is out of range.
! The PLC chosen in the Describe window does not support the CANJ1939
protocol.
! There is no SPN defined at address i, channel j.
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:
! SPN labelled RQST is used by the Twido Extreme to request a PGN from a
CANJ1939 element.
! System Word %SW33 is used to force a PGN output.
Process of a PGN The following diagram illustrates a PGN request through an example. In this
Request example, the Twido Extreme sends a request to the CANJ1939 element for the
Exhaust Temperature Parameter Group. This process is explained in the table that
follows:
1
@0
CANJ1939 element
@1
J1939
my network 1
CANJ1939 element 2
List of objects on transmission
Parameter Group Number (RQST)
List of objects on reception
Engine Exhaust Gas Temperature -
Right Manifold
Note: SPN Engine Exhaust Gas Temperature - Right Manifold is a part of the global Exhaust Temperature
PGN.
The table below details the process of a PGN request:
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)
Using SPN RQST To use the SPN RQST method, configure the CANJ1939 Network as detailed below
in the following example:
Step Action Window location in TwidoSuite
1 Create a CANJ1939 network with a CANJ1939 element. Describe
For further details on how to create a CANJ1939 network, see (Creating
a CANJ1939 Network, Twido Programmable Controllers, TwidoSuite
Programming Software, Online Help).
2 On the CANJ1939 element: Describe
! Add the Parameter Group Number (RQST) transmit SPN. For
further details on how to define appropriate (receive or transmit)
SPN, see p. 323.
! Add the receive SPN that you want to request (for example Engine
Exhaust Gas Temperature - Right Manifold). For further details on
how to define appropriate (receive or transmit) SPN, see p. 323.
3 On the CANJ1939 element: Describe
1. Right-click and select configuration.
2. Select the Expert Mode check box.
3. Record the PGN you want to request. (For example, the number of
the Parameter Group Exhaust Temperature is 65031)
4 Record the address of the output exchange word (%QWCD0.y.z) Program$%$Configure$%$
assigned to the SPN RQST that you have added in the previous step. Configure the hardware$%$
CANJ1939 tab$%$Address field
5 Assign the PGN you want to force to the output exchange word Program$%$Program$%$Edit
%QWCD0.y.z recorded. Program
Example: to make a request on the PG Exhaust Temperature
(PGN=65031(16#FE07)), use the list instruction:
%QWC0.0.0 := 16#FE07
Note: You can also adjust %QWCD0.y.z online using the animation
table.
6 See the value of the forced parameter in the input exchange word
%IWCD0.y.z. online by:
! using the animation table (see (Debugging Online Using Program
Animation Tables, Twido Programmable Controllers, TwidoSuite
Programming Software, Online Help),
! connecting %IWCD0.y.z on an output.
Note: If the parameter requested is not available, the CANJ1939 element send a Non-ACKnowledgement (NACK)
to the Twido Extreme.
Using System To use the System Word %SW33 method follow this procedure, which is illustrated
Word %SW33 in the application example bellow:
Step Action Window location in
TwidoSuite
1 On the CANJ1939 element you want to force a PGN output: Describe
1. Right-click and select configuration.
2. Select the Expert Mode check box.
3. Record the PGN you want to force.
2 Record the address of the output exchange word (%QWCD0.y.z) assigned to Program$%$
the PGN that you want to force. Configure$%$
Configure the
hardware$%$
CANJ1939 tab$%$
Address field
3 Set the System Word %SW33 to 2 (see example below). Program$%$Program$
Note: You can also adjust %QWCD0.y.z online using the animation table %$Edit Program
4 Assign the PGN you want to force to the output exchange word %QWCD0.y.z Program$%$Program$
recorded (see example below). %$Edit Program
Note: You can also adjust %QWCD0.y.z online using the animation table
5 See the value of the requested parameter in the input exchange word
%IWCD0.y.z. by:
! using the animation table (see (Debugging Online Using Program Animation
Tables, Twido Programmable Controllers, TwidoSuite Programming
Software, Online Help)),
! connecting %IWCD0.y.z on an output.
System Word This example shows how to force an Exhaust Temperature PG output every second:
%SW33 Example Assumptions:
! You want to force the PG Exhaust Temperature (PGN=65031(16#FE07))
transmission.
! The output exchange word %QWCD0.0.0 is assigned to the PGN 65031.
2 LD
Enter your comments here. Enter your comments
2 LD SUBROUTINE 2 here.
Enter your comments here. Enter your comments
Rung 0
%M0 %Q0.0
P
%SW33 := %SW33 OR 2
%SW33 := %SW33 OR 2
%QWCD0.0.0 := 16#FE07
%QWCD0.0.0 := 16#FE07
Subject of this This chapter provides information on the software configuration of the ConneXium
Chapter TwidoPort Ethernet Gateway module.
At a Glance
Subject of this This section provides information on how to perform a normal configuration of the
Section ConneXium TwidoPort module with the TwidoSuite application program, module
connectivity and BootP configuration information, as well.
Installing the To install TwidoPort on a Twido PLC system (DIN-rail or panel mounting) and
499TWD01100 connect it to the Twido PLC internal bus, follow these steps:
TwidoPort
Step Description Action
Module
1 Installation Preparation Consult the Twido Programmable Controllers Hardware
Reference Guide (TWD USE 10AE) for instructions on:
! correct mounting positions for Twido modules,
! adding and removing Twido components from a DIN rail,
! direct mounting on a panel surface,
! minimum clearances for modules in a control panel.
2 Mounting the Install the module on a DIN rail or panel. For more details, see
499TWD01100 How to Install the TwidoPort Ethernet Interface Module.
TwidoPort Module
3 Protective Earth (PE) Attach a grounded wire to the M3 screw terminal on the
Grounding bottom of TwidoPort.
4 Serial and Ethernet
Connections
Top plug: Connect the modular plug end of the (supplied) TwidoPort-
from Twido (serial)
to-Twido cable to TwidoPort's serial port and connect the
other end to the Twido PLC’s RS485 serial port.
Bottom plug:
from Ethernet, either a
straight or crossover
cable
Declaring the The table below shows the different stages when declaring the 499TWD01100
499TWD01100 TwidoPort module.
TwidoPort Module
Step Action Comment
1 Select Port 1 (or Port 2 if See ( Configuring an Object, TwidoSuite Online Help).
installed) to configure in the
Describe window.
2 Configure the Feature dialog
box ( Configuring an Object, TwidoSuite
TwidoSuite Online Help)
Port 1 :
that appears, as explained
in the following steps. Protocol
Type : Modbus
Address: 1
Cancel Advanced OK
Configuring the
499TWD01100 Note: The Ethernet parameters of TwidoPort can be configured when the
TwidoPort TwidoSuite application program is in offline mode only.
Module
To configure TwidoPort’s Ethernet parameters, follow this procedure:
Step Action Comment
Foreword To find out more about IP parameters (IP address, subnet mask and gateway address), please refer to (
IP Addressing, Twido Programming Guide) and ( Assigning IP Addresses, Twido Programming Guide).
1 Select the 499TWD01100 TwidoPort Result: The Ethernet Configuration dialog box appears, as
module to configure TwidoPort’s IP shown in the example below.
parameters, see ( Configuring an Object,
Configuration
TwidoSuite Online Help).
Result: The TwidoPort Ethernet networks
Configuration window appears on ID address configuration
screen, as shown in the following IP Address
sub-section. Subnet mask
Gateway Address
Cancel Advanced OK
2 Enter TwidoPort’s static IP Address Caution: For good device communication, the IP addresses of the
in dotted decimal notation. PC running the TwidoSuite application and TwidoPort must share
(See notes 1 and 2.) the same network ID.
3 Enter the valid Subnetwork mask Caution: For good device communication, the subnet mask
assigned to TwidoPort by your configured on the PC running the TwidoSuite application and
network administrator. Please note TwidoPort’s subnet mask must match.
that you cannot leave this field blank; As default, the TwidoSuite application automatically computes and
you must enter a value. displays a default subnet mask based on the class IP that you
(See notes 1 and 3.) 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.
Setting Up To allow the PC running TwidoSuite and the Twido controller to communicate over
Ethernet the Ethernet network.
Connection in
TwidoSuite Select Preferences
Result:
The following Connections Management dialog box appears:
Preferences Apply Restore
Clear Dark
Default project image Default image
Personalized image C:\Documents and Settings\Administrateur\My documents\
Default functional levels of applications Automatic Automatic management
The very highest
The very lowest
Manual Manual management
Level 1.0
Level 2.0
Level 2.5
Level 3.0
Connection management
Name Connection type IP / Phone Punit / Address Baud rate Parity Stop bits Timeout Break timeout
COM1 Serial COM1 Punit 5000 20
COM2 Serial COM1 Punit 5000 20
My connection 1 Serial 192.168.1.1 Direct 5000 20
Modem connection Ethernet xxxxxxxxxx 19200 None 1 5000 20
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:
! Select the desired field, then click the Modify button.
! 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.
Step Action
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.
5 The Punit / Address field can be filled in when IP / Phone has been selected.
For a 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).
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 ( Ethernet Connections
Management, Twido Programming Guide).)
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. Failing that, TwidoPort assumes the default IP configuration
that is constructed from a MAC address of this structure:
At a Glance
Subject of this This section describes how to configure the ConneXium TwidoPort module with a
Section Tenet session.
Overview of Configure TwidoPort with a Telnet session (using a VT100-compatible Telnet client)
Telnet for those cases in which a specific Twido configuration is not found or in which the
Configuration BootP request is not answered after two minutes (resulting in the implementation of
the default IP address).
Preparation to
Telnet Note: TwidoPort’s Telenet requirements
Configuration While configuring TwidoPort with Telnet, make sure:
! TwidoPort is supplied with power (from a Twido controller) through its serial
connection.
! Telnet’s local echo is set to off.
Launching the When you start a Telnet session (e.g., by typing telnet 85.16.44.113 at a
Telnet Main command prompt or by using WindowsTM HyperterminalTM), the Telnet main menu
Menu appears after your press Enter:
IP/Ethernet Settings
Configuring the Use the following instructions to change the IP/Ethernet settings:
IP/Ethernet
Step Action Comment
Settings
1 Start a Telnet session. Use the instructions above to open the
Telnet main menu (see p. 356).
2 Select (type) 1 to change the IP source to STORED may already be the IP source.
STORED and press Enter.
3 Set desired IP parameters manually. Other parameters include:
(See TwidoPort Ethernet settings ! IP Address
following this table.) ! Default Gateway
! Netmask
! Ethernet Frame Type
4 Select R and press Enter. The Telnet main menu appears. (You
may have to press Enter again to update
the screen.)
IP Source The select IP Source option dictates the location from which the IP configuration
is obtained:
! STORED—from local flash memory.
! SERVED—from BootP server.
! 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.)
Example of Serial The following figure shows an example of TwidoPort’s serial settings:
Settings
Foreword
Note: Usually, it is not necessary to configure TwidoPort’s gateway parameters.
Security Configuration
Configuring the Use the following instructions to change the default password:
Security Settings
Step Action Comment
1 Start a Telnet session. Use the instructions above to open the Telnet
main menu (see p. 356).
2 Select (type) 4 and press Enter. The Security Configuration Screen appears.
3 Select C and press Enter.
4 Enter the old password. Authorized users will know the old password
(default is USERUSER).
5 Enter a new password. Retype the new password. (See note below.)
6 Enter the new password again. See the note below for acceptable passwords.
7 Select R and press Enter. The Telnet main menu appears. (You may have
to press Enter again to update the screen.)
Note Password details:
! minimum length: 4 characters
! maximum length: 10 characters
! allowed characters: 0 to 9, a to z, A to Z (no spaces)
Ethernet Statistics
Serial Statistics
Saving the To save the changes to the configuration, type the configuration password:
Configuration
Step Action Comment
1 Start a Telnet session. Use the instructions above to open the
Telnet main menu (see p. 356).
2 Select S and press Enter.
3 Enter the configuration password. The default password is USERUSER).
(See note below.)
Note For more details on how to set a personalized security password, please refer
to p. 360.
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.
Upgrading the To upgrade the current TwidoPort’s firmware with the latest firmware release you
Firmware have obtained, follow this procedure:
Step Action Comment
1 Start a Telnet session. Use the instructions above to open the
Telnet main menu (see p. 356).
2 Select (type) F to initiate the firmware Five seconds after selecting F (firmware
upgrade. upgrade), TwidoPort resets and the
Telnet connection is lost.
3 At the command line, type: ftp and For example: ftp 85.16.44.113
TwidoPort’s IP address.
4 Enter: ftptwd At the login name prompt.
5 Enter: cd fw This takes the user to the fw directory.
6 Enter: put App.out . A message indicates that the ftp was
(See notes 1 and 2.) successful. (See note 3.)
Note 1 File names are case-sensitive.
Note 2 Make sure App.out is in the current working directory of the ftp client.
Note 3 A message indicates that TwidoPort will automatically reboot 5 seconds after
a successful ftp.
Firmware The following figure shows a typical Firmware Upgrade In-Progress screen:
Upgrade In
Progress
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:
green/white
green
At a Glance
Subject of this This section describes the communications features supported by the ConneXium
Section TwidoPort Ethernet gateway.
Ethernet Features
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 Modbus/TCP clients can communicate with Twido through TwidoPort, a bridge
Operations between Twido devices (Modbus/RTU over RS485 serial link) and Modbus/TCP
over Ethernet networks.
You cannot initiate read or write requests from the Twido controller through
TwidoPort.
List Function TwidoPort answers the following locally supported Modbus function codes only
Codes when the unit ID is set to 254. (Locally supported function codes are those answered
directly by TwidoPort and not by the Twido controller.)
Modbus Function Code Subfunction Code OPCODE Description
8 0 N/A return query data
8 10 N/A clear counters
8 11 N/A return bus message count
8 12 N/A return bus comm. error count
8 13 N/A return bus exception error count
8 14 N/A return slave message count
8 15 N/A return slave no response count
8 21 3 get Ethernet statistics
8 21 4 clear Ethernet statistics
43 14 N/A read device ID (see note 1.)
Note 1 TwidoPort supports only the basic object IDs of the read
device identification function code with both stream and
individual access.
13
At a Glance
Subject of this This chapter provides details for using the optional Twido Operator Display.
Chapter
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:
! Display Mode: only displays data.
! 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.
Displays and The Operator Display provides the following separate displays with the associated
Functions functions you can perform for each display.
! Controller Identification and State Information: Operations Display
Display firmware revision and the controller state. Change the controller state
with the Run, Initial, and Stop commands.
! System Objects and Variables: Data Display
Select application data by the address: %I, %Q, and all other software objects on the
base controller. Monitor and change the value of a selected software data object.
! Serial Port Settings: Communication Display
Display and modify communication port settings.
! Time of Day Clock: Time/Date Display
Display and configure the current date and time (if the RTC is installed).
! Real Time Correction: RTC Factor
Display and modify the RTC Correction value for the optional RTC.
Note:
1. The TWDLC••40DRF series of compact controllers and the Twido Extreme
TWDLEDCK1 PLC 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.
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
T M 1 2 3
V 1 2 3 4
MOD/
ESC ENTER
Input keys
Display area The Operator Display provides an LCD display capable of displaying two lines of characters:
! The first line of the display has three 13-segment characters and four 7-segment
characters.
! 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.
Key In Display Mode In Edit Mode
ESC Discard changes and return to previous display.
Go to the next value of an object being edited.
Selecting and The initial display or screen of the Operator Display shows the controller identifi-
Navigating the cation and state information. Press the push-button to sequence through each
Displays of the displays. The screens for the Time of Day Clock or the Real-Time Correction
Factor are not displayed if the optional RTC cartridge (TWDXCPRTC) is not
detected on the controller.
As a shortcut, press the ESC key to return to the initial display screen. For most screens,
pressing the ESC key will return to the Controller Identification and State Information
screen. Only when editing System Objects and Variables that are not the initial entry
(%I0.0.0), will pressing ESC take you to the first or initial system object entry.
To modify an object value, instead of pressing the push-button to go to the first
value digit, press the MOD/ENTER key again.
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:
R U N 1 0 0
Controller Firmware
state revision
Displaying and Using the Operator Display, you can change to the INI state from the STP state, or from
Changing STP to RUN, or from RUN to STP. Do the following to change the state of the controller:
Controller States
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:
! Select application data by address (such as %I or %Q).
! Monitor the value of a selected software object/variable.
! Change the value of the currently displayed data object (including forcing inputs
and outputs).
System Objects The following table lists the system objects and variables, in the order accessed, that
and Variables can be displayed and modified by the Operator Display.
Object Variable/Attribute Description Access
Input %Ix.y.z Value Read/Force
Output %Qx.y.z Value Read/Write/Force
Timer %TMX.V Current Value Read/Write
%TMX.P Preset value Read/Write
%TMX.Q Done Read
Counter %Cx.V Current Value Read/Write
%Cx.P Preset value Read/Write
%Cx.D Done Read
%Cx.E Empty Read
%Cx.F Full Read
Memory Bit %Mx Value Read/Write
Word Memory %MWx Value Read/Write
Constant Word %KWx Value Read
System Bit %Sx Value Read/Write
System Word %SWx Value Read/Write
Analog Input %IWx.y.z Value Read
Analog output %QWx.y.z Value Read/Write
Fast Counter %FCx.V Current Value Read
%FCx.VD* Current Value Read
%FCx.P Preset value Read/Write
%FCx.PD* Preset value Read/Write
%FCx.D Done Read
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.
Displaying and Each type of system object is accessed by starting with the Input Object (%I),
Modifying sequencing through to the Message object (%MSG), and finally looping back to the
Objects and Input Object (%I).
Variables To display a system object:
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.
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.
Data Values and In general, the data value for an object or variable is shown as a signed or unsigned
Display Formats integer in the lower-right of the display area. In addition, all fields suppress leading
zeros for displayed values. The address of each object is displayed on the Operator
Display in one of the following seven formats:
! I/O format
! AS-Interface slaves I/O format
! CANopen slaves I/O format
! Function Block Format
! Simple Format
! Network I/O format
! Step Counter Format
! Shift bit register format
Input/Output The input/output objects (%I, %Q, %IW and %QW) have three-part addresses (e.g.:
Format %IX.Y.Z) and are displayed as follows:
! Object type and controller address in the upper-left
! Expansion address in the upper-center
! 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:
Q 0 3 1 1
F 1
AS-Interface AS-Interface slave I/O objects (%IA, %QA, %IWA and %QWA) have four-part
slaves I/O format addresses (e.g.: %IAx.y.z) and are displayed as follows:
! The object type in the upper-left
! AS-Interface master address on the expansion bus in the upper-left center
! Address of the slave on the AS-Interface bus in the upper-right center
! Slave I/O channel in the upper-right.
In the case of a simple input (%IA) and output (%QA), 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 %QA1.3A.2 appears in the display area as follows:
QA 1 3A 2
F 1
CANopen slaves CANopen slave PDO I/O objects (%IWC and %QWC) have four-part addresses
I/O format (e.g.: %IWCx.y.z) and are displayed as follows:
! The object type in the upper-left
! CANopen master address on the expansion bus in the upper-left center
! Address of the slave on the CANopen bus in the upper-right center
! Slave PDO I/O channel in the upper-right.
! Signed value for the object in the lower portion
In the following example, the PDO output object %QWC1.3.2 contains the signed
value +24680:
QWC 1 3 2
+ 24680
Function Block The function blocks (%TM, %C, %FC, %VFC, %PLS, %PWM, %DR, %R, and
Format %MSGj) have two-part addresses containing an object number and a variable or
attribute name. They are displayed as follows:
! Function block name in the upper-left
! Function block number (or instance) in the upper-right
! The variable or attribute in the lower-left
! Value for the attribute in the lower-right
In the following example, the current value for timer number 123 is set to 1,234.
T M 1 2 3
V 1 2 3 4
Simple Format A simple format is used for objects %M, %MW, %KW, %MD, %KD, %MF, %KF, %S,
%SW and %X as follows:
! Object number in the upper-right
! Signed value for the objects in the lower portion
In the following example, memory word number 67 contains the value +123.
M W 6 7
+ 1 2 3
Network Input/ The network input/output objects (%INW and %QNW) appear in the display area as follows:
Output Format ! Object type in the upper-left
! Controller address in the upper-center
! Object number in the upper-right
! Signed value for the object in the lower portion
In the following example, the first input network word of the remote controller
configured at remote address #2 is set to a value -4.
I N W 2 0
- 4
Step Counter The step counter (%SC) format displays the object number and the step counter bit
Format as follows:
! Object name and number in the upper-left
! Step counter bit in the upper right
! The value of the step counter bit in the lower portion of the display
In the following example, bit number 129 of step counter number 3 is set to 1.
S C 3 1 2 9
1
Shift Bit Register The shift bit register (%SBR) appears in the display area as follows:
Format ! Object name and number in the upper-left
! Register bit number in the upper-right
! Register bit value in the lower-right
The following example shows the display of shift bit register number 4.
S B R 4 9
1
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.
M 1 2 3
R 4
Displaying and Twido controllers can support up to two serial ports. To display the serial port
Modifying Serial settings using the operator display:
Port Settings
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.
M A R 2 8
1 4 h 2 2
Note:
1. The TWDLCA•40DRF series of compact controllers and the Twido Extreme
TWDLEDCK1 PLC 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.
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:
! using the operator display,
! by selecting Program$%$Debug$%$Check PLC$%$Configure Real Time Clock
from the task tool panel if you are connected,
! using system bits and system words, see System Bits and System Words, p. 669.
Real-Time For compact and modular bases, the Real-Time Correction Factor is an unsigned 3-
Correction digit integer (from 0 to 127) displayed in the lower-right corner of the display.
Factor for The example below shows a correction factor of 127.
Compact and
Modular bases
R T C C o r r
1 2 7
Real-Time For Twido Extreme TWDLEDCK1 bases, the Real-Time Correction Factor needs to
Correction be calculated as follows:
Factor for Twido
Step Action
Extreme Bases
1 Set the Real-Time Clock Value.
2 After a few weeks, determine the error 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.
III
At a Glance
Subject of this This part provides instructions for using the Ladder, List, and Grafcet programming
Part languages to create control programs for Twido programmable controllers.
14
At a Glance
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:
! All inputs are represented by contact symbols ( ).
! All outputs are represented by coil symbols ( ).
! Numerical operations are included in the graphical Ladder instruction set.
Ladder The following illustration shows a simplified wiring diagram of a relay logic circuit and
Equivalents to the equivalent Ladder diagram.
Relay Circuits
LS1 PB1 CR1 M1
LS1 PB1 CR1 M1 %I0.0 %I0.2 %I0.4 %Q0.4
LS2 SS1
LS2 SS1 %I0.1 %I0.7
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.
The set of graphical instructions represent the following functions:
! Inputs/outputs of the controller (push buttons, sensors, relays, pilot lights, etc.)
! Functions of the controller (timers, counters, etc.)
! Math and logic operations (addition, division, AND, XOR, etc.)
! Comparison operators and other numerical operations (A<B, A=B, shift, rotate, etc.)
! Internal variables in the controller (bits, words, etc.)
These graphical instructions are arranged with vertical and horizontal connections
leading eventually to one or several outputs and/or actions. A rung cannot support
more than one group of linked instructions.
Example of The following diagram is an example of a Ladder program composed of two rungs.
Ladder Rungs
%I0.1 %M42
Example Rung 1
%I0.3
%M42 %Q1.2
Example Rung 2
%MW22:=%MW15+%KW1
Programming Each Ladder rung consists of a grid of seven rows by eleven columns that are
Grid organized into two zones as shown in the following illustration.
Columns
1 2 3 4 5 6 7 8 9 10 11
Rows
1
4 Potential
Grid Bars
5 Cells
Test Zone
Action Zone
Grid Zones The Ladder diagram programming grid is divided into two zones:
! 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.
! 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.
Entering A Ladder rung provides a seven by eleven programming grid that starts in the first
Instructions in cell in the upper left-hand corner of the grid. Programming consists of entering
the Grid instructions into the cells of the grid. Test instructions, comparisons, and functions
are entered in cells in the test zone and are left-justified. The test logic provides
continuity to the action zone where coils, numerical operations, and program flow
control instructions are entered and are right-justified.
The rung is solved or executed (tests made and outputs assigned) within the grid
from top to bottom and from left to right.
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:
! Rung number
! Labels (%Li)
! Rung title
! Rung comments
For more details about using the rung header to document your programs, see p. 411.
Introduction Ladder diagrams consist of blocks representing program flow and functions such as
the following:
! Contacts
! Coils
! Program flow instructions
! Function blocks
! Comparison blocks
! Operation blocks
Contacts, Coils, Contacts, coils, and program flow (jump and call) instructions occupy a single cell of
and Program the ladder programming grid. Function blocks, comparison blocks, and operation
Flow blocks occupy multiple cells.
The following are examples of a contact and a coil.
1 LD contact - coil
Rung 1
CONTACT COIL
%I0.4 %Q0.4
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.
The following is an example of a counter function block.
1 LD counter
Rung 1
RESET COUNTER0 SOWNCT_O
VERFLOW
%I0.0 %C0 %Q0.0
P R E
ADJ Y PSET_OUT_
SET
%CO.P REACHED
%I0.1 9999 %Q0.1
P S D
UPCOUNT
%I0.2
P CU F
DOWNCOUNT
%I0.3
P CD
Comparison Comparison blocks are placed in the test zone of the programming grid. The block
Blocks 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.
2 LD comparison block
Rung 1
%MW0=%SW50 OUTPUTS5
%I0.4 %Q0.5
<
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.
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.
2 LD operation block
Rung 1
%MW120 := SQRT(%MW15)
SHORT
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.
3 LD operation block
Rung 1
OPERATE_SWITCH := %MW3
%MW2 := %MW3
SHORT
Contacts The contacts graphic elements are programmed in the test zone and take up one
cell (one row high by one column wide).
Name Graphic Instruction Function
element
Normally open contact LD Passing contact when the
controlling bit object is at state 1.
Contact for detecting a LDR Rising edge: detecting the change from
rising edge P 0 to 1 of the controlling bit object.
Contact for detecting a LDF Falling edge: detecting the change from
falling edge N 1 to 0 of the controlling bit object.
Link Elements The graphic link elements are used to insert/delete ladder loops:.
Name Graphic Function
element
Insert a link Insert an empty ladder loop
Coils The coil graphic elements are programmed in the action zone and take up one cell
(one row high and one column wide).
Name Graphic Instruction Function
element
Direct coil ST The associated bit object takes the
value of the test zone result.
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).
Name Graphic Function
element
Timers, counters, Each of the function blocks uses inputs and outputs
registers, and so on. that enable links to the other graphic elements..
Note: Outputs of function blocks can not be
connected to each other (vertical shorts).
Operate and Comparison blocks are programmed in the test zone, and operation blocks are
Comparison programmed in the action zone.
Blocks
Name Graphic Function
element
Comparison block Compares two operands, the output changes to 1
# when the result is checked.
Size: one row 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.
SHORT
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.
BLK %C0
%C0
OPEN R E LD 0
R
%M1 %Q0.1 LD %I0.2
S D AND %M0
%I0.2 %M0 CU
OUT_BLK
CU F LD D
AND %M1
CD
ST %Q0.1
END_BLK
Programming Advice
Handling Use program jumps with caution to avoid long loops that can increase scan time. Avoid jumps
Program Jumps to instructions that are located upstream. (An upstream instruction line appears before a jump
in a program. A downstream instruction line appears after a jump in a program.).
Programming of Output bits, like internal bits, should only be modified once in the program. In the
Outputs case of output bits, only the last value scanned is taken into account when the
outputs are updated.
Using Directly- Sensors used directly for emergency stops must not be processed by the controller.
Wired They must be connected directly to the corresponding outputs.
Emergency Stop
Sensors
Handling Power Make power returns conditional on a manual operation. An automatic restart of the
Returns installation could cause unexpected operation of equipment (use system bits %S0,
%S1 and %S9).
Time and The state of system bit %S51, which indicates any RTC faults, should be checked.
Schedule Block
Management
Syntax and Error When a program is entered, TwidoSuite checks the syntax of the instructions, the
Checking operands, and their association.
In order to perform the same function, the following equations must be programmed:
LD %I0.0
%I0.0 %I0.1 %Q0.1
MPS
AND( %I0.1
OR( %I0.2
AND %I0.3
%I0.2 %I0.3
)
)
ST %Q0.1
%I0.2 %Q0.0 MPP
AND %I0.2
ST %Q0.0
If several contacts are parellelized, they must be nested within each other or
completely separate:
%I0.2 %I0.3
%I0.6 %I0.7
%I0.2 %I0.4
%I0.2 %I0.3
%I0.4
%I0.2 %I0.3
%I0.4
LD %I0.0
%I0.0 %I0.1 %Q0.1 AND( %I0.1
OR( %I0.2
AND %I0.3
)
%I0.2 %I0.3
)
OR( %I0.4
AND %I0.3
%I0.4 %I0.3 )
ST %Q0.1
LD %I0.0
%I0.0 %I0.1 %I0.5 %Q0.1
AND( %I0.1
OR( %I0.2
AND %I0.3
)
%I0.2 %I0.3
AND %I0.5
OR( %I0.2
AND %I0.4
%I0.2 %I0.4 )
)
ST %Q0.1
Ladder/List Reversibility
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.
%I0.5 %Q0.4
LD %I0.5
OR %I0.4
%I0.4 ST %Q0.4
Ensuring Programs created in Ladder can always be reversed to List. However, some List
Reversibility 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, p. 409.
Instructions The structure of a reversible function block in List language requires the use of the
Required for following instructions:
Reversibility ! BLK marks the block start, and defines the beginning of the rung and the start of
the input portion to the block.
! OUT_BLK marks the beginning of the output portion of the block.
! END_BLK marks the end of the block and the rung.
The use of the reversible function block instructions are not mandatory for a properly
functioning List program. For some instructions it is possible to program in List which
is not reversible. For a description of non-reversible List programming of standard
function blocks, see p. 457.
Non-Equivalent Avoid the use of certain List instructions, or certain combinations of instructions and
Instructions to operands, which have no equivalents in Ladder diagrams. For example, the N instruction
Avoid (inverses the value in the Boolean accumulator) has no equivalent Ladder instruction.
The following table identifies all List programming instructions that will not reverse to Ladder.
List Instruction Operand Description
JMPCN %Li Jump Conditional Not
N none Negation (Not)
ENDCN none End Conditional Not
%Q0.4
LD 1
ST %Q0.4
%MW5 := 0
LD 1
[%MW5 := 0]
JMP %L6
>>%L6
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.
Ladder List If a List program is reversed that is not completely reversible, the reversible portions
Rungs are displayed in the Ladder view and the irreversible portions are displayed as
Ladder List Rungs.
A Ladder List Rung functions just like a small List editor, allowing the user to view
and modify the irreversible parts of a Ladder program.
Program Documentation
Documenting You can document your program by entering comments using the List and Ladder
Your Program editors:
! Use the List Editor to document your program with List Line Comments. These
comments may appear on the same line as programming instructions, or they
may appear on lines of their own.
! Use the Ladder Editor to document your program using rung headers. These are
found directly above the rung.
The TwidoSuite programming software uses these comments for reversibility. When
reversing a program from List to Ladder, TwidoSuite uses some of the List
comments to construct a rung header. For this, the comments inserted between List
sequences are used for rung headers.
Example of List The following is an example of a List program with List Line Comments.
Line Comments ---- ( * THIS IS THE TITLE OF THE HEADER FOR RUNG 0 * )
---- ( * THIS IS THE FIRST HEADER COMMENT FOR RUNG 0 * )
---- ( * THIS IS THE SECOND HEADER COMMENT FOR RUNG 0 * )
0 LD % I0. 0 ( * THIS IS A LINE COMMENT *)
1 OR %I0. 1 ( * A LINE COMMENT IS IGNORED WHEN REVERSING TO LADDER * )
2 ANDM %M10
3 ST M101
---- ( * THIS IS THE HEADER FOR RUNG 1 * )
---- ( * THIS RUNG CONTAINS A LABEL * )
---- ( * THIS IS THE SECOND HEADER COMMENT FOR RUNG 1 * )
---- ( * THIS IS THE THIRD HEADER COMMENT FOR RUNG 1 * )
---- ( * THIS IS THE FOURTH HEADER COMMENT FOR RUNG 1 * )
4 % L5:
5 LD %M101
6 [ %MW20 := %KW2 * 16 ]
---- ( * THIS RUNG ONLY CONTAINS A HEADER TITLE * )
7 LD %Q0. 5
8 OR %I0. 3
9 ORR I0. 13
10 ST %Q0.5
Reversing List When List instructions are reversed to a Ladder diagram, List Line Comments are
Comments to displayed in the Ladder Editor according to the following rules:
Ladder ! The first comment that is on a line by itself is assigned as the rung header.
! Any comments found after the first become the body of the rung.
! Once the body lines of the header are occupied, then the rest of the line
comments between List sequences are ignored, as are any comments that are
found on list lines that also contain list instructions.
Example of Rung The following is an example of a Ladder program with rung header comments.
Header Enter your comments here. Enter your comments here.
Comments 1 LD SECTION TITLE Enter your comments here. Enter your comments here.
Enter your comments here. Enter your comments here.
%I0.1
Rung 2
%L
0 %MW20 :- %KW2*16
%M101
%I0.3
Reversing When a Ladder diagram is reversed to List instructions, rung header comments are
Ladder displayed in the List Editor according to the following rules:
Comments to ! Any rung header comments are inserted between the associated List sequences.
List ! Any labels (%Li: ) or subroutine declarations (SRi:) are placed on the next line
following the header and immediately prior to the List sequence.
! If the List was reversed to Ladder, any comments that were ignored will reappear
in the List Editor.
15
At a Glance
Subject of this This chapter describes programming using Instruction List Language.
Chapter
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.
There are basically two types of instructions:
! Test instructions
These setup or test for the necessary conditions to perform an action. For
example, LOAD (LD) and AND.
! Action instructions
These perform actions as a result of setup conditions. For example, assignment
instructions such as STORE (ST) and RESET (R).
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.
Supported List The following table shows a selection of instructions in List Instruction language:
Instructions
Type of Instruction Example Function
Bit instruction LD %M10 Reads internal bit %M10
Block instruction IN %TM0 Starts the timer %TM0
Word instruction [%MW10 := %MW50+100] Addition operation
Program instruction SR5 Calls subroutine #5
Grafcet instruction -*-8 Step #8
Test Instructions The following table describes test instructions in List language.
Name Equivalent Function
graphic element
LD The Boolean result is the same as the status of the operand.
LDN The Boolean result is the same as the reverse status of the operand.
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
P 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
N Boolean result of the previous instruction and the detection of
the operand's falling edge (1 = falling edge).
OR The Boolean result is equal to the OR logic between the Boolean
result of the previous instruction and the status of the operand.
XOR, Exclusive OR
XOR
XORN,
XORR, XORN
XORF
XORR
XORF
N - Negation (NOT)
STN The associated operand takes the reverse value of the test
zone result.
Function Block The following table describes function blocks in List language.
Instructions
Name Equivalent Function
graphic element
Timers, counters, For each of the function blocks, there are
registers, and so on. instructions for controlling the block.
A structured form is used to hardwire the block
inputs and outputs directly.
Note: Outputs of function blocks can not be
connected to each other (vertical shorts).
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:
! Opening the parentheses is associated with the AND or OR instruction.
! Closing the parentheses is an instruction which is required for each open
parentheses.
Example Using The following diagrams are examples of using a parentheses with an AND
an AND instruction: AND(...).
Instruction
%I0.0 %I0.1 %Q0.0
LD %I0.0
AND %I0.1
%I0.2 OR %I0.2
ST %Q0.0
Example Using The following diagrams are examples of using parentheses with an OR instruction: OR(...).
an OR
Instruction LD %I0.0
%I0.0 %I0.1 %Q0.0 AND %I0.1
OR( %I0.2
AND %I0.3
%I0.2 %I0.3
)
ST %Q0.0
Modifiers The following table lists modifiers that can be assigned to parentheses.
Modifier Function Example
N Negation AND(N or OR(N
F Falling edge AND(F or OR(F
R Rising edge AND(R or OR(R
[ Comparison See p. 482
LD %I0.1
%I0.1 %I0.2 %I0.3 %I0.4 %Q0.0
AND( %I0.2
AND %I0.3
%I0.5 %I0.6 OR( %I0.5
AND %I0.6
)
%I0.7 %I0.8 AND %I0.4
OR( %I0.7
AND %I0.8
)
)
ST %Q0.0
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.
Operation of The following table describes the operation of the three stack instructions.
Stack
Instruction Description Function
Instructions
MPS Memory Push onto stack Stores the result of the last logical instruction
(contents of the accumulator) onto the top of stack
(a push) and shifts the other values to the bottom
of the stack.
MRD Memory Read from stack Reads the top of stack into the accumulator.
MPP Memory Pop from stack Copies the value at the top of stack into the
accumulator (a pop) and shifts the other values
towards the top of the stack.
16
At a Glance
Grafcet The following table lists all instructions and objects required to program a Grafcet chart:
Instructions
Graphic Transcription in Function
representation (1) TwidoSuite language
Illustration:
Initial step =*= i Start the initial step (2)
Xi
R %Xi Deactivate step i
S
Xi
R
%X2 %Q0.2
%X3 %Q0.3
Alternative sequence:
4 =* = 4
%I0.3 5 =*= 4
%I0.3 %I0.4 LD %I0.3
#
# 5
%I0.4 6 LD %I0.4
# 6
5 6 #
-*- 5
%I0.5 %I0.6 -*-5
LD %I0.5
%I0.5 7 # 7
#
7 -*- 6
-*-6 LD %I0.6
%I0.6 7 # 7
#
Simultaneous sequences:
8 -*-8
-*- 8
%I0.7 %I0.7 9 LD %I0.7
# # 9
# 10
10
9 10
# -*- 9
%I0.8 %I0.9 -*-9
LD %I0.8
%I0.8 11 # 11
11 12 #
-*- 10
%M0 - * - 10 LD %I0.9
# 12
%I0.9 12
# -*- 11
13 LD %M0
- * - 11 AND %X12
#D 12
%M0 %X12 12
# 13
#D
13 -*- 12
LD %M0
# AND %X11
- * - 12 #D 11
%M0 %X11 11 # 13
#D
13
#
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.
The rising edge of input %I0.6 sets bit %S21 to 1. This disables the active steps and
enables the initial steps.
%I0.6 %S22 000 LDN %I0.6
/ S 001 S %S22
002 ST %M0
%M0 003 LDR %I0.6
004 S %S21
%I0.6 %S21
P S
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.
System Bit Name Description
%S21 Grafcet All active steps are deactivated and the initial steps are activated.
initialization
%S22 Grafcet re- All steps are deactivated.
initialization
%S23 Grafcet pre- This bit must be set to 1 if %Xi objects are explicitly written by
positioning the application in preprocessing. If this bit is maintained to 1 by
the preprocessing without any explicit change of the %Xi
objects, Grafcet is frozen (no updates are taken into account).
Sequential Sequential processing takes place in the chart (instructions representing the chart):
Processing ! Steps
! Actions associated with steps
! Transitions
! Transition conditions
Example:
=*= 1
005 =*= 1
%I0.2 %I0.3 2 006 LD %I0.2
/ # 007 ANDN %I0.3
008 # 2
%I0.3 %I0.2 3
009 LD %I0.3
/ # 010 ANDN %I0.2
011 # 3
-*- 2 012 -*- 2
013 LD %I0.4
%I0.4 1 014 # 1
015 -*- 3
# 016 LD %I0.5
017 # 1
-*- 3
%I0.5 1
#
Sequential processing ends with the execution of the "= * = POST" instruction or with
the end of the program.
Example:
=*= POST
Introduction A TwidoSuite Grafcet program offers two ways to program the actions associated
with steps:
! In the post-processing section
! Within List instructions or Ladder rungs of the steps themselves
Associating If there are security or running mode constraints, it is preferable to program actions in the
Actions in Post- post-processing section of a Grafcet application. You can use Set and Reset List
Processing instructions or energize coils in a Ladder program to activate Grafcet steps (%Xi).
Example:
Associating You can program the actions associated with steps within List instructions or Ladder
Actions from an rungs. In this case, the List instruction or Ladder rung is not scanned unless the step
Application is active. This is the most efficient, readable, and maintainable way to use Grafcet.
Example:
-*- 3
%Q0.5 020 -*- 3
021 LD 1
S 022 S %Q0.5
023 LD %M10
4 024 # 4
# 025 -*- 4
026 LD 1
027 R %Q0.5
-*- 4 028 ...
%Q0.5 029 ...
Subject of this This part provides detailed descriptions about basic and advanced instructions and
Part system bits and words for Twido languages.
17
At a Glance
Subject of this This chapter provides details about instructions and function blocks that are used to
Chapter create basic control programs for Twido controllers.
At a Glance
Aim of this This section provides an introduction to Boolean processing including descriptions
Section and programming guidelines for Boolean instructions.
Boolean Instructions
The Boolean result of the test elements is applied to the action elements as shown
by the following instructions.
LD %I0.0
AND %I0.1
ST %Q0.0
Testing Boolean test instructions can be used to detect rising or falling edges on the
Controller Inputs controller inputs. An edge is detected when the state of an input has changed
between "scan n-1" and the current "scan n". This edge remains detected during the
current scan.
Rising Edge The LDR instruction (Load Rising Edge) is equivalent to a rising edge detection
Detection contact. The rising edge detects a change of the input value from 0 to 1.
A positive transition sensing contact is used to detect a rising edge as seen in the
following diagram.
%I0.0
LDR %I0.0 P P: Positive transition sensing contact
Falling Edge The LDF instruction (Load Falling Edge) is equivalent to a falling edge detection
Detection contact. The falling edge detects a change of the controlling input from 1 to 0.
A negative transition sensing contact is used to detect a falling edge as seen in the
following diagram.
%I0.0
LDF %I0.0 N N: Negative transition sensing contact
Edge Detection The following table summarizes the instructions and timing for detecting edges:
Edge Test Ladder Timing diagram
Instruction diagram
Rising edge LDR %I0.0
Rising edge
%I0.0
P %I0.0 time
T
Boolean T=1 controller
result scan
time
Falling edge LDF %I0.0
Falling edge
%I0.0
%I0.0 time
N
T
Boolean
result T=1 controller
scan
time
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:
! Brief description
! Example of the instruction and the corresponding ladder diagram
! List of permitted operands
! 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.
%I0.1 %Q0.3
LD %I0.1
ST %Q0.3
%M0 %Q0.2 LDN %M0
ST %Q0.2
%I0.1 %Q0.4
P
LDR %I0.1
ST %Q0.4
%I0.3 %Q0.5
N
LDF %I0.3
ST %Q0.5
Permitted The following table defines the types of permitted operands used for Boolean
Operands 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.
LD
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).
Permitted The following table lists the types of load instructions with Ladder equivalents and
Operands permitted operands.
List Instruction Ladder Equivalent Permitted Operands
LD 0/1, %I, %IA, %IWCx.y.z:Xk, %Q, %QA, %M, %S,
%X, %BLK.x, %•:Xk,[
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.
%I0.1 %Q0.3
LD %I0.1
ST %Q0.3
%Q0.2
STN %Q0.2
/ S %Q0.4
%Q0.4
S LD %I0.2
R %Q0.4
%I0.2 %Q0.4
R
Permitted The following table lists the types of assignment instructions with ladder equivalents
Operands and permitted operands.
List Instruction Ladder Equivalent Permitted Operands
ST %Q,%QA,%M,%S,%BLK.x,%•:Xk
STN %Q,%QA%M,%S,%BLK.x,%•:Xk
S %Q,%QA,%M,%S,%X,%BLK.x,%•:Xk
S
R %Q,%QA,%M,%S,%X,%BLK.x,%•:Xk
R
Timing diagram The following diagram displays the timing for assignment instructions.
ST STN S R
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.
LD %I0.1
%I0.1 %M1 %Q0.3
AND %M1
ST %Q0.3
%M2 %I0.2 %Q0.2 LD %M2
ANDN %I0.2
ST %Q0.2
%I0.3 %I0.4 %Q0.4 LD %I0.3
ANDR %I0.4
P S
S %Q0.4
%M3 %I0.5 %Q0.5 LD %M3
ANDF %I0.5
N S
S %Q0.5
Permitted The following table lists the types of AND instructions with ladder equivalents and
Operands permitted operands.
List Instruction Ladder Equivalent Permitted Operands
AND 0/1, %I, %IA, %Q, %QA, %M, %S, %X, %BLK.x,
%•:Xk, [
ANDN 0/1, %I, %IA, %Q, %QA, %M, %S, %X, %BLK.x,
%•:Xk, [
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.
%I0.1 %Q0.3
LD %I0.1
OR %M1
%M1 ST %Q0.3
%M2 %Q0.2
LD %M2
ORN %I0.2
%I0.2 ST %Q0.2
%M3 %Q0.4
LD %M3
S
ORR %I0.4
%I0.4 S %Q0.4
P
%I0.5 %Q0.5
LDF %I0.5
N S
ORF %I0.6
%I0.6 S %Q0.5
N
Permitted The following table lists the types of OR instructions with Ladder equivalents and
Operands permitted operands.
List Instruction Ladder Equivalent Permitted Operands
OR 0/1, %I,%IA, %Q, %QA, %M, %S, %X, %BLK.x,
%•:Xk
Timing diagram The following diagram displays the timing for the OR instructions.
Introduction The XOR instructions perform an exclusive OR operation between the operand (or
its inverse, or its rising or falling edge) and the Boolean result of the preceding
instruction.
Permitted The following table lists the types of XOR instructions and permitted operands.
Operands
List instruction Permitted Operands
XOR %I, %IA, %Q, %QA, %M, %S, %X,
%BLK.x, %•:Xk
XORN %I, %IA, %Q, %QA, %M, %S, %X,
%BLK.x, %•:Xk
XORR %I, %IA, %M
XORF %I, %IA, %M
Timing Diagram The following diagram displays the timing for the XOR instructions.
XOR
%I0.1
%M1
%Q0.3
Special Cases The following are special precautions for using XOR instructions in Ladder
programs:
! Do not insert XOR contacts in the first position of a rung.
! 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.
%M10
Introduction The NOT (N) instruction negates the Boolean result of the preceding instruction.
LD %I0.1
OR %M2
ST %Q0.2
N
AND %M3
ST %Q0.3
Timing Diagram The following diagram displays the timing for the NOT instruction.
NOT
%I0.1
%M2
%Q0.2
%M3
%Q0.3
At a Glance
Aim of this This section provides descriptions and programming guidelines for using basic
Section function blocks.
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.
S D
ADJ Y
%Ci.P 9999
CU
CD F
Bit Objects Bit objects correspond to the block outputs. These bits can be accessed by Boolean
test instructions using either of the following methods:
! Directly (for example, LD E) if they are wired to the block in reversible
programming (see p. 457).
! 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:
! 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).
! Current values: For example, %Ci.V, the current count value.
Accessible Bit The following table describes the Basic function blocks bit and word objects that can
and Word be accessed by the program.
Objects
Basic Function Symbol Range (i) Types of Description Address Write
Block Objects Access
Timer %TMi 0 - 127 Word Current Value %TMi.V no
Preset value %TMi.P yes
Bit Timer output %TMi.Q no
Up/Down Counter %Ci 0 - 127 Word Current Value %Ci.V no
Preset value %Ci.P yes
Bit Underflow output (empty) %Ci.E no
Preset output reached %Ci.D no
Overflow output (full) %Ci.F no
Introduction Use one of the following methods to program standard function blocks:
! 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.
! 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 Use instructions BLK, OUT_BLK, and END_BLK for reversible programming:
Programming ! BLK: Indicates the beginning of the block.
! OUT_BLK: Is used to directly wire the block outputs.
! END_BLK: Indicates the end of the block.
Example with The following example shows reversible programming of a counter function block
Output Wiring with wired outputs.
%I1.1
N R %C8 E BLK %C8
LDF %I1.1
S %M1 %Q0.4 R Input
%I1.2 %M0 ADJ Y D LD %I1.2 Processing
CU %Ci.P 9999 AND %M0
CU
OUT_BLK
CD F
LD D
Output
AND %M1
Processing
ST %Q0.4
END_BLK
Example without This example shows reversible programming of a counter function block without
Output Wiring wired outputs.
%I1.1
N R %C8 E BLK %C8
LDF %I1.1
S R Input
%I1.2 %M0 ADJ Y D LD %I1.2 Processing
%Ci.P 9999 AND %M0
CU
CU
END_BLK
CD F LD %C8.D
AND %M1 Output
ST %Q0.4 Processing
%C8.D %M1 %Q0.4
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).
%TMi
IN Q
TYPE TON
TB 1min
ADJ Y
%TMi.P 9999
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.
(1) (1
I (3
(2)
Q (5)
%TM
(4)
%TM
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.
(1)
IN
(3) (5)
Q
%TMi. (4)
(2)
%TMi.
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.
(1)
IN
(2) (6)
(4)
Q
%TMi.P
(3) (5)
%TMi.V
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.
TYPE TON
TB 1min
ADJ Y
%TMi.P 9999
Special Cases The following table contains a list of special cases for programming the Timer
function block.
Special case Description
Effect of a cold restart Forces the current value to 0. Sets output %TMi.Q to 0. The preset
(%S0=1) value is reset to the value defined during configuration.
Effect of a warm restart Has no effect on the current and preset values of the timer.
(%S1=1) The current value does not change during a power outage.
Effect of a controller stop Stopping the controller does not freeze the current value.
Effect of a program jump Jumping over the timer block does not freeze the timer. The
timer will continue to increment until it reaches the preset
value (%TMi.P). At that point, the Done bit (%TMi.Q)
assigned to output Q of the timer block changes state.
However, the associated output wired directly to the block
output is not activated and not scanned by the controller.
Testing by bit %TMi.Q It is advisable to test bit %TMi.Q only once in the program.
(done bit)
Effect of modifying the preset Modifying the present value by using an instruction or by adjusting
%TMi.P the value only takes effect on the next activation of the timer.
Timers with a 1 The 1 ms time base is only available with the first five timers. The four system words
ms Time Base %SW76, %SW77, %SW78, and SW79, can be used as "hourglasses." These four
words are decremented individually by the system every millisecond if they have a
positive value.
Multiple timing can be achieved by successive loading of one of these words or by
testing the intermediate values. If the value of one of these four words is less than
0, it will not be modified. A timer can be "frozen" by setting the corresponding bit 15
to 1, and then "unfrozen" by resetting it to 0.
%I0.1 %SW76:=XXXX
P
%I0.2 %SW76:X15
%SW76:=0 %M0
Introduction The Counter function block (%Ci) provides up and down counting of events. These
two operations can be done simultaneously.
%Ci
R E
S D
ADJ Y
CU %Ci.P 9999
CD F
Operation The following table describes the main stages of up/down counter operation.
Operation Action Result
Counting A rising edge appears at the upcounting The %Ci.V current value is incremented by one unit.
input CU (or instruction CU is activated).
The %Ci.V current value is equal to the The "preset reached" output bit %Ci.D switches to 1.
%Ci.P preset value.
The %Ci.V current value changes from 9999 The output bit %Ci.F (upcounting overflow)
to 0. switches to 1.
If the counter continues to count up. The output bit %Ci.F (upcounting overflow) is reset
to zero.
Downcount A rising edge appears at the downcounting The current value %Ci.V is decremented by one unit.
input CD (or instruction CD is activated).
The current value %Ci.V changes from 0 to The output bit %Ci.E (downcounting overflow)
9999. switches to 1.
If the counter continues to count down. The output bit %Ci.F (downcounting overflow) is
reset to zero.
Up/down count To use both the upcount and downcount functions simultaneously (or to activate both instructions CD
and CU), the two corresponding inputs CU and CD must be controlled simultaneously. These two inputs
are then scanned in succession. If they are both at 1, the current value remains unchanged.
Reset Input R is set to state 1(or the R instruction The current value %Ci.V is forced to 0. Outputs
is activated). %Ci.E, %Ci.D and %Ci.F are at 0. The reset input
has priority.
Preset If input S is set to 1 (or the S instruction is The current value %Ci.V takes the %Ci.P value and
activated) and the reset input is at 0 (or the the %Ci.D output is set to 1.
R instruction is inactive).
Special Cases The following table shows a list of special operating/configuration cases for counters.
Special case Description
Effect of a cold restart (%S0=1) ! The current value %Ci.V is set to 0.
! Output bits %Ci.E, %Ci.D, and %Ci.F are set to 0.
! The preset value is initialized with the value defined during
configuration.
Effect of a warm restart (%S1=1) of a Has no effect on the current value of the counter (%Ci.V).
controller stop
Effect of modifying the preset %Ci.P Modifying the preset value via an instruction or by adjusting it takes effect when the
block is processed by the application (activation of one of the inputs).
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 The following illustration is a counter function block with examples of reversible and
Example non-reversible programming.
%I1.1
R %C8 E
S
%I1.2 %M0 ADJ Y D
%Ci.P 9999
CU
CD F
%C8.D %Q0.0
Ladder diagram
S %M0
D S
CU
%M0 %I0.0
CD F
Ladder diagram
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).
%SBRi
R
CU
CD
Parameters The Shift Bit Register function block has the following parameters.
Parameter Label Value
Register number %SBRi 0 to 7
Register bit %SBRi.j Bits 0 to 15 (j = 0 to 15) of the shift register can be tested
by a Test instruction and written using an Assignment
instruction.
Reset input (or R When function parameter R is 1, this sets register bits 0 to
instruction) 15 %SBRi.j to 0.
Shift to left input (or CU On a rising edge, shifts a register bit to the left.
instruction)
Shift to right input (or CD On a rising edge, shifts a register bit to the right.
instruction)
Operation The following illustration shows a bit pattern before and after a shift operation.
Operation
Initial state 1 1 0 0 0 0 0 0 1 1 0 1 1 1 0 0
Bit 15 Bit 0
CU %SBRi performs a
shift to the left
Bit 15 is lost 1 0 0 0 0 0 0 1 1 0 1 1 1 0 0 0
Bit 15 Bit 0
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.
Reversible
programming
%SBR0.15 %SBR0.0
/ LDN %SBR0.15
ST %SBR0.0
BLK %SBR0
LD %S6
CU
%SBR0
END_BLK
R
%S6 Non-Reversible
CU programming
LDN %SBR0.15
CD ST %SBR0.0
LD %S6
CU %SBR0
Special Cases The following table contains a list of special cases for programming the Shift Bit
Register function block.
Special Case Description
Effect of a cold restart (%S0=1) Sets all the bits of the register word to 0.
Effect of a warm restart (%S1=1) Has no effect on the bits of the register word.
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.
%SCi
R
CU
CD
Timing Diagram The following timing diagram illustrates the operation of the step function block.
CU input
CD input
Active step
0 1 2 3 2 1 0
number
BLK %SC0
%SC0.3
LD %SC0.3
OR %I0.3
R
%I0.3 %SC0 LD %I0.2
R CU
END_BLK
%I0.2 LD %SC0.0
CU ST %Q0.1
LD %SC0.1
ST %Q0.2
CD LD %SC0.2
Non-reversible
%SC0.0 %Q0.1 programming
LD %SC0.3
OR %I0.3
%SC0.1 %Q0.2 R %SC0
LD %I0.2
CU %SC0
LD %SC0.0
%SC0.2 %Q0.3 ST %Q0.1
LD %SC0.1
ST %Q0.2
LD %SC0.2
Special case The following table contains a list of special cases for operating the Step Counter
function block.
Special case Description
Effect of a cold restart (%S0=1) Initializes the step counter.
Effect of a warm restart (%S1=1) Has no effect on the step counter.
At a Glance
Aim of this This section provides an introduction to Numerical Processing including descriptions
Section and programming guidelines.
At a Glance Numerical instructions generally apply to 16-bit words (see p. 31) and to 32-bit
double words (see p. 34). 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.
%I0.2 %MW100:=%I0:16
LD %I0.2
[%MW100:=%I0:16] (Ex. 2)
Usage rules:
! 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.
! 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 Assignment operations can be performed on the following words and double words:
Words ! Word (indexed) -> word (2, for example) (indexed or not)
! Double word (indexed) -> double word (indexed or not)
! Immediate whole value -> word (Example 3) or double word (indexed or not)
! Bit string -> word or double word
! Floating point (indexed or not)-> floating point (indexed or not)
! Word or double word -> bit string
! Immediate floating point value -> floating point (indexed or not)
%I0.2 %MW0[%MW10]:=%KW0[%MW20]
LD %I0.2
[%MW0[%MW10]:= (Ex. 2)
%KW0[%MW20]]
%I0.3 %MW10:=100
P LDR %I0.3 (Ex. 3)
[%MW10:=100]
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, ...).
Assignment of Assignment operations can be performed on the following object tables (see p. 48):
Word, Double ! Immediate whole value -> word table (Example 1) or double word table
Word and ! Word -> word table (Example 2)
Floating Point ! Word table -> word table (Example 3)
Tables Table length (L) should be the same for both tables.
! Double word -> double word table
! Double word table -> double word table
Table length (L) should be the same for both tables.
! Immediate floating point value -> floating point table
! Floating point -> floating point table
! Floating point table-> floating point table
Table length (L) should be the same for both tables.
%MW0:10:=100 LD 1
[%MW0:10:=100] (Ex. 1)
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
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.
%MW10>100 %Q0.3
LD [%MW10 > 100]
ST %Q0.3
Operands:
Type Operand 1 (Op1) Operand 2 (Op2)
Words %MWi, %KWi, %INWi, %IW, Immediate value, %MWi, %KWi, %INWi,
%IWAi, %IWCi, %QNWi, %IW, %IWAi, %IWCi, %QNWi, %QW,
%QWi, %QWAi, %QWCi, %QWAi, %QWCi, %SWi, %BLK.x,
%QNWi, %SWi, %BLK.x %MWi [%MWi], %KWi [%MWi]
Double words %MDi, %KDi Immediate value, %MDi, %KDi, %MDi
[%MWi], %KD [%MWi]
Floating point words %MFi, %KFi Immediate floating point value, %MFi,
%KFi, %MFi [%MWi], %KFi [%MWi]
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
%M0 %MW0:=%MW10+100
LD %M0
[%MW0:=%MW10 + 100]
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:
Type Operand 1 (Op1) Operands 2 and 3 (Op2 & 3) (1)
Words %MWi, %QWi, %QWAi, Immediate value, %MWi, %KWi, %INW, %IW,
%QWCi, %SWi %IWAi, %IWCi, %QNW, %QW, %QWAi, %QWCi,
%SWi, %BLK.x
Double words %MDi Immediate value, %MDi, %KDi
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).
%M0 %MW0:=%MW1+%MW2
LD %M0
[%MW0:=%MW1 + %MW2]
%S18 %MW10:=%MW0
LDN %S18
/ [%MW10:=%MW0]
%S18 %MW10:=32767
LD %S18
[%MW10:=32767]
R %S18
%S18
R
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
[%MW0:=%KW5 OR %MW10]
LD 1
[%MW0:=%KW5 OR %MW10]
LD %I0.3
[%MW102:=NOT(%MW100)]
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 F 0
the left.
%S17
SHR(op2,i) Logic shift of i positions to F 0
the right.
%S17
Rotate shift
ROL(op2,i) Rotate shift of i positions
to the left.
F 0
%S17
ROR(op2,i) Rotate shift of i positions
F 0
to the right.
%S17
Note: System bit %S17 is used to indicate the last ejected bit.
%I0.1
LDR %I0.1
P %MW0:=SHL(%MW10, 5)
[%MW0 :=SHL(%MW10, 5)]
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:
Types Operand 1 (Op1) Operand 2 (Op2)
Words %MWi, %QWi, %QWAi, %MWi, %KWi, %IW, %IWAi, %IWCi, %QW,
%QWCi, %SWi %QWAi, %QWCi, %SWi, %BLK.x
Double word %MDi %MDi, %KDi
Conversion Instructions
Review of BCD Binary Coded Decimal (BCD) represents a decimal digit (0 to 9) by coding four binary
Code bits. A 16-bit word object can thus contain a number expressed in four digits (0000 -
9999), and a 32 bit double word object can therefore contain an eight-figure number.
During conversion, system bit %S18 is set to 1 if the value is not BCD. This bit must
be tested and reset to 0 by the program.
BCD representation of decimal numbers:
Decimal 0 1 2 3 4 5 6 7 8 9
BCD 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001
Examples:
! Word %MW5 expresses the BCD value "2450" which corresponds to the binary
value: 0010 0100 0101 0000
! 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.
%M0 %MW0:=BTI(%MW10)
LD %M0
[%MW0 :=BTI(%MW10)]
%I0.2 %MW10:=ITB(%KW9)
LD %I0.2
[%MW10 :=ITB(%KW9)]
Syntax The syntax depends on the operators used as shown in the table below.
Operator Syntax
BTI, ITB [Op1: = Operator (Op2)]
Operands:
Type Operand 1 (Op1) Operand 2 (Op2)
Words %MWi, %QWi, %QWAi, %MWi, %KWi, %IW, %IWAi, %IWCi, %QW,
%QWCi, %SWi %QWAi, %QWCi, %SWi, %BLK.x
Double words %MDi %MDi, %KDi
Application The BTI instruction is used to process a setpoint value at controller inputs via BCD
Example: 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.
%M0 %MW0:=HW(%MD10)
LD %M0
[%MW0 :=HW(%MD10)]
%I0.2 %MD10:=DWORD(%KW9)
LD %I0.2
[%MD10 :=DWORD(%KW9)]
Syntax The syntax depends on the operators used as shown in the following table: l
Operator Syntax Operand 1 (Op1) Operand 2 (Op2) Operand 3 (Op3)
LW, HW Op1 = Operator (Op2) %MWi %MDi, %KDi [-]
CONCATW Op1 = Operator (Op2, Op3)) %MDi %MWi, %KWi, %MWi, %KWi,
immediate value immediate value
DWORD Op1 = Operator (Op2) %MDi %MWi, %KWi [-]
At a Glance
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.
%M1 %Q0.1
LD %M1
ST %Q0.1
LD %M2
ST %Q0.2
%M2 %Q0.2
...................
END END
%M1 %Q0.1
LD %M1
ST %Q0.1
LD %M2
ST %Q0.2
%M2 %Q0.2
...................
%I0.2
LD %I0.2
END ENDC If %I0.2 = 1, end of
LD %M2 program scanning
ST %Q0.2
%M2 %Q0.2
If %I0.2 = 0, continues
program scanning
................... until new END instruc-
tion
END END
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
000 LD %M15
001 JMPC %L8 Jump to label %L8 if %M15
002 LD [%MW24>%MW12] is at 1
003 ST %M15
004 JMP %L12 Unconditional jump to label
005 %L8: %L12:
006 LD %M12
007 AND %M13
008 ST %M12
009 JMPCN %L12 Jump to label %L12 if
010 OR %M11 %M12 is at 0
011 S %Q0.0
012 %L12:
013 LD %I0.0
...............
Guidelines ! Jump instructions are not permitted between parentheses, and must not be
placed between the instructions AND(, OR( and a close parenthesis instruction
")".
! The label can only be placed before a LD, LDN, LDR, LDF or BLK instruction.
! The label number of label %Li must be defined only once in a program.
! 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.
000 LD %M15
001 AND %M5
002 ST %Q0.0
003 LD [%MW24>%MW12]
004 SR8 Jump to subroutine SR8
005 LD %I0.4
006 AND M13
007 _
008 _
009 _
010 END
011 SR8:
012 LD 1
013 IN %TM0
014 LD %TM0.Q
015 ST %M15
010 RET Return to main subroutine
.....................
LD %I0.0
%I0.0 SR0
ST %Q0.0
>>%SR0
%Q0.0 LD %I0.0
ST %Q0.0
SR0
18
At a Glance
Subject of this This chapter provides details about instructions and function blocks that are used to
Chapter create advanced control programs for Twido programmable controllers.
At a Glance
Aim of this This section provides an introduction to advanced function blocks including
Section programming examples.
502
Advanced Instructions
Introduction Advanced function blocks use similar types of dedicated words and bits as the
standard function blocks. Advanced function blocks include:
! LIFO/FIFO registers (%R)
! Drum controllers (%DR)
! Fast counters (%FC)
! Very fast counters (%VFC)
! Pulse width modulation output (%PWM)
! Pulse generator output (%PLS)
! Shift Bit Register (%SBR)
! Step counter (%SC)
! Message control block (%MSG)
Objects The table below contains an overview of the words and bits accessible by the
Accessible by program that are associated with the various advanced function blocks. Please note
the Program that write access in the table below depends on the "Adjustable" setting selected
during configuration. Setting this allows or denies access to the words or bits by
TwidoSuite or the operator interface.
Advanced Function Block Associated Words and Bits Address Write Access
%R Word Register input %Ri.I Yes
Word Register output %Ri.O Yes
Bit Register output full %Ri.F No
Bit Register output empty %Ri.E No
%DR Word Current step number %DRi.S Yes
Bit Last step equals current step %DRi.F No
%FC Word Current Value %FCi.V Yes
Word Preset value %FCi.P Yes
Bit Done %FCi.D No
503
Advanced Instructions
Advanced Function Block Associated Words and Bits Address Write Access
%VFC Word Current Value %VFCi.V No
Word Preset value %VFCi.P Yes
Bit Counting direction %VFCi.U No
Word Capture Value %VFCi.C No
Word Threshold 0 Value %VFCi.S0 Yes
Word Threshold Value1 %VFCi.S1 Yes
Bit Overflow %VFCi.F No
Bit Reflex Output 0 Enable %VFCi.R Yes
Bit Reflex Output 1 Enable %VFCi.S Yes
Bit Threshold Output 0 %VFCi.TH0 No
Bit Threshold Output 1 %VFCi.TH1 No
Bit Frequency Measure Time Base %VFCi.T Yes
%PWM Word Percentage of pulse at 1 in relationship to the %PWMi.R Yes
total period.
Word Preset period %PWMi.P Yes
%PLS Word Number of pulses %PLSi.N Yes
Word Preset value %PLSi.P Yes
Bit Current output enabled %PLSi.Q No
Bit Generation done %PLSi.D No
%SBR Bit Register Bit %SBRi.J No
%SC Bit Step counter Bit %SCi.j Yes
%MSG Bit Done %MSGi.D No
Bit Error %MSGi.E No
504
Advanced Instructions
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:
! BLK: Marks the block start and the input portion of the function block
! OUT_BLK: Marks the beginning of the output portion of the function block
! 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.
505
Advanced Instructions
Dedicated Inputs The Fast Counter, Very Fast Counter, PLS, and PWM advanced functions use
and Outputs dedicated inputs and outputs, but these bits are not reserved for exclusive use by
any single block. Rather, the use of these dedicated resources must be managed.
When using these advanced functions, you must manage how the dedicated inputs
and outputs are allocated. TwidoSuite assists in configuring these resources by
displaying input/output configuration details and warning if a dedicated input or
output is already used by a configured function block.
The following tables summarizes the dependencies of dedicated inputs and outputs
and specific functions.
When used with counting functions:
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
506
Advanced Instructions
Using Dedicated TwidoSuite enforces the following rules for using dedicated inputs and outputs.
Inputs and ! Each function block that uses dedicated I/O must be configured and then
Outputs referenced in the application. The dedicated I/O is only allocated when a function
block is configured and not when it is referenced in a program.
! After a function block is configured, its dedicated input and output cannot be used
by the application or by another function block.
For example, if you configure %PLS0, you can not use %Q0.0.0 in %DR0 (drum
controller) or in the application logic (that is, ST %Q0.0.0).
! If a dedicated input or output is needed by a function block that is already in use by
the application or another function block, this function block cannot be configured.
For example, if you configure %FC0 as an up counter, you can not configure
%VFC0 to use %I0.0.2 as capture input.
Note: To change the use of dedicated I/O, unconfigure the function block by setting
the type of the object to "not used," and then remove references to the function
block in your application.
507
Advanced Instructions
Introduction A register is a memory block which can store up to 16 words of 16 bits each in two
different ways:
! Queue (First In, First Out) known as FIFO.
! Stack (Last In, First Out) know as LIFO.
%Ri
R E
I F
TYPE FIFO
508
Advanced Instructions
LIFO Operation
Introduction In LIFO operation (Last In, First Out), the last data item entered is the first to be
retrieved.
509
Advanced Instructions
FIFO,operation
Introduction In FIFO operation (First In, First Out), the first data item entered is the first to be
retrieved.
510
Advanced Instructions
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 The following illustration is a register function block with examples of reversible and
Example non-reversible programming.
R %R2 E
%M1
I F
%M1
Ladder diagram
511
Advanced Instructions
Configuration The only parameter that must be entered during configuration is the type of register:
! FIFO (default), or
! LIFO
Special Cases The following table contains a list of special cases for programming the Shift Bit
Register function block:
Special case Description
Effect of a cold restart (%S0=1) Initializes the contents of the register. The output
bit %Ri.E associated with the output E is set to 1.
Effect of a warm restart (%S1=1) of a Has no effect on the current value of the register,
controller stop nor on the state of its output bits.
512
Advanced Instructions
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.
IN
programmable width
Tp
TB
%PWMi.P
configurable
fixed period
T
Parameters The following table lists parameters for the PWM function block.
Parameter Label Description
Timebase TB 0.142 ms, 0.57 ms, 10 ms, 1 s (default value)
Preselection of %PWMi.P 0 < %PWMi.P <= 32767 with time base 10 ms or 1 s
the period 0 < %PWMi.P <= 255 with time base 0.57 ms or 0.142 s
0 = Function not in use
Duty cycle %PWMi.R This value gives the percentage of the signal in state 1 in a
period. The width Tp is thus equal to:
Tp = T * (%PWMi.R/100). The user application writes the value
for %PWMi.R. It is this word which controls the duty cycle of the
period. For T definition, see "range of periods" below.
The default value is 0 and values greater than 100 are
considered to be equal to 100.
Pulse IN At state 1, the pulse width modulation signal is generated at the
generation input output channel. At state 0, the output channel is set to 0.
513
Advanced Instructions
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:
! 0.142 ms to 36.5 ms in steps of 0.142 ms (27.4Hz to 7kHz)
! 0.57 ms to 146 ms in steps of 0.57 ms (6./84 Hz to 1.75 kHz)
! 10 ms to 5.45 mins in steps of 10 ms
! 1 sec to 9.1 hours in steps of 1 sec
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.
Input IN
80%
50%
20%
Ratio
Dedicated Output
514
Advanced Instructions
Programming In this example, the signal width is modified by the program according to the state
and of controller inputs %I0.0.0 and %I0.0.1.
Configuration If %I0.0.1 and %I0.0.2 are set to 0, 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.0 is set to 0 and %I0.0.1 is set to 1, the %PWM0.R ratio is set at 50%
(duration 250 ms).
If %I0.0.0 and %I0.0.1 are set to 1, the %PWM0.R ratio is set at 80% (duration 400 ms).
Programming Example:
%I0.0 %I0.1 %PWM0.R:=20 LDN %I0.0
/ / ANDN %I0.1
[%PWM0.R:=20]
%I0.0 %I0.1 %PWM0.R:=50 LD %I0.0
/ ANDN %I0.1
[%PWM0.R:=50]
%I0.0 %I0.1 %PWM0.R:=80 LD %I0.0
AND %I0.1
[%PWM0.R:=80]
%PWM0 BLK %PWM0
%I0.2 LD %I0.2
IN
IN
END_BLK
TB
%PWMi0.P
Special Cases The following table shows a list of special operating of the PWM function block.
Special case Description
Effect of a cold restart (%S0=1) Sets the %PWMi.R ratio to 0. In addition, the value
for %PWMi.P is reset to the configured value, and
this will supersede any changes made with the
Animations Table Editor or the optional Operator
Display.
Effect of a warm restart (%S1=1) Has no effect.
Effect due to the fact that outputs are Forcing output %Q0.0.0 or %Q0.0.1 using a
dedicated to the %PWM block programming device does not stop the signal
generation.
515
Advanced Instructions
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.
%PLS0 TON
IN Q
TB
SINGLE
ADJ Variable period
%PLSi.P T
R D
516
Advanced Instructions
Specifications The table below contains the characteristics of the PLS function block:
Function Object Description
Timebase TB 0.142 ms, 0.57 ms, 10 ms, 1 sec
Preset period %PLSi.P Pulses on output %PLS1 are not stopped when %PLS1.N or %PLS1.ND* is
reached for time bases 0.142 ms and 0.57 ms.
! 1 < %PLSi.P <= 32767 for time base 10 ms or 1 s
! 0 < %PLSi.P <= 255 for time base 0.57 ms or 0.142 ms
! 0 = Function not in use.
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 pulses %PLSi.N The number of pulses to be generated in period T can be limited to the range 0 <=
%PLSi.ND %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 generation IN At state 1, the pulse generation is produced at the dedicated output channel. At
input state 0, the output channel is set to 0.
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 pulse %PLSi.Q At state 1, indicates that the pulse signal is generated at the dedicated output
output generation channel configured.
Pulse generation %PLSi.D At state 1, signal generation is complete. The number of desired pulses has been
done output reached.
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:
! 0.142 ms to 36.5 ms in steps of 0.142 ms (27.4Hz to 7kHz)
! 0.57 ms to 146 ms in steps of 0.57 ms (6.84 Hz to 1.75 kHz)
! 20 ms to 5.45 mins in steps of 10 ms
! 2 sec to 9.1 hours in steps of 1 sec
517
Advanced Instructions
Input IN
Number of pulses
Dedicated Output
%PLSi.Q
%PLSi.D
Special Cases
Special case Description
Effect of cold restart (%S0=1) Sets the %PLSi.P to that defined during configuration
Effect of warm restart Has no effect
(%S1=1)
Effect of modifying the preset Takes effect immediately
(%PLSi.P)
Effect due to the fact that Forcing output %Q0.0.0 or %Q0.0.1 using a programming
outputs are dedicated to the device does not stop the signal generation.
%PLS block
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.
518
Advanced Instructions
%DRi
R F
U
STEPS 8
Parameters The drum controller function block has the following parameters:
Parameter Label Value
Number %DRi 0 to 3 Compact Controller0 to 7 Modular Controllers
Current step number %DRi.S 0<%DRi.S<7. Word which can be read and written. Written value must be a
decimal immediate value. When written, the effect takes place on the next
execution of the function block.
Number of steps 1 to 8 (default)
Input to return to step R (Reset) At state 1, sets the drum controller to step 0.
0(or instruction)
Advance input (or U (Upper) On a rising edge, causes the drum controller to advance by one step and
instruction) updates the control bits.
Output F (Full) Indicates that the current step equals the last step defined. The associated bit %DRi.F
can be tested (for example, %DRi.F=1, if %DRi.S= number of steps configured - 1).
Control bits Outputs or internal bits associated with the step (16 control bits) and defined in
the Configuration Editor.
519
Advanced Instructions
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.
520
Advanced Instructions
Timing Diagram The following diagram illustrates the operation of the drum controller.
Input U:
Input R:
Output %DRi.F
Special Cases The following table contains a list of special cases for drum controller operation.
Special case Description
Effects of a cold restart Resets the drum controller to step 0 (update of control bits).
(%S0=1)
Effect of a warm restart Updates the control bits after the current step.
(%S1=1)
Effect of a program jump The fact that the drum controller is no longer scanned means the
control bits are not reset.
Updating the control bits Only occurs when there is a change of step or in the case of a
warm or cold restart.
521
Advanced Instructions
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 The following illustration is a drum controller function block with examples of
Example reversible and non-reversible programming.
%I0.0 %Q0.8
%DR1
R F
%I0.1
U
STEPS 6
Ladder diagram
BLK %DR1
LD %I0.0
R
LD %I0.1
U
OUT_BLK
LD F
ST %Q0.8
END_BLK
522
Advanced Instructions
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
523
Advanced Instructions
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 TWDLEDCK1 PLC, the Fast Counter can count the
rising edge up to frequencies of 10 kHz.
Illustration The following is an example of a Fast Counter function block in single-word mode.
%FC0
IN D
TYPE UP
SINGLE
ADJ
%FC0.P
524
Advanced Instructions
Parameters The following table lists parameters for the Fast Counter function block.
Parameter Label Description
Function TYPE Set at configuration, this can be set to either up-count or down-count.
Preset value Initial value may be set:
%FCi.P ->between 1 and 65535 in standard mode,
%FCi.PD ->between 1 and 4294967295 in double word mode,
Adjustable Y/N If set to Y, it is possible to modify the preset value %FCi.P or %FCi.PD and the current
value %FCi.V or %FCi.VD with the Operator Display or Animation Tables Editor. If set
to N, there is no access to the preset.
Current Value %FCi.V The current value increments or decrements according the up or down counting function selected.
%FCi.VD For up-counting, the current counting value is updated and can reach 65535 in standard mode
(%FCi.V) and 4294967295 in double word mode (%FCi.VD). For down-counting, the current value
is the preset value %FCi.P or %FCi.PD and can count down to zero.
Enter to enable IN At state 1, the current value is updated according to the pulses applied to the physical
input. At state 0, the current value is held at its last value.
Reset %FCi.R Used to initialize the block. At state 1, the current value is reset to 0 if configured as an
up-counter, or set to %FCi.P or %FCi.PD if configured as a down-counter. The done bit
%FCi.D is set back to its default value.
Done %FCi.D This bit is set to 1 when %FCi.V or %FCi.VD reaches the %FCi.P or %FCi.PD configured as an
up-counter, or when %FCi.V or %FCi.VD reaches zero when configured as a down-counter.
This read-only bit is reset only by the setting %FCi.R to 1.
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.
525
Advanced Instructions
Configuration In this example, the application counts a number of items up to 5000 while %I1.1 is
and set to 1. The input for %FC0 is the dedicated input %I0.0.2. When the preset value
Programming is reached, %FC0.D is set to 1 and retains the same value until %FC0.R is
commanded by the result of "AND" on %I1.2 and %M0.
%I1.1 %Q0.0
IN %FC0 D BLK %FC0
LD %I1.1
IN
TYPE UP LD %I1.2
I1.2 %M0 SINGLE AND %M0
R ADJY
R
%FC0.P 5000
OUT_BLK
LD D
ST %Q0.0
END_BLK
Special Cases The following table contains a list of special operating cases for the %FC function block:
Special case Description
Effect of cold restart (%S0=1) Resets all the %FC attributes with the values configured by
the user or user application.
Effect of warm restart (%S1=1) Has no effect.
Effect of Controller stop The %FC continues to count with the parameter settings
enabled at the time the controller was stopped.
526
Advanced Instructions
Introduction The Very Fast Counter function block (%VFC) can be configured by TwidoSuite to
perform any one of the following functions:
! Up/down counter
! Up/down 2-phase counter
! Single Up Counter
! Single Down Counter
! Frequency Meter
527
Advanced Instructions
Dedicated I/O The Very Fast Counter function blocks (%VFC) use dedicated inputs and auxiliary
Assignments inputs and outputs. These inputs and outputs are not reserved for their exclusive
use. Their allocation must be considered with the use of other function blocks for
these dedicated resources. The following array summarizes these assignments:
Main inputs Auxiliary inputs Reflex outputs
%VFC0 Selected Use IA input IB input IPres Ica Output 0 Output 1
Up/down counter %I0.0.1 %I0.0.0 %I0.0.2 (1) %I0.0.3 (1) %Q0.0.2 (1) %Q0.0.3 (1)
(UP=0/DO=1)
Up/Down 2-Phase %I0.0.1 %I0.0.0 %I0.0.2 (1) %I0.0.3 (1) %Q0.0.2 (1) %Q0.0.3 (1)
Counter (Pulse)
Single Up Counter %I0.0.1 (2) %I0.0.2 (1) %I0.0.3 (1) %Q0.0.2 (1) %Q0.0.3 (1)
Single Down Counter %I0.0.1 (2) %I0.0.2 (1) %I0.0.3 (1) %Q0.0.2 (1) %Q0.0.3 (1)
Frequency Meter %I0.0.1 (2) (2) (2) (2) (2)
%VFC1 Selected Use IA input Input IB) IPres Ica Output 0 Output 1
Up/down counter %I0.0.7 %I0.0.6 %I0.0.5 (1) %I0.0.4 (1) %Q0.0.4 (1) %Q0.0.5 (1)
(UP = 0/DO = 1)
Up/Down 2-Phase %I0.0.7 %I0.0.6 %I0.0.5 (1) %I0.0.4 (1) %Q0.0.4 (1) %Q0.0.5 (1)
Counter (Pulse)
Single Up Counter %I0.0.7 (2) %I0.0.5 (1) %I0.0.4 (1) %Q0.0.4 (1) %Q0.0.5 (1)
Single Down Counter %I0.0.7 (2) %I0.0.5 (1) %I0.0.4 (1) %Q0.0.4 (1) %Q0.0.5 (1)
Frequency Meter %I0.0.7 (2) (2) (2) (2) (2)
Comments:
(1) = optional Input IA = pulse input
(2) = not used Input IB = pulses or UP/DO
Ipres = preset input UP/DO = Up / Down counting
Ica= Catch input
When not used, the input or output remains a normal discrete I/O available to be managed by the
application in the main cycle.
528
Advanced Instructions
Illustration Here is a block representation of the Very Fast Counter (%VFC) in single-word mode:
%VFC0
IN F
TYPE UP/DN
SINGLE U
T_OUT0
T_OUT1
ADJ
TH0
%VFC0.P
S TH1
Specifications The following table lists characteristics for the very fast counter (%VFC) function block.
Function Description Values %VFC Run-time
Use Access
Current Value Current value that is increased or decreased according to %VFCi.V: 0 -> 65535 CM Read
(%VFCi.V) the physical inputs and the function selected. This value can %VFCi.VD: 0 ->
(%VFCi.VD*) be preset or reset using the preset input (%VFCi.S). 4294967295
Preset value Only used by the up/down counting function and single %VFCi.P: 0 -> 65535 CM or Read and
(%VFCi.P) up or down counting. %VFCi.PD: 0 -> FM Write (1)
(%VFCi.PD*) 4294967295
Capture Value Only used by the up/down counting function and single %VFCi.C: 0 -> 65535 CM Read
(%VFCi.C) up or down counting. %VFCi.CD: 0 ->
(%VFCi.CD*) 4294967295
Counting Set by the system, this bit is used by the up/down counting 0 (Down counting) CM Read
direction function to indicate to you the direction of counting: 1 (Up counting)
(%VFCi.U) As a single phase up or down counter, %I0.0.0 decides the
direction for %VFC0 and %I0.0.6 for %VFC1.
For a two-phase up/down counter, it is the phase difference
between the two signals that determines the direction.
For %VFC0, %I0.0 is dedicated to IB and %I0.1 to IA. For
%VFC1, %I0.6 is dedicated to IB and %I0.7 to IA.
Enable Reflex Validate Reflex Output 0 0 (Disable) CM Read and
Output 0 1 (Enable) Write (2)
(%VFCi.R)
Enable Reflex Validate Reflex Output 1 0 (Disable) CM Read and
Output 1 1 (Enable) Write (2)
(%VFCi.S)
529
Advanced Instructions
530
Advanced Instructions
(*)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
Counting The very fast counting function (%VFC) works at a maximum frequency of 20 kHz,
Function with a range of 0 to 65535 in standard mode and 0 to 4294967295. The pulses to
Description be counted are applied in the following way:
Table:
Function Description %VFC0 %VFC1
IA IB IA IB
Up/Down Counter The pulses are applied to the physical input, the current %I0.0.1 %I0.0.0 %I0.0.7 %I0.0.6
operation (upcount/downcount) is given by the state of
the physical input IB.
Up/Down 2-Phase The two phases of the encoder are applied to physical %I0.0.1 %I0.0.0 %I0.0.7 %I0.0.6
Counter inputs IA and IB.
Single Up Counter The pulses are applied to the physical input IA. IB is not used. %I0.0.1 ND %I0.0.7 ND
Single Down The pulses are applied to the physical input IA. IB is not used. %I0.0.1 ND %I0.0.7 ND
Counter
Notes on Upcount or downcount operations are made on the rising edge of pulses, and only
Function Blocks if the counting block is enabled.
There are two optional inputs used in counting mode: ICa and IPres. ICa is used to
capture the current value (%VFCi.V or %VFCi.VD) and stored it in %VFCi.C or
%VFCi.CD. The Ica inputs are specified as %I0.0.3 for %VFC0 and %I0.0.4 for
%VFC1 if available.
When IPres input is active, the current value is affected in the following ways:
! For up counting, %VFCi.V or %VFCi.VD is reset to 0
! For downcounting, %VFCi.V or %VFCi.VD is written with the content of %VFCi.P
or %VFCi.PD, respectively.
! For frequency counting, %VFCi.V or %VFCi.PD is set to 0
Warning: %VFCi.F is also set to 0. The IPres inputs are specified as %I0.0.2 for
%VFC0 and %I0.0.5 for %VFC1 if available.
531
Advanced Instructions
Notes on Function For all functions, the current value is compared to two thresholds (%VFCi.S0 or
Block Outputs %VFCi.S0D and % VFCi.S1 or %VFCi.S1D). According to the result of this
comparison two bit objects (%VFCi.TH0 and %VFCi.TH1) are set to 1 if the current
value is greater or equal to the corresponding threshold, or reset to 0 in the opposite
case. Reflex outputs (if configured) are set to 1 in accordance with these
comparisons. Note: None, 1 or 2 outputs can be configured.
%VFC.U is an output of the FB, it gives the direction of the associated counter
variation (1 for UP, 0 for DOWN).
Counting Function The following is a counting function diagram in standard mode (in double word
Diagram mode, you will use the double word function variables, accordingly):
IA = Up counter input
(Single signal or phase 1)
&
IN %VFCi + %VFCi.U
Note: Outputs are managed independently from the controller cycle time. The
response time is between 0 and 1ms.
532
Advanced Instructions
Single Up The following is an example of using %VFC in a single up counter mode. The
Counter following configuration elements have been set for this example:
Operation %VFC0.P preset value is 17, while the %VFC0.S0 lower threshold value is 14, and
the %VFC0.S1 upper threshold is 20.
Reflex Output value < %VFC.S0 %VFC0.S0 <= value < %VFC0.S1 value >= %VFC0.S1
%Q0.0.2 X
%Q0.0.3 X X
IN
S
65535
20
17
14
%VFC0.V 0
TH0
TH1
Reflex
output 0
Reflex
output 1
2 : change %VFC0.S1 to 17
533
Advanced Instructions
Single Down The following is an example of using %VFC in a single down counter mode. The
Counter following configuration elements have been set for this example:
Operation %VFC0.P preset value is 17, while the %VFC0.S0 lower threshold value is 14, and
the %VFC0.S1 upper threshold is 20.
Reflex Output value < %VFC.S0 %VFC0.S0 <= value < %VFC0.S1 value >= %VFC0.S1
%Q0.0.2 X X
%Q0.0.3 X
Example:
%VFC0.P = 17
%VFC0.S0 = 14
%VFC0.S1 = 20
1 2 3 4 5
IN
S
65535
20
17
14
%VFC0.V 0
TH0
TH1
Reflex
output 0
Reflex
output 1
2 : change %VFC0.P to 20
3 : change %VFC0.S1 to 17
534
Advanced Instructions
Up-Down The following is an example of using %VFC in an up-down counter mode. The
Counter following configuration elements have been set for this example:
Operation %VFC0.P preset value is 17, while the %VFC0.S0 lower threshold value is 14, and
the %VFC0.S1 upper threshold is 20.
Reflex Output value < %VFC.S0 %VFC0.S0 <= value < %VFC0.S1 value >= %VFC0.S1
%Q0.0.2 X
%Q0.0.3 X X
Example:
%VFC0.P = 17
%VFC0.S0 = 14
%VFC0.S1 = 20
1 2 3 4 5
IN
S
65535
20
17
14
%VFC0.V 0
TH0
TH1
Reflex
output 0
Reflex
output 1
2 : change %VFC0.P to 20
3 : change %VFC0.S1 to 17
535
Advanced Instructions
Frequency Meter The frequency meter function of a %VFC is used to measure the frequency of a
Function periodic signal in Hz on input IA. The frequency range which can be measured is
Description from 10 to 20kHz. The user can choose between 2 time bases, the choice being
made by a new object %VFC.T (Time base). A value of 100 = time base of 100 ms
and a value of 1000 = time base of 1 second.
Time Base Measurement range Accuracy Update
100 ms 100 Hz to 20 kHz 0.05 % for 20 kHz, 10 % for 10 times per second
100 Hz
1s 10 Hz to 20 kHz 0.005 % for 20 kHz, 10 % for Once per second
10 Hz
Signal to be measured
+
&
%VFC Counter
IN %VFCi
%VFCi.F
Overflow
output
S %VFCi %VFCi.V
Set Current Value
current value Frequency
current measured
value to 0
%VFCi.T
Select
time 1000 ms 100 ms
base
536
Advanced Instructions
Frequency Meter The following is a timing diagram example of using %VFC in a frequency meter mode.
Operation 1 2 3 4
IN
Timebase
%VFC0.V f1 f2 0 f3 0 f3 f4 f5
4 : Change %VFC0.T to 100 ms: this change cancels the current measurement
and starts another one.
Special Cases The following table shows a list of special operating of the %VFC function block.
Special case Description
Effect of cold restart (%S0=1) Resets all the %VFC attributes with the values configured
by the user or user application.
Effect of warm restart (%S1=1) Has no effect
Effect of Controller stop The %VFC stops its function and the outputs stay in their
current state.
537
Advanced Instructions
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:
! EXCH instruction to transmit/receive messages
! 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 The EXCH instruction allows a Twido controller to send and/or receive information
Instruction 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.
Note: To find out more information about the Modbus TCP messaging instruction
EXCH3, please refer to ( TCP Modbus Messaging, Twido Programming Guide).
538
Advanced Instructions
Introduction
Note: The "x" in %MSGx signifies the controller port: "x = 1 or 2"
! x = 1 or 2, signifies the serial port 1 or 2 of the controller, respectively;
! 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 ( TCP Modbus Messaging, Twido Programming Guide).
The %MSGx function block manages data exchanges and has three functions:
! 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).
! 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.
! 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.
%MSG1
R D
539
Advanced Instructions
Parameters The following table lists parameters for the %MSGx function block.
Parameter Label Value
Reset input (or R At state 1, reinitializes communication: %MSGx.E = 0 and
instruction) %MSGx.D = 1.
Comm. done %MSGx.D State 1, comm. done, if:
output ! End of transmission (if transmission)
! End of reception (end character received)
! Error
! Reset the 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.
Fault (Error) The error output is set to 1 either because of a communications programming error
Output or a message transmission error. The error output is set to 1 if the number of bytes
(%MSGx.E) defined in the data block associated with the EXCH instruction (word 1, least
significant byte) is greater than 128 (+80 in hexadecimal by FA).
The error output is also set to 1if a problem exists in sending a Modbus message to
a Modbus device. In this case, the user should check wiring, and that the destination
device supports Modbus communication.
Communications When the Done output is set to 1, the Twido controller is ready to send another
Done output message. Use of the %MSGx.D bit is recommended when multiple messages are
(%MSGx.D) sent. If it is not used, messages may be lost.
540
Advanced Instructions
Transmission of Execution of the EXCH instruction activates a message block in the application
Several program. The message is transmitted if the message block is not already active
Successive (%MSGx.D = 1). If several messages are sent in the same cycle, only the first
Messages message is transmitted. The user is responsible for managing the transmission of
several messages using the program.
Example of a transmission of two messages in succession on port 2:
Reinitializing An exchange is cancelled by activating the input (or instruction) R. This input
Exchanges initializes communication and resets output %MSGx.E to 0 and output %MSGx.D to
1. It is possible to reinitialize an exchange if a fault is detected.
Example of reinitializing an exchange:
%MSG1
%M0
BLK %MSG1
LD %M0
R D R
END_BLK
E
Special Cases The following table the special operating cases for the %MSGx function block.
Special Case Description
Effect of a cold restart (%S0=1) Forces a reinitialization of the communication.
Effect of a warm restart (%S1=1) Has no effect.
Effect of a controller stop If a message transmission is in progress, the controller
stops its transfer and reinitializes the outputs %MSGx.D
and %MSGx.E.
541
Advanced Instructions
At a Glance
Aim of this This section describes the time management functions for Twido controllers.
Section
542
Advanced Instructions
Clock Functions
Introduction Twido controllers have a time-of-day clock function, which requires the Real-Time
Clock option (RTC) and provides the following:
! Schedule blocks are used to control actions at predefined or calculated times.
! 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.
RTC Correction The RTC Correction value is necessary for the correct operation of the RTC. Each
Value RTC unit has its own correction value written on the unit. This value is configurable
in TwidoSuite by using the Configure RTC option from the TwidoSuite Monitoring
Utility accessible via the TwidoSuite Application Launcher.
543
Advanced Instructions
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 p. 670. The RTC option is required for
using schedule blocks.
Enabling The bits of system word %SW114 enable (bit set to 1) or disable (bit set to 0) the
Schedule Blocks operation of each of the 16 schedule blocks.
Assignment of schedule blocks in %SW114:
%SW114
Schedule Schedule
block #15 block #0
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.
544
Advanced Instructions
Output of If the same output (%Mi or %Qj.k) is assigned by several blocks, it is the OR of the
Schedule Blocks results of each of the blocks which is finally assigned to this object (it is possible to
have several "operating ranges" for the same output).
Example The following table shows the parameters for a summer month spray program example:
Parameter Value Description
Schedule block 6 Schedule block number 6
Output bit %Q0.2 Activate output %Q0.2
Start month June Start activity in June
End month September Stop activity in September
Start date 21 Start activity on the 21st day of June
End date 21 Stop activity on the 21st day of September
Day of week Monday, Wednesday, Friday Run activity on Monday, Wednesday and Friday
Start time 21:00 Start activity at 21:00
Stop time 22:00 Stop activity at 22:00
Using the following program, the schedule block can be disabled through a switch
or a humidity detector wired to input %I0.1.
%I0.1 %SW114:X6
LD %I0.1
ST %SW114:X6
%I0.1
21 June
%Q0.2
M W F M W F M W F
Time Dating by Date and time are both available in system words %SW50 to %SW53 (see p. 677).
Program It is therefore possible to perform time and date stamping in the controller program
by making arithmetic comparisons between the current date and time and the
immediate values or words %MWi (or %KWi), which can contain setpoints.
545
Advanced Instructions
Time/Date Stamping
Introduction System words %SW49 to %SW53 contain the current date and time in BCD format
(see p. 491), 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 p. 677).
Note: Date and time can also be set by using the optional Operator Display (see p. 386).
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 The following example shows how to date a rising edge on input %I0.1.
Example
%I0.0 %MW11:5 := %SW49.5
LDR %I0.0
P
[%MW11:5 := %SW49:5]
546
Advanced Instructions
Date and time of System words %SW54 to %SW57 contain the date and time of the last stop, and word
the last stop %SW58 contains the code showing the cause of the last stop, in BCD format (see p. 677).
547
Advanced Instructions
Introduction You can update the date and time settings by using one of the following methods:
! TwidoSuite
Use the Adjust Time dialog box. This dialog box is available from either
! the TwidoSuite Monitoring Utility accessible via the TwidoSuite
Application Launcher or
! by selecting Program$%$Debug, connecting yourself and selecting Check
PLC.
! 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 TWDLEDCK1 PLC have an
integrated RTC onboard.
Using %SW49 to To use system words %SW49 to %SW53 to set the date and time, bit %S50 must
%SW53 be set to 1. This results in the following:
! Cancels the update of words %SW49 to %SW53 via the internal clock.
! Transmits the values written in words %SW49 to %SW53 to the internal clock.
Programming Example:
%S50 %S50
LD %S50
R
R %S50
%I0.1 %SW49 := %MW10
P LDR %I0.1
[%SW49 := %MW10]
%SW50 := %MW11 [%SW50 := %MW11]
[%SW51 := %MW12]
[%SW52 := %MW13]
%SW51 := %MW12 [%SW53 := %MW14]
S %S50
%SW52 := %MW13
%SW53 := %MW14
%S50
S
548
Advanced Instructions
Words %MW10 to %MW14 will contain the new date and time in BCD format
(see p. 669) and will correspond to the coding of words %SW49 to %SW53.
The word table must contain the new date and time:
Encoding Most significant byte Least significant byte
%MW10 Day of the week1
%MW11 Second
%MW12 Hour Minute
%MW13 Month Day
%MW14 Century Year
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 p. 669). %SW59 increments or decrements each of the date and time
components on a rising edge.
549
Advanced Instructions
Application The following front panel is created to modify the hour, minutes, and seconds of the
Example internal clock.
+ - Seconds
550
Advanced Instructions
At a Glance
Overview This section contains information for getting started with the PID control and Auto-
Tuning functions available on Twido controllers.
551
Advanced Instructions
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 any specific
knowledge but does demand a certain degree of rigor to ensure that you retain
optimum results in the shortest possible time.
552
Advanced Instructions
Concerning the For this example, we have chosen a Type K ThermoCouple (0-200°).
example used in We will use transistor control with the output therefore being a base controller output
this guide controlled directly by the PID controller using PWM (see p. 558)
The diagram below shows the experimental setup used in the example:
TWDLMDA20DRT TWDALM3LT
1/L1 2/T1
4/A2- +3/A1
%Q0.1
Com(+)
-V
+24V
0V
Resistor
+24V 0V
230 VAC
553
Advanced Instructions
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.
How to Add an In offline mode, once you have selected the base controller, add the analog card as a
Analog Card base extension. The numbering of the channels will depend on its configuration slot.
(Expansion
Module)
How to Configure The following table describes the procedure for configuring the analog channels of
Analog Input the expansion module:
Channels
Step Action
1 Select Describe step from the TwidoSuite interface.
See ( Describing Applications, TwidoSuite Online Help).
2 Display the product catalog and select a module to add to the system description.
For example, TWDALM3LT for measuring temperature using a PT100 or Thermocouple.
3 Add the module to the system description (see ( Positioning a Module, TwidoSuite
Online Help).)
4 Use the Configuration Editor ( Configuration Editor, TwidoSuite Online Help) 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.
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.
554
Advanced Instructions
Example of Several types of configuration are possible depending on the type of measurement
Analog Channel used, as indicated below:
Configuration ! For the application in the example used in this document, we have chosen a Type
K ThermoCouple (0-200°). The process value read will be directly
comprehensible (2000 counts = 200° as the unit factor is 0.1).
! For other types of measurement, you choose 0-10V or 4-20 mA in the Type
column, or Custom in the Range column. Then adjust the value scale (enter 0 in
the Minimum column and 10000 in the Maximum column) to be able to read the
process value directly (10 V = 10000 counts).
The example below shows a configuration for a ThermoCouple K analog channel:
Module configuration.
Apply Cancel
I/O Table
555
Advanced Instructions
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
Enabling PID in The PID controller must be enabled in the program by an instruction. This instruction
the Program can be permanent or be a condition of an input or internal bit. In the following
example, the PID is enabled by the instruction %M0:
! In Ladder:
Rung 1
PID 0
%M0
! In Instruction List:
----
0 LD %M0
1 [ PID 0 ]
556
Advanced Instructions
Configuration of When using PID controllers, you are strongly advised to configure the scan mode of
Scan Period the PLC cycle to periodic. The table below describes the procedure for configuring
the scan mode.
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:
Watchdog
Period (10-500 ms): 250 ms
Periodic Event
Non utilisé
Not used
Period (5-250 ms): 10 ms
Subprogram number 0
Startup Automatic start in Run
Run / Stop Input: None
Apply Restore
Note: The cycle time should be adjusted to the size of the program and desired
performance. (A time of 50ms is a good compromise).
557
Advanced Instructions
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:
! PID = Simple PID controller.
! 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.
! 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.
! 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:
! %MWxx=1: The controller operates in simple PID mode.
! %MWxx=2: The controller operates in AT + PID.
! %MWxx=3: The controller operates in AT mode only.
! %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.
558
Advanced Instructions
Launching the The table below shows the PID dialog box and the procedure for accessing the
PID Dialog Box different PID settings configuration tabs:
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 ( Object Category Frame, TwidoSuite Online Help) frame
and choose PID) from the Objects Type ( Object Type Frame, TwidoSuite Online Help) 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:
Général Input PID AT Output Animation
Apply Cancel
PID States
Word address:
PID Output
Input
Mes
AT
PV AT
Limit
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.
559
Advanced Instructions
Dynamic For the dynamic modification of the PID parameters (in operation and in online
Modification of mode), it is advised to enter the memory addresses in the associated fields, thus
Parameters avoiding switching to offline mode to make on-the-fly changes to values.
General Tab The following table shows how to set the General tab in the PID dialog box:
Setting
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 p. 558).
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.
Input Tab Setting The following table shows how to set the Input tab in the PID dialog box:
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).
560
Advanced Instructions
PID Tab Setting The following table shows how to set the PID tab in the PID dialog box:
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.
Tab Setting for AT The following table shows how to set the AT tab in the PID dialog box:
Step Action
1 In the AT tab, check the Authorize box if you want to use AT.
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 AT Tab of PID Function, p. 595 section.
Note
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.
561
Advanced Instructions
Output Tab The following table shows how to set the Output tab in the PID dialog box:
Setting
WARNING
RISK OF SYSTEM OVERLOAD
You are reminded that manual mode has a direct effect on the controller output.
Consequently, sending a manual setpoint (Output field) acts directly on the open
controlled system. You should therefore proceed with care in this operating mode.
Failure to follow this instruction can result in death, serious injury, or
equipment damage.
WARNING
UNEXPECTED EQUIPMENT OPERATION
Do not use relay output with PID as this may result in the number of permitted
operations for relays being exceeded and the relay destroyed. Depending on the
process being controlled, this can have hazardous consequences.
Failure to follow this instruction can result in death, serious injury, or
equipment damage.
562
Advanced Instructions
Step Action
1 In the Output tab, enter the selection from the Action drop-down list.
This selection depends on the configured system:
! Direct action: the controller output decreases as the variation value (setpoint - measurement) increases
(cold controller).
! 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.
3 Set the Manual mode operating mode.
The drop-down list offers several choices:
! Inhibit = no manual mode.
! Authorize = the controller operates in manual mode only.
! 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.
563
Advanced Instructions
Prerequisites for Before set-up, you must follow the steps below:
Set-Up
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.
564
Advanced Instructions
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):
! First disconnect the probe from the analog card terminals.
! Check there is no wiring reversal (the colors of the wires connected to the inputs, compensation cable
for the PT100).
Warning: IN0 and IN1 input channels have a shared potential at the terminals (-).
! Check that the analog card is powered by a 24 VDC supply to the first two terminals.
! 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:
! %M2: Manual mode selection = 1,
(M2=1 => Manual Mode, M2=0 => Automatic Mode),
! %MW16: PWM period setting = 10,
! %MW17: Operating mode selection for the PID controller = 1 (PID only),
! %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 ( Object Category Frame, TwidoSuite Programming
Software, Online Help) frame and choose PID) from the Objects Type ( Object Type Frame, TwidoSuite
Programming Software, Online Help) frame.
Select the desired PID# from the PID table.
565
Advanced Instructions
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):
! First disconnect the probe from the analog card terminals.
! Check there is no wiring reversal (the colors of the wires connected to the inputs, compensation cable
for the PT100).
Warning: IN0 and IN1 input channels have a shared potential at the terminals (-).
! Check that the analog card is powered by a 24 VDC supply to the first two terminals.
! 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:
! %M2: Manual mode selection = 1,
(M2=1 => Manual Mode, M2=0 => Automatic Mode),
! %MW16: PWM period setting = 10,
! %MW17: Operating mode selection for the PID controller = 1 (PID only),
! %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 ( Object Category Frame, TwidoSuite Programming
Software, Online Help) frame and choose PID) from the Objects Type ( Object Type Frame, TwidoSuite
Programming Software, Online Help) frame.
Select the desired PID# from the PID table.
566
Advanced Instructions
Step Action
6 Activate the Animation tab for the required PID number and check that the animation matches the screen below:
Apply Cancel
Mes
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).
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).
567
Advanced Instructions
Step Action
9 If we see that the actuator is not controlled, check the output circuit:
! For an analog output, check the output voltage or current from the analog card.
! For a PWM output, check:
! the LED of the output concerned is lit (%Q0.1, in this example),
! the wiring of the supplies and 0V circuit for the TWDLMDA20DRT base outputs,
! the actuator power supply.
10 Close the PID display screen and stop the manual mode by entering the following values in the animation table:
! %M0: Enable loop controller = 0 (stop the loop controller)
! %M2: Selection of Automatic or Manual mode = 0 (stop manual mode)
! %MW17: Operating mode selection for the PID controller = 0
! %MW18: Manual setpoint associated with %M2 bit selection = 0.
568
Advanced Instructions
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.
Reminder of Kp, For operation in AT+PID mode to be possible, the following two conditions must be met:
Ti and Td ! The Kp, Ti, Td coefficients must be configured as memory addresses
Settings (%MWxx).
! The Action type in the Output tab must be set to a memory bit address
(%Mxx).
569
Advanced Instructions
570
Advanced Instructions
Step Action
7 Activate the Animation tab for the required PID number and check that the animation
matches the screen below:
Apply Cancel
Mes
AT
Output setpoint
PV 0
Limit Create an
AT animation table
0
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.
Trace
Note: The waiting time may last for 10-20 minutes before the AT procedure changes.
571
Advanced Instructions
Storage of Once the Auto-Tuning sequence is complete, the memory words assigned to the Kp,
Calculated Kp, Ti Ti and Td coefficients are completed with the calculated values. These values are
and Td written to the RAM memory and saved in the controller as long as the application is
Coefficients valid (power-down of less than 30 days) and no cold-start is performed (%S0).
Note: If the system is not influenced by outside fluctuations, the values may be
hard written in the settings of the PID controller and the controller switched to PID
mode only.
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.
572
Advanced Instructions
Accessing the To make it easier to debug the system, the animation table can be accessed at any
Animation Table time when the PID controller screens are in the foreground.
Note:
When viewing only the setpoint and process value graphs using the Detach button
in the Trace tab (see Trace tab window below), the animation table can then be
accessed via Program$%$Debug$%$Animate the program task.
PID 0
210
200
190
180
170
160
150 15 min
140
130
120
110
100
90
80
70 Initialize
60
50
40
30
20
10
0
15 0
Order Measure
Export
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.
573
Advanced Instructions
Returning to PID To return to the PID controller screens without losing the graph trace history,
Screens proceed as follows:
Step Action
1 Select Advanced Objects from the Object Category ( Object Category Frame,
TwidoSuite Online Help) frame and choose PID) from the Objects Type ( Object Type
Frame, TwidoSuite Online Help) frame.
Select the desired PID# from the PID table.
2 Click the Animation tab.
History of PID In the Animation tab for the PID controllers, you can access the last 15 states of the
States current controller by making your selection from the drop-down list as shown below:
General Input PID AT Output Animation
Apply Cancel
Note: The PID states are stored when the PC and TwidoSuite are in online mode.
574
Advanced Instructions
At a Glance
Aim of this This section describes the behavior, functionalities and implementation of the PID function.
Section
Note: To find out quick setup information about your PID controller as well as the
PID autotuning, please refer to the Twido PID Quick Start Guide, p. 551.
575
Advanced Instructions
Overview
576
Advanced Instructions
Corrector Adapter
MEASURE
PLC
ORDER
ACTUATORS
SENSORS
Process to order
577
Advanced Instructions
Diagram of the The following diagram describes all of the tasks to be carried out during the creation
Principal and debugging of a regulation application.
Note: The order defined depends upon your own work methods, and is provided as
an example.
Application / Data
Programming: Ladder, List
Input of constant and
Regulation functions,
mnemonic data, and
Operator dialogue
numerical values
API /Connector
Transfer of the application
in the PLC
Documentation
Application
folder
578
Advanced Instructions
At a Glance The Twido PID function is a function that is available for controllers compatible with
TwidoSuite 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.
579
Advanced Instructions
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 (optimum 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).
580
Advanced Instructions
Details of The following table indicates the different functions available and their scale:
Available
Functions
Function Scale and comment
Linear conversion of Allows you to convert a value in 0 to 10000 format (analog input module resolution) to a value
input between -32768 and 32767
Proportional gain Using a factor of 100, its value is between 1 and 10000. This corresponds to a gain value
varying between 0.01 and 100.
Note: If you enter an invalid value of gain (negative or null gain), TwidoSuite ignores this user-
setting and automatically assigns the default value of 100 to this factor.
Integral time Using a timebase of 0.1 seconds, its value is between 0 and 20000. This corresponds to an
integral time of between 0 and 2000.0 seconds.
Derivative time Using a timebase of 0.1 seconds, its value is between 0 and 10000. This corresponds to a
derivative time of between 0 and 1000.0 seconds.
Sampling period Using a timebase of 0.01 seconds, its value is between 1 and 10000. This corresponds to a
sampling period of between 0.01 and 100 seconds.
PWM output Using a timebase of 0.1 seconds, its value is between 1 and 500. This corresponds to a
modulation period of between 0.1 and 50 seconds.
Analog output Value between 0 and +10000
High level alarm on This alarm is set after conversion. It is set to a value between -32768 and 32767 if conversion
process variable is activated and to 0 and 10000 if it is not.
Low level alarm on This alarm is set after conversion. It is set to a value between -32768 and 32767 if conversion
process variable is activated and to 0 and 10000 if it is not.
High limit value on This limit value is between 0 and 10000 for an analog output value. When PWM is active, the
output limit corresponds to a percentage of the modulated period. 0% for 0 and 100% for 10000.
Low limit value on This limit value is between 0 and 10000 for an analog output value. When PWM is active, the
output limit corresponds to a percentage of the modulated period. 0% for 0 and 100% for 10000.
Manual mode When manual mode is active the output is assigned a fixed value set by the user. This output
value is between 0 and 10000 (0 to 100% for PWM output).
Use the manual mode to make trials to determine the min/max output limitation, or most
accurate AT output setpoint.
Direct or inverse Direct or inverse is available and acts directly on the output.
action
Auto-Tuning (AT) This function provides automatic tuning of the Kp, Ti, Td and Direct/Reverse Action
parameters to achieve optimum convergence of the control process.
Note: For a more in-depth explanation of how each of the functions described in
the above table works, refer to the diagram below.
581
Advanced Instructions
Operating The following diagram presents the operating principle of the PID function.
Principles
Sampling period
PID CORRECTOR
TI
Manual
Modulation
period
OPERATOR DIALOGUE
TwidoSuite PC
Note:The parameters used are described in the table on the page above and in the
configuration screens.
582
Advanced Instructions
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 ( Object Category Frame,
TwidoSuite Online Help) frame and choose PID from the Objects Type ( Object Type
Frame, TwidoSuite Online Help) frame.
3 Select the desired PID# from the PID table. (see p. 585)
Result: The PID configuration window opens and displays the General (see p. 588)
tab by default.
583
Advanced Instructions
584
Advanced Instructions
PID Selection The table below is used to select the PID you wish to Configure/Debug.
Table of the PID
Function All
PID 1
PID 2
PID 3
PID 4
PID 5
PID 6
PID 7
PID 8
PID 9
PID 10
PID 11
PID 12
PID 13
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.
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.
585
Advanced Instructions
PID Tabs of the The PID tabs allow you to to configure the PID parameters. The screen below shows
PID Function the tabs of The PID.
Général Input PID AT Output Animation
Apply Cancel
PID States
Word address:
PID Output
Input
Mes
AT
PV AT
Note: In some cases, some tabs and fields may not be accessible for either of the
two following reasons:
! The operating mode (offline or online) which is currently active does not allow
you to access these parameters.
! The "PID only" operating mode is selected, which prevents access to the AT tab
parameters that are no longer needed.
586
Advanced Instructions
1050
1000
950
900
850
800
750
15 min
700
650
600
550
500
450
400
350 Initialize
300
250
200
150
100
50
0
15 0
Order Measure
Export
This tab allows you to view PID operation and to make adjustments to the way it
behaves, see p. 606.
587
Advanced Instructions
At a Glance Select Advanced Objects from the Object Category ( Object Category Frame,
TwidoSuite Online Help) frame and choose PID from the Objects Type ( Object Type
Frame, TwidoSuite Online Help) frame.
Select the desired PID# from the PID table.
The PID configuration window allows you to:
! configure each TWIDO PID (in online mode),
! debug each TWIDO PID (in offline mode),
When you open this screen, if you are:
! in offline mode: the General tab is displayed by default and you have access to
the configuration parameters,
! 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:
! The operating mode (offline or online) which is currently active does not allow
you to access these parameters.
! The "PID only" operating mode is selected, which prevents access to the AT tab
parameters that are no longer needed.
588
Advanced Instructions
General Tab of The screen below is used to enter the general PID parameters.
the PID Function
Général Input PID AT Output Animation
Apply Cancel
PID States
Word address:
PID Output
Input
Mes
AT
PV AT
Limit
589
Advanced Instructions
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.
Operating mode Specify the desired operating mode here. You may choose from three
operating modes and a word address, as follows:
! PID
! AT
! AT+PID
! 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:
! %MWx = 1 (to set PID only)
! %MWx = 2 (to set AT + PID)
! %MWx = 3 (to set AT only)
! %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 p. 608.)
Diagram The diagram allows you to view the different possibilities available for
configuring your PID.
590
Advanced Instructions
Input tab of the The screen below is used to enter the PID input parameters.
PID Function
Général Input PID AT Output Animation
Apply Cancel
Authorize Authorize
PID Output
Input
Mes
591
Advanced Instructions
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 process variable is then
Max value 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.
592
Advanced Instructions
At a Glance The PID tab is used to enter the internal PID parameters.
PID Tab of the The screen below is used to enter the internal PID parameters.
PID Function
Général Input PID AT Output Animation
Apply Cancel
Kp (x0,01) %MW2
PID Output
Input
Mes
593
Advanced Instructions
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.
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).
Caution: 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.
594
Advanced Instructions
At a Glance The setting of correct PID parameters may be tedious, time-consuming and error-
prone. 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:
! Gain factor,
! Integral value,
! Derivative value, and
! Direct or Reverse action.
Thus, the AT function can provide rapid and optimum tuning for the process loop.
595
Advanced Instructions
AT Operating The following diagram describes the operating principle of the AT function and how
Principle it interacts with the PID loops:
Sampling
Auto/Manual
period Anolog
Direct/Reverse Output
PID controller Action
Operation mode Control
Integral Period
! dt
High Limit
TI +
SETPOINT + , +
KP
Numerical Limiter Output Digital
Output Variable Output
-
Operation mode d +
TD dt Low Limit
External
Conversion Derivative Manual
measurement
Output
Autotuning algorithm
Alarm Alarm
Low High
AT SET-
Sampling
Period
596
Advanced Instructions
AT Tab of the PID The screen below is used to enable/disable the AT function and enter the AT parameters.
function
Note: It is accessible in offline mode only.
Apply Cancel
Authorize
PID Output
Input
Mes
AT
PV
AT
Limit
597
Advanced Instructions
Description
WARNING
THE PROCESS VARIABLE (PV) LIMIT AND THE OUTPUT SETPOINT VALUES
MUST BE SET CAREFULLY.
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.
Failure to follow this instruction can result in death, serious injury, or
equipment damage.
WARNING
UNEXPECTED EQUIPMENT OPERATION
Do not use relay output with PID as this may result in the number of permitted
operations for relays being exceeded and the relay destroyed. Depending on the
process being controlled, this can have hazardous consequences.
Failure to follow this instruction can result in death, serious injury, or
equipment damage.
598
Advanced Instructions
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:
! If you set the Operating mode to PID+AT or AT from the General tab (see p. 588), then the Authorize
option is automatically checked and is not available (it cannot be cleared).
! 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.
Process Specify the limit that the measured process variable shall not exceed during the AT process. This
Variable parameter provides safety to the control system, as AT is an open loop process.
(PV) Limit 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 applied to the process.
setpoint 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:
! Kp, Ti and Td parameters must be set as memory words (%MWx) in the PID
tab;
! Action field is automatically set to "Address bit" in the OUT tab;
! Bit box must be filled in with an adequate memory bit (%Mx) in the OUT tab.
Calculated Kp, Once the AT process is complete, the calculated Kp, Ti and Td PID coefficients:
Ti, Td ! are stored in their respective memory words (%MWx), and
Coefficients ! can be viewed in the Animation tab, in TwidoSuite online mode only.
599
Advanced Instructions
Ouput Tab of the The screen below is used to enter the internal PID parameters.
PID Function
Général Input PID AT Output Animation
Apply Cancel
Bit Bit
PID Output
Input
Mes
AT
Mes AT
Limit
600
Advanced Instructions
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 options are available:
Bit 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 options are available:
Bit 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 Specify the PID output in auto mode here.
output This Analog output can be %MW-type (%MW0 to %MW2999) or %QW-type (%QWx.0).
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 between 1 and 500 and can be
Period (0.1s) an internal word (%MW0 to %MW2999) or an internal constant (%KW0 to %KW255).
Output 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.
601
Advanced Instructions
setpoint
602
Advanced Instructions
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 ( Object Category Frame, TwidoSuite Online Help) frame and choose PID from
the Objects Type ( Object Type Frame, TwidoSuite Online Help) 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 p. 604) tab
by default.
603
Advanced Instructions
Animation Tab of The screen below is used to view and debug the PID.
PID Function Général Input PID AT Output Animation
Apply Cancel
Mes
AT
Output setpoint
PV 0
Limit Create an
AT animation table
0
604
Advanced Instructions
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.
605
Advanced Instructions
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.
Animation Tab of The screen below is used to view the PID control.
PID Function
PID 0
1050
1000
950
900
850
800
750
60 min
700
60 min
650
45 min
600
30 min
550
500 15 min
450
400
350 Initialize
300
250
200
150
100
50
0
30 15 0
Order Measure
Export
606
Advanced Instructions
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.
607
Advanced Instructions
At a Glance In addition to the List of PID States available from the Animation dialog box (see
p. 604) 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 p. 588.
PID State The PID state memory word can record any of three types of PID information, as follows:
Memory Word ! Current state of the PID controller (PID State)
! Current state of the autotuning process (AT State)
! PID and AT error codes
PID State The following is the PID controller state versus memory word hexadecimal coding
Memory Word concordance table:
PID State hexadecimal notation Description
0000h PID control is not active
2000h PID control in progress
4000h PID setpoint has been reached
608
Advanced Instructions
Description of AT The autotuning process is divided into 4 consecutive phases. Each phase of the
State 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:
PID 0
1050
1000
950
End of Autotuning
900 (Computing the AT
parameters)
850
800
750
45 min
700
60 min
650
45 min
600
30 min
550
500 15 min
450
400
350 Initialize
300
250
200
150
100
50
0
45 30 15 0
Phase 1: Phase 2: First 15
Phase 3: Phase 4: Second
Stabilization Step-Response Relaxation Step-Response
609
Advanced Instructions
AT State Memory The following is the PID controller state versus memory word hexadecimal coding
Word concordance table:
AT State hexadecimal notation Description
0100h Autotuning phase 1 in progress
0200h Autotuning phase 2 in progress
0400h Autotuning phase 3 in progress
0800h Autotuning phase 4 in progress
1000h Autotuning process complete
610
Advanced Instructions
PID and AT Error The following table describes the potential execution errors that may be
Codes encountered during both PID control and autotuning processes:
PID/AT Error code
Processes (hexadecimal) Description
PID Error 8001h Operating mode value out of range
8002h Linear conversion min and max equal
8003h Upper limit for discrete output lower than lower limit
8004h Process variable limit out of linear conversion range
8005h Process variable limit less than 0 or greater than 10000
8006h Setpoint out of linear conversion range
8007h Setpoint less than 0 or greater than 10000
8008h Control action different from action determined at AT start
Autotuning 8009h Autotuning error: the process variable (PV) limit has been reached
Error 800Ah Autotuning error : due to either oversampling or output
setpoint too low
800Bh Autotuning error: Kp is zero
800Ch Autotuning error: the time constant is negative
800Dh Autotuning error: delay is negative
800Eh Autotuning error: error calculating Kp
800Fh Autotuning error: time constant over delay ratio > 20
8010h Autotuning error: time constant over delay ratio < 2
8011h Autotuning error: the limit for Kp has been exceeded
8012h Autotuning error: the limit for Ti has been exceeded
8013h Autotuning error: the limit for Td has been exceeded
611
Advanced Instructions
Overview of PID The PID control function relies on the following three user-defined parameters: Kp,
Tuning Ti and Td. PID tuning aims at determining these process parameters accurately to
provide optimum control of the process.
Scope of the The AT function of the Twido PLC is especially suited for automatic tuning of thermal
Auto-Tuning processes. As values of the PID parameters may vary greatly from one control process
to another, the auto-tuning function provided by the Twido PLC can help you determine
more accurate values than simply provided by best guesses, with less effort.
Auto-Tuning When using the auto-tuning function, make sure the control process and the Twido
Requirements PLC meet all of the following four requirements:
! The control process must be an open-loop, stable system.
! 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.)
! During operation of the auto-tuning, make sure that no disturbances enter
through the process for either computed parameters will be erroneous or the
auto-tuning process will simply fail (e.g.: the door of the oven shall not be opened,
not even momentarily.)
! 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.)
612
Advanced Instructions
AT Operating The auto-tuning can be used either independently (AT mode) or in conjunction with
Modes the PID control (AT + PID):
! 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."
! 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:
! no PID parameter is computed;
! the AT numerical output is set to output last applied to the process before start
of the autotuning;
! an error message appears in the List of PID States drop-down list
! the PID control is cancelled.
Methods for As will be explained in the two following sections (see p. 626 and p. 628), the
Determining the sampling period (Ts) is a key parameter of the PID control. The sampling period
Sampling Period can be deduced from the AT time constant (-).
(Ts) There are two methods for evaluating the correct sampling period (Ts) by using the
auto-tuning:· They are described in the following sections.
! The process response curve method
! The trial-and-error method
Introducing the This method consists in setting a step change at the control process input and
Process recording the process output curve with time.
Response Curve The process response curve method makes the following assumption:
Method ! The control process can be adequately described as a first-order with time delay
model by the following transfer function:
S k – .p
---- = --------------- / e
U 1 + -p
(For more details, see Appendix 2: First-Order With Time Delay Model)
613
Advanced Instructions
Using the To determine the sampling period (Ts) using the process response curve method,
Process follow these steps:
Response Curve
Step Action
Method
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 San 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].
614
Advanced Instructions
Example of This example shows you how to measure the time constant (-) of a simple thermal process
Process by using the process response curve method described in the previous subsection.
Response Curve The experimental setup for the time constant measurement is as follows:
! The control process consists in a forced air oven equipped with a heating lamp.
! Temperature measurements are gathered by the Twido PLC via a Pt100 probe,
and temperature data are recorded in °C.
! The Twido PLC drives a heating lamp via the PWM discrete output of the PID.
615
Advanced Instructions
Step Action
6 The following information is obtained directly from the graphical analysis of the response curve, as shown in the figure below:
PID 0
1050
1000
950
900
850
800
750
60 min
700
650
600
550 S[e]=660
500
450 S[63%]=512
400
350 Initialize
300
250
200
150
100
50
60 45 30 15 0
S[i]=260 -=570s
Order Measure Export
where
! S[i] = initial value of process variable = 260
! S[e] = ending value of process variable = 660
! S[63%] = process variable at 63% rise = S[i] + (S[i] - S[e]) x 63%
= 260+(660-260)x63%
= 512
! - = time constant
= time elapsed from the start of the rise till S[63%] is reached
= 9 min 30 s = 570 s
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.)
616
Advanced Instructions
Trial-and-Error The trial-and-error method consists in providing successive guesses of the sampling
Method 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.
9 Two cases may occur:
! Auto-tuning completes successfully: You may continue to Step 9.
! Auto-tuning fails: 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:
! 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.
! 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.
617
Advanced Instructions
Adjusting PID To refine the process regulation provided by the PID parameters (Kp, Ti, Td)
Parameters obtained from auto-tuning, you also have the ability to adjust those parameter values
manually, directly from the PID tab of the PID configuration screen or via the
corresponding memory words (%MW).
Limitations on Auto-tuning is best suited for processes whose time constant (-) and delay-time (.)
Using the Auto- meet the following requirement: 10 s < (- + .) < 2700 s (i.e.: 45 min)
tuning and the
PID Control Note: Auto-tuning will not work when: (-/.) < 2 or (-/.) > 20.
PID control is best suited for the regulation of processes that satisfy the following condition:
2 < (-/.) < 20 where (-) is the time constant of the process and (.) is the delay-time.
618
Advanced Instructions
Troubleshooting The following table records the auto-tuning error messages and describes possible
Errors of the causes as well as troubleshooting actions:
Auto-tuning
Function
Error Message Possible Cause Explanation / Possible Solution
Autotuning error: the The process variable is reaching the This is a system safety.
process variable (PV) limit maximum value allowed. As the AT is an open-loop process, the Process
has been reached Variable (PV) Limit works as an upper limit.
Autotuning error : due to Any of two possible causes: Increase either the sampling period or the AT
either oversampling or ! Sampling period is too small. Output Setpoint value.
output setpoint too low ! AT Output is set too low.
Autotuning error: the time The sampling period may be too large. For more details, please check out p. 612.
constant is negative
Autotuning error: error The AT algorithm has failed (no Check the PID and AT parameters and make
calculating Kp convergence). adjustments that can improve convergence.
! Disturbances on the process Check also that there is no disturbance that
while autotuning have caused a could affect the process variable.
distortion of the process static Try to modify
gain evaluation. ! the ouput setpoint,
! The process variable transient ! the sampling period.
response is not big enough for the Make sure there is no process disturbance
autotuning to determine the static
while autotuning is in progress.
gain.
! A combination of the above
possible causes may effect on the
process.
Autotuning error: time -/. > 20 PID regulation is no longer guaranteed.
constant over delay ratio > For more details, please check out p. 612.
20
Autotuning error: time -/. < 2 PID regulation is no longer guaranteed.
constant over delay ratio < 2 For more details, please check out p. 612.
Autotuning error: the limit for Computed value of static gain (Kp) is Measurement sensitivity of some application
Kp has been exceeded 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 time Computational limit is reached.
Td has been exceeded constant (Td) is greater than 10000.
619
Advanced Instructions
Introduction Numerous methods to adjust the PID parameters exist, we suggest Ziegler and
Nichols which have two variants:
! closed loop adjustment,
! open loop adjustment.
Before implementing one of these methods, you must set the PID action direction:
! if an increase in the OUT output causes an increase in the PV measurement,
make the PID inverted (KP > 0),
! on the other hand, if this causes a PV reduction, make the PID direct (KP < 0).
Closed Loop This principal consists of using a proportional command (Ti = 0, Td = 0 ) to start the
Adjustment process by increasing production until it starts to oscillate again after having applied a
level to the PID corrector setpoint. All that is required is to raise the critical production
level (Kpc) which has caused the non damped oscillation and the oscillation period (Tc)
to reduce the values giving an optimal regulation of the regulator.
Measure
Tc
time
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 -
Note: This adjustment method provides a very dynamic command which can
express itself through unwanted overshootsduring the change of setpoint pulses.
In this case, lower the production value until you get the required behavior.
620
Advanced Instructions
Open Loop As the regulator is in manual mode, you apply a level to the output and make the
Adjustment procedure response start the same as an integrator with pure delay time.
Output
t
Measure
Integrator Process response
M= S
Tu Tg
t
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 -
Note: Attention to the units. If the adjustment is carried out in PL7, multiply the
value obtained for KP by 100.
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.
621
Advanced Instructions
Influence of Proportional action is used to influence the process response speed. The higher the
Proportional gain, the faster the response, and the lower the static error (in direct proportion),
Action though the more stability deteriorates. A suitable compromise between speed and
stability must be found. The influence of integral action on process response to a
scale division is as follows:
Kp too high
Kp correct
°C
Static error
Kp too low
622
Advanced Instructions
Influence of Integral action is used to cancel out static error (deviation between the process value
Integral Action and the setpoint). The higher the level of integral action (low Ti), the faster the
response and the more stability deteriorates. It is also necessary to find a suitable
compromise between speed and stability. The influence of integral action on
process response to a scale division is as follows:
Ti too high
Ti correct
Ti too low
623
Advanced Instructions
Influence of Derivative action is anticipatory. In practice, it adds a term which takes account of
Derivative Action the speed of variation in the deviation, which makes it possible to anticipate changes
by accelerating process response times when the deviation increases and by
slowing them down when the deviation decreases. The higher the level of derivative
action (high Td), the faster the response. A suitable compromise between speed and
stability must be found. The influence of derivative action on process response to a
scale division is as follows:
Td too high
Td too low
Td correct
624
Advanced Instructions
Limits of the PID If the process is assimilated to a pure delay first order with a transfer function:
Control Loop ! – - "p
!e "
! H ! p " " = K --------------------
! 1 + .p "
where:
- =model delay,
100%
Measure = M0+DM
0M
Measure = M0
- . t
-
---
The process control performance depends on the ratio .
-
---
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.
-
---
For . >20, a process control using a threshold plus hysterisis is sufficient.
625
Advanced Instructions
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).
The PID The Twido PID controller implements a mixed (serial - parallel) PID correction (see PID
Controller Model Model Diagram below) via an analog measurement and setpoint in the [0-10000] format
and provides an analog command to the controlled process in the same format.
The mixed form of the PID controller model is described in the following diagram:
I (Ti)
+
, +
P (Kp) U
D (Td)
where
where:
! I = the integral action (acting independently and parallel to the derivative action),
! D = the derivative action (acting independently and parallel to the integral
action),
! P = the proportional action (acting serially on the combined output of the integral
and derivative actions,
! U = the PID controller output (later fed as input into the controlled process.)
626
Advanced Instructions
The PID Control The PID controller is comprised of the mixed combination (serial - parallel) of the
Law controller gain (Kp), and the integral (Ti) and derivative (Td) time constants. Thus,
the PID control law that is used by the Twido controller is of the following form (Eq.1):
( i )
% Ts Td %
% Ti "
u ! i " = K P / & , ! i " + ----- , ! j " + ------ 2 , ! i " – , ! i – 1 " 3 '
Ts %
# j = 1 $
where
! Kp = the controller proportional gain,
! Ti = the integral time constant,
! Td = the derivative time constant,
! Ts = the sampling period,
! ,(i) = the deviation (,(i) = setpoint - process variable.)
Note: Two different computational algorithms are used, depending on the value of
the integral time constant (Ti):
! Ti 1 0: In this case, an incremental algortihm is used.
! 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 p. 593.
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 p. 628.)
627
Advanced Instructions
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.
First-Order With It is widely assumed that simple (one-stimulus) thermal processes can be
Time Delay adequately approximated by a first-order with time delay model.
Model The transfer function of such first-order, open-loop process has the following form in
the Laplace domain (equ.2):
S k – .p
---- = --------------- / e
U 1 + -p
where
! k = the static gain,
! - = the time constant,
! . = the delay-time,
! U = the process input (this is the output of the PID controller),
! S = the process output.
628
Advanced Instructions
The Process The key parameter of the process response law (equ.2) is the time constant -. It is
Time Constant - a parameter intrinsic to the process to control.
The time constant (-) of a first-order system is defined as the time (in sec) it takes
the system output variable to reach 63% of the final output from the time the system
started reacting to the step stimulus u(t).
The following figure shows a typical first-order process response to a step stimulus:
Process output
s(t)
S
95% of S
Step response s(t)
86% of S
Setpoint u(t)
63% of S
0s 0U
- 2- 3- time (t)
. : time delay +. +. +.
where
! k = the static gain computed as the ratio 0S/0U,
! - = the time at 63% rise = the time constant,
! 2- = the time at 86% rise,
! 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 p. 612.)
629
Advanced Instructions
At a Glance
Aim of this This section describes advanced floating point (see p. 34) instructions in TwidoSuite
Section language.
The Comparison and Assignment instructions are described in the Numerical
Processing, p. 475
630
Advanced Instructions
General These instructions are used to perform an arithmetic operation between two
operands or on one operand.
%I3.2 %MF1:=SQRT(%MF10)
%I3.3 %MF2:=ABS(%MF20)
P
%I3.5 %MF8:=TRUNC(%MF2)
P
LD %I3.2
[%MF1:=SQRT(%MF10)]
LDR %I3.3
[%MF2:=ABS(%MF20)]
LDR %I3.5
[%MF8:=TRUNC(%MF2)]
631
Advanced Instructions
Ladder Language
%M0 %MF0:=LOG(%MF10)
%I3.2 %MF2:=LN(%MF20)
%I3.3 %MF4:=EXP(%MF40)
P
%I3.4 %MF6:=EXPT(%MF50,%MW52)
P
LD %I3.2
[%MF2:=LN(%MF20)]
LDR %I3.3
[%MF4:=EXP(%MF40)]
LDR %I3.4
[%MF6:=EXPT(%MF50,%MW52)]
632
Advanced Instructions
Rules of use ! Operations on floating point and integer values can not be directly mixed.
Conversion operations (see p. 638) convert into one or other of these formats.)
! The system bit %S18 is managed in the same way as integer operations (see p. 484),
the word %SW17 (see p. 677) indicates the cause of the fault.
! 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 error.
633
Advanced Instructions
Trigonometric Instructions
%I3.2 %MF2:=TAN(%MF10)
%I3.3 %MF4:=ATAN(%MF20)
P
LD %I3.2
[%MF2:=TAN(%MF10)]
LDR %I3.3
[%MF4:=ATAN(%MF20)]
Structured text language
IF %M0 THEN
%MF0:=SIN(%MF10);
END_IF;
IF %I3.2 THEN
%MF2:=TAN(%MF10);
END_IF;
IF %I3.3 THEN
%MF4:=ATAN(%MF20);
END_IF;
634
Advanced Instructions
Rules of use ! 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 p. 677) indicates the cause of the error.
! the functions SIN/COS/TAN allow as a parameter an angle between – 40965
and 40965 but their precision decreases progressively for the angles outside the
period – 2 5 and +25 because of the imprecision brought by the modulo 25
carried out on the parameter before any operation.
635
Advanced Instructions
Conversion instructions
%M2 %MF2:=RAD_TO_DEG(%MF20)
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;
636
Advanced Instructions
Rules of use The angle to be converted must be between -737280.0 and +737280.0 (for DEG_TO_RAD
conversions) or between – 40965 and 40965 (for RAD_TO_DEG conversions).
For values outside these ranges, the displayed result will be + 1.#NAN, the %S18
and %SW17:X0 bits being set at 1.
637
Advanced Instructions
%MF0:=INT_TO_REAL(%MW10)
%I1.8 %MD4:=REAL_TO_DINT(%MF9)
LD I1.8
[%MD4:=REAL_TO_DINT(%MF9)]
638
Advanced Instructions
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.
639
Advanced Instructions
Precision of Standard IEEE 754 defines 4 rounding modes for floating operations.
Rounding 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
640
Advanced Instructions
At a Glance
Aim of this This section describes advanced ASCII instructions in TwidoSuite language.
Section
641
Advanced Instructions
ROUND Instruction
Instruction The ROUND instruction rounds a floating point representation that is stored in an
Description ASCII string.
Instruction For the ROUND instruction, use the following syntax: Op1 := ROUND( Op2,Op3 ).
Syntax For example:
In list instruction:
%MWi:7 := ROUND( %MWj,n )
In ladder language:
642
Advanced Instructions
Syntax Errors TwidoSuite checks the syntax. The following examples would result in syntax errors:
Incorrect Syntax Correct Syntax
%MW10:= ROUND (%MW1,4) %MW10:7 := ROUND (%MW1,4)
missing ":7" in result
%MW10:13:= ROUND (%MW1,4) %MW10:7 := ROUND (%MW1,4)
%MW10:n where n 1 7 is incorrect
643
Advanced Instructions
Instruction The ASCII to Integer conversion instruction converts an ASCII string into an Integer
Description value.
Instruction For the ASCII to Integer conversion instruction, use the following syntax:
Syntax Op1 := ASCII_TO_INT( Op2 ).
For example:
In list instruction:
%MWi := ASCII_TO_INT( %MWj )
In ladder language:
Instruction The table below describes the ASCII to Integer conversion function parameters:
Parameters
Parameters Description
Op1 %MW in which result is stored
Op2 %MW or %KW
644
Advanced Instructions
Examples Consider that the following ASCII data has been stored in %MW10 to %MW13:
Parameter Hexadecimal value ASCII value
%MW10 16#3932 ‘9’, ’2’
%MW11 16#3133 ‘1’, ‘3’
%MW12 6#2038 ‘ ‘, ‘8’
%MW13 16#3820 ‘8’, ‘ ‘
645
Advanced Instructions
Instruction The Integer to ASCII conversion instruction converts an Integer into an ASCII string
Description value.
Instruction For the Integer to ASCII conversion instruction, use the following syntax:
Syntax Op1 := INT_TO_ASCII( Op2 ).
For example:
In list instruction:
%MWi:4 := INT_TO_ASCII( %MWj )
In ladder language:
Instruction The table below describes the Integer to ASCII conversion function parameters:
Parameters
Parameters Description
Op1 %MW in which result is stored
Op2 %MW, %KW, %SW, %IW, %QW or any WORD
(Immediate values are not accepted)
Syntax Errors TwidoSuite checks the syntax. The following examples would result in syntax errors:
Incorrect Syntax Correct Syntax
%MW10 := INT_TO_ASCII (%MW1) %MW10:4 := INT_TO_ASCII (%MW1)
missing ":4" in result
%MW10:n := INT_TO_ASCII (%MW1) %MW10:4 := INT_TO_ASCII (%MW1)
%MW10:n where n 1 4 is incorrect
646
Advanced Instructions
647
Advanced Instructions
Instruction The ASCII to Float conversion instruction converts an ASCII string into a floating
Description point value.
Instruction For the ASCII to Float conversion instruction, use the following syntax:
Syntax Op1 := ASCII_TO_FLOAT( Op2 ).
For example:
In list instruction:
%MFi := ASCII_TO_FLOAT( %MWj )
In ladder language:
Instruction The table below describes the ASCII to Float conversion function parameters:
Parameters
Parameters Description
Op1 %MF
Op2 %MW or %KW
648
Advanced Instructions
Examples Consider that the following ASCII data has been stored in %MW10 to %MW14:
Parameter Hexadecimal value ASCII value
%MW10 16#382D '8', '-'
%MW11 16#322E '2', '.'
%MW12 16#3536 '5', '6'
%MW13 16#2B65 '+', 'e'
%MW14 16#2032 ' ','2'
649
Advanced Instructions
Instruction The Float to ASCII conversion instruction converts a floating point value into an
Description ASCII string value.
Instruction For the Float to ASCII conversion instruction, use the following syntax:
Syntax Op1 := FLOAT_TO_ASCII( Op2 ).
For example:
In list instruction:
%MWi:7 := FLOAT_TO_ASCII( %MFj )
In ladder language:
Conversion The table below describes the Float to ASCII conversion function parameters:
Parameters
Parameters Description
Op1 %MW
Op2 %MF or %KF
650
Advanced Instructions
Syntax Errors TwidoSuite checks the syntax. The following examples would result in syntax errors:
Incorrect Syntax Correct Syntax
%MW10 := FLOAT_TO_ASCII (%MF1) %MW10:7 := FLOAT_TO_ASCII(%MF1)
missing ":7" in result
%MW10:n := FLOAT_TO_ASCII (%MF1) %MW10:7 := FLOAT_TO_ASCII(%MF1)
%MW10:n where n 1 7 is incorrect
651
Advanced Instructions
At a Glance
652
Advanced Instructions
General The SUM_ARR function adds together all the elements of an object table:
! if the table is made up of double words, the result is given in the form of a double word
! if the table is made up of floating words, the result is given in the form of a floating word
%MD5:=SUM_ARR(%KD5:2)
%MF0:=SUM_ARR(%KF8:5)
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
653
Advanced Instructions
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.
%MW0:=EQUAL_ARR(%MD20:7,%KF0:7)
%MW15:=EQUAL_ARR(%MF0:5,%KF0:5)
%MW15:=EQUAL_ARR(%MF0:5,%KF0:5)
654
Advanced Instructions
Note:
! 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:
Rank Word Table Constant word tables Difference
0 %MD30=10 %KD0=10 =
1 %MD32=20 %KD2=20 =
2 %MD34=30 %KD4=60 Different
3 %MD36=40 %KD6=40 =
655
Advanced Instructions
%I1.2 %MW0:=FIND_GTR(%MD20:7,%KD0)
%MW1:=FIND_LTR(%MF40:5,%KF4)
656
Advanced Instructions
Example %MW5:=FIND_EQR(%MD30:4,%KD0)
Search for the position of the first double word =%KD0=30 in the table:
Rank Word Table Result
0 %MD30=10 -
1 %MD32=20 -
2 %MD34=30 Value (val), rank
3 %MD36=40 -
657
Advanced Instructions
%I1.2 %MD0:=MIN_ARR(%MD20:7)
%MF8:=MIN_ARR(%MF40:5)
Syntax Syntax of table search instructions for max and min values:
Function Syntax
MAX_ARR Res:=Function(Tab)
MIN_ARR
658
Advanced Instructions
%I1.2 %MW0:=OCCUR_ARR(%MD20:7,%MD1)
Syntax Syntax of table search instructions for max and min values:
Function Syntax
OCCUR_ARR Res:=Function(Tab,Val)
659
Advanced Instructions
0
1
2
3
4
5
0
1
2
3
4
5
660
Advanced Instructions
%I1.2 ROR_ARR(2,%MD20:7)
P
%I1.3 ROR_ARR(2,%MF40:5)
P
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:
Type Number of positions (n) Table (Tab)
Floating word tables %MWi, immediate value %MFi:L
Double word tables %MWi, immediate value %MDi:L
661
Advanced Instructions
%I1.2 SORT_ARR(-1,%MD20:6)
%I1.3 SORT_ARR(0,%MD40:8)
! 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.
! the result (sorted table) is returned in the Tab parameter (table to sort).
Parameters of table sort functions:
Type Sort direction Table (Tab)
Double word tables %MWi, immediate value %MDi:L
Floating word tables %MWi, immediate value %MFi:L
662
Advanced Instructions
Overview The LKUP function is used to interpolate a set of X versus Y floating point data for
a given X value.
Interpolation The LKUP function makes use the linear interpolation rule, as defined in the
Rule following equation:
! Yi + 1 – Yi "
Y = Y i + ----------------------------- / ! X – X i "
(equation 1:) ! Xi + 1 – Xi "
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):
! Yi + 1 – Yi "
Y = -----------------------------
(equation 2:) 2
for X i = Xi + 1 = X , where i = 16 ! m – 1 " .
Graphical The following graph illustrates the linear interpolation rule described above:
Representation
of the Linear Y
Interpolation Ym
Rule
Yi+1
Ym-1
Y
Yi
0 Xi X Xi+1 Xm-1 Xm X
663
Advanced Instructions
Syntax of the The LKUP function uses three operands, two of which are function attributes, as
LKUP Function described in the following table:
Syntax Operand 1 (Op1) Operand 2 (Op2) Operands 3 (Op3)
Output variable User-defined (X) value User-defined (Xi,Yi) variable array
[Op1: = LKUP(Op2,Op3)] %MWi %MF0 Integer value, %MWi or %KWi
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 failed, and what caused for the failure, 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:
! Op3 is set as odd number, or
! 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:
664
Advanced Instructions
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:
The floating point array Op3 (%MFi) has a structure similar to that of the following
example (where Op3=8):
(X) (X1) (X2) (X3)
%MF0 %MF4 %MF8 %MF12
%MF2 %MF6 %MF10 %MF14
(Y) (Y1) (Y2) (Y3)
(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 an error of the LKUP
function:
! Op3 is an even number, and
! Op3 ' 6 (for there must be at least 2 data points to allow linear interpolation).
%I1.2 %MW22:=LKUP(%MF0,10)
LD %I1.2
[%MW22:=LKUP(%MF0,10)]
665
Advanced Instructions
666
Advanced Instructions
General The MEAN function is used to calculate the mean average from a given number of
values in a floating point table.
Parameters of the calculation function for a given number L of values from a floating
point table:
Operand (Op1) Result (Res)
%MFi:L, %KFi:L %MFi
667
Advanced Instructions
668
System Bits and System Words
19
At a Glance
Subject of this This chapter provides an overview of the system bits and system words that can be
Chapter 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 The following table provides an overview of the system bits and how they are controlled:
Description
System Function Description Init Control
Bit state
%S0 Cold Start Normally set to 0, it is set to 1 by: 0 S or U->S
! A power return with loss of data (battery fault),
! The user program or Animation Table Editor,
! Operations Display.
5 ms 5 ms
%S8 Wiring test Initially set to 1, this bit is used to test the wiring when the 1 U
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:
! Set to 1, output reset,
! Set to 0, wiring test authorized.
%S9 Reset outputs Normally set to 0. It can be set to 1 by the program or by the 0 U
terminal (in the Animation Table Editor):
! At state 1, outputs are forced to 0 when the controller is
in RUN mode,
! At state 0, outputs are updated normally.
%S10 I/O fault Normally set to 1. This bit can be set to 0 by the system when 1 S
an I/O fault is detected.
This bit can be set to its initial state 1 by the user and the
system (on cold re-start).
%S38 Permission for events Normally at 1. 1 U->S
to be placed in the ! Set to 0, events cannot be placed in the events queue.
events queue ! Set to 1, events are placed in the events queue as soon
as they are detected,
This bit can be set to its initial state 1 by the user and the
system (on cold re-start).
%S39 Saturation of the Normally at 0. 0 U->S
events queue ! Set to 0, all events are reported,
! Set to 1, at least one event is lost.
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 program or 0 U->S
time using words the Operator Display.
%SW49 to %SW53 ! Set to 0, the date and time can be read,
! Set to 1, the date and time can be updated.
When this bit is set to 1, the time of day clock data is not valid.
The date and time may never have been configured, the battery
may be low, or the controller correction constant may be invalid
(never configured, difference between the corrected clock value
and the saved value, or value out of range).
State 1 transitioning to state 0 forces a write of the correction
constant to the RTC.
%S52 RTC = error This bit managed by the system indicates that the RTC correction 0 S
has not been entered, and the date and time are false.
! Set to 0, the date and time are consistent,
! At state 1, the date and time must be initialized.
%S59 Updating the date and Normally on 0, this bit can be set to 1 or 0 by the program or 0 U
time using word the Operator Display.
%SW59 ! Set to 0, the system word %SW59 is not managed,
! 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 user to 0 S or U->S
enable/disable turn on/off the BAT LED:
(only on controllers ! Set to 0, BAT LED is enabled (it is reset to 0 by the
that support an system at power-up),
external battery: ! Set to 1, BAT LED is disabled (LED remains off even if
TWDLC••40DRF there is a low external battery power or there is no
controllers.) external battery in the compartment).
(1)
This system bit is not available for the Twido Extreme
TWDLEDCK1 PLC.
%S69 (1) User STAT LED Set to 0, STAT LED is off. 0 U
display Set to 1, STAT LED is on.
(1)
This system bit is not available for the Twido Extreme
TWDLEDCK1 PLC.
%S75 (1) External battery status This system bit is set by the system. It indicates the external 0 S
(only on controllers battery status and is readble by the user:
that support an ! Set to 0, external battery is operating normally,
external battery: ! Set to 1, external battery power is low, or external battery
TWDLC••40DRF is absent from compartment.
controllers.) (1)
This system bit is not available for the Twido Extreme
TWDLEDCK1 PLC.
Note: (1) This system bit is not available for the Twido Extreme TWDLEDCK1 PLC.
Introduction The following section provides detailed information about the function of the system
words and how they are controlled.
Detailed The following table provides detailed information about the function of the system
Description words and how they are controlled:
System Function Description Control
Words
%SW0 Controller scan Modifies controller scan period defined at configuration through the U
period (periodic task) user program in the Animation Table Editor.
%SW1 Save the value of a Modifies the cycle time [5-255 ms] of a Periodic event, without losing U
Periodic event the Period value saved in the Periodic event box of the Scan Mode
window.
Allows you to recover the Period value saved in the Periodic event
box:
! in case of a cold start, or
! if the value you write in %SW1 is outside [5-255] range.
%SW1 value can be modified at each end of a cycle, in the program
or in the Animation table, without having to stop the program. Cycle
times can be correctly observed while the program is running.
%SW6 Controller Status Controller Status: S
0 = NO CONFIG
2 = STOP
3 = RUN
4 = HALT
! 01 = 32 kb EEPROM cartridge *
! 10 = 64 kb EEPROM cartridge*
! 11 = Reserved for future use
! Bit [4]: Application in RAM different than EEPROM:
! Set to 1 if RAM application different to EEPROM.
! 01 = 32 kb EEPROM cartridge *
! 10 = 64 kb EEPROM cartridge*
! 11 = Reserved for future use
! Bit [4]: Application in RAM different than EEPROM:
! Set to 1 if RAM application different to EEPROM.
%SW20 to Provides status for For more details, please refer to Programming and diagnostics for S
%SW27 CANopen slave the CANopen fieldbus, p. 298.
modules with node
address 1 to 16.
%SW30 Last scan time Shows execution time of the last controller scan cycle (in ms). S
Note: This time corresponds to the time elapsed between the start
(acquisition of inputs) and the end (update of outputs) of a scan
cycle.
%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,
save/restore this value is updated with the number of memory words restored to RAM.
function 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.
Stop bit
RTS /
Data
CTS
End of the character string bit Parity Baud rate
! Baud rate:
! 0: 1200 bauds,
! 1: 2400 bauds,
! 2: 4800 bauds,
! 3: 9600 bauds,
! 4: 19200 bauds,
! 5: 38400 bauds.
! RTS/CTS:
! 0: disabled,
! 1: enabled.
! Parity:
! 00: none,
! 10: odd,
! 11: even.
! Stop bit:
! 0: 1 stop bit,
! 1: 2 stop bits.
! Data bits:
! 0: 7 data bits,
! 1: 8 data bits.
Note: %S104, %SW104 and Comm 2 are not available for
Twido Extreme TWDLEDCK1 PLC.
Timeout response
Timeout frame in ms
in multiples of 100 ms
%SW114 Enable schedule Enables or disables operation of schedule blocks by the user program S and U
blocks or operator display.
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 TWDLEDCK1
PLC.
(2) If a single expansion module is missing at power on, then all expansion module
% 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 An applied voltage that can be adjusted and converted into a discrete value for use
potentiometer 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. Errors 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.
Animation A specialized window in the TwidoSuite application for viewing and creating
Tables Editor Animation Tables.
Application A specialized window in the TwidoSuite that displays a graphical tree-like view of an
browser application. Provides for convenient configuration and viewing of an application.
ASCII (American Standard Code for Information Interchange) Communication protocol for
representing alphanumeric characters, notably letters, figures and certain graphic
and control characters.
Auto line validate When inserting or modifying List instructions, this optional setting allows for program
lines to be validated as each is entered for errors and unresolved symbols. Each
element must be corrected before you can exit the line. Selected using the
Preferences dialog box.
Auto load A feature that is always 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).
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.
Cold start or A start up by the controller with all data initialized to default values, and the program
restart started from the beginning with all variables cleared. All software and hardware settings
are initialized. A cold restart can be caused by loading a new application into controller
RAM. Any controller without battery backup always powers up in Cold Start.
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 Type of Twido controller that provides a simple, all-in-one configuration with limited
controller expansion. Modular is the other type of Twido controller.
Configuration Specialized TwidoSuite window used to manage hardware and software configuration.
editor
Constants A configured value that cannot be modified by the program being executed.
Cross references Generation of a list of operands, symbols, line/rung numbers, and operators used in
an application to simplify creating and managing applications.
Cross References A specialized window in the TwidoSuite application for viewing cross references.
Viewer
Date/Clock Allow control of events by month, day of month, and time of day. See Schedule Blocks.
functions
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).
Erase This command deletes the application in the controller, and has two options:
! To delete the contents of the controller RAM, the controller internal EEPROM,
and the installed optional backup cartridge.
! 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.
Expansion I/O Optional Expansion I/O Modules are available to add I/O points to a Twido controller.
modules (Not all controller models allow expansion).
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 The Firmware Executive is the operating system that executes your applications and
executive 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.
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.
Instruction List A program written in instruction list language (IL) is composed of a series of
language instructions executed sequentially by the controller. Each instruction is composed of
a line number, an instruction code, and an operand.
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 list rung Displays parts of a List program that are not reversible to Ladder language.
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.
Memory Optional Backup Memory Cartridges that can be used to backup and restore an application
cartridge (program and configuration data). There are two sizes available: 32 and 64 Kb.
Memory usage A portion of the Status Bar in the TwidoSuite main window that displays a
indicator percentage of total controller memory used by an application. Provides a warning
when memory is low.
Modbus A master-slave communications protocol that allows one single master to request
responses from slaves.
Modular Type of Twido controller that offers flexible configuration with expansion capabilities.
controller 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.
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.
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.
Program errors Specialized TwidoSuite window used to view program errors and warnings.
viewer
Programmable A Twido controller. There are two types of controllers: Compact and Modular.
controller
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 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.
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.
RTU Remote Terminal Unit. A protocol using eight bits that is used for communicating
between a controller and a PC.
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.
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 table A table of the symbols used in an application. Displayed in the Symbol Editor.
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 Coils that are controlled directly by the very fast counter (%VFC) according to the
outputs 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.
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.
Very fast A function block that provides for faster counting than available with Counters and
counter: Fast Counters function blocks. A Very Fast Counter can count up to a rate of 20 KHz.
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.
J M
JMP, 498 MAX_ARR, 658
Jump Instructions, 498 MEAN, 667
Memory
32K cartridge, 59
K 64K cartridge, 61
key switch Structure, 54
input, 170 without cartridge, 57
Memory bits, 29
Memory words, 31
L message object
Labeling indexes, 327
Indexed, 50 summary, 327
Ladder diagrams MIN_ARR, 658
blocks, 396 Modbus
graphic elements, 399 communication, 71
introduction, 392 Communications, 116
OPEN and SHORT, 402 Configuring the port, 120
programming principles, 394 Hardware configuration, 116
Ladder List Rung, 410 master, 71
Ladder program slave, 71
reversing to List, 408 Software configuration, 119
Ladder rungs, 393 Standard requests, 135
LD, 443 modbus function code
LDF, 440, 443 read device identification, 143
LDN, 443 Modbus Link
LDR, 439, 443 Example 1, 127
Life guarding, 265 Example 2, 132
Life time, 265 Mode
LIFO Operational, 261
introduction, 508 pre-operational, 261
operation, 509 MPP, 423
Link elements MPS, 423
graphic elements, 399 MRD, 423
List instructions, 417 Multiply, 484
List Language
overview, 414
List Line Comments, 411 N
LKUP, 663 Network
LN, 631 Addressing, 44
LOG, 631 Node guarding, 265
logic instructions, 488 Non-reversible programming, 505
NOP, 497
NOP Instruction, 497
NOT instruction, 453
Numerical instructions P
Assignment, 477
Parameters, 460
shift, 489
Parentheses
Numerical processing
modifiers, 422
Overview, 476
nesting, 422
using in programs, 421
O passive analog input
Twido Extreme, 178
Object tables, 47
PG (parameter group), 311
Object validation, 28
PGN
Objects
request, 339
Bit objects, 29
PGN (parameter group number), 311
Double word, 34
Physical layer, 256
Floating point, 34
CAN bus line, 256
Function blocks, 45
PID
Structured, 47
Animation tab, 604
words, 31
AT tab, 595
OCCUR_ARR, 659
Configuration, 583
OPEN, 402
Debugging, 603
Open loop adjustment, 621
General tab, 584, 588
opening the %PLS configuration table
Input tab, 591
Twido Extreme, 200
Output tab, 600
opening the %PWM configuration table
Overview, 576
Twido Extreme, 207
PID tab, 593
Operands, 416
Trace tab, 606
operating modes
PID characteristics, 580
Twido Extreme, 217
PID tab
Operation blocks, 398
PID, 593
operation blocks
Pin outs
graphic element, 401
Communications cable female
Operator Display
connector, 75
Controller ID and states, 377
Communications cable male connector,
Overview, 374
75
Real-Time correction, 387
PLS
Serial port settings, 385
Twido Extreme, 194
System objects and variables, 379
PLS function block
Time of day clock, 386
Twido Extreme, 195
OR Instruction, 449
Potentiometer, 150
OUT_BLK, 409
Programming
Output tab
documenting your program, 411
PID, 600
Programming advice, 404
Overflow
Programming grid, 394
Index, 51
Programming languages
overflow, 486
overview, 23
Overview
Programming Principles, 505
PID, 576
U
Unconditional rungs, 410
W
Word Objects, 503
Word objects
Addressing, 39
Function blocks, 45
Overview, 31
X
XOR, 451
Index
09/2007