pcworx detail

182
Welcome to PHOENIX CONTACT PCWorx

Upload: huyenthaigia

Post on 28-Dec-2015

280 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: PCWorx Detail

Welcome to PHOENIX CONTACT

PCWorx

Page 2: PCWorx Detail

Welcome to PHOENIX CONTACT

Software Architecture

Chapter 1Chapter 1Workspaces

Page 3: PCWorx Detail

Workspaces

Process dataassignmentassignment

IECiBus

configuration

programming

Projectcomparisoncomparison

Page 4: PCWorx Detail

Bus StructureWorkspaceWorkspace

Page 5: PCWorx Detail

Process Data Assignment WorkspaceAssignment Workspace

Page 6: PCWorx Detail

Project ComparisonWorkspaceWorkspace

Page 7: PCWorx Detail

IEC ProgrammingWorkspaceWorkspace

Page 8: PCWorx Detail

Connected Bus

Page 9: PCWorx Detail

Device Catalog

Page 10: PCWorx Detail

Excel Link

Page 11: PCWorx Detail

Diag+ 2.0

Page 12: PCWorx Detail

Welcome to PHOENIX CONTACT

Hardware Architecture

Chapter 2Chapter 2

Page 13: PCWorx Detail

Overview

Page 14: PCWorx Detail

Multitasking

Page 15: PCWorx Detail

Welcome to PHOENIX CONTACT

Communication PC - Control System

Chapter 3Chapter 3

Page 16: PCWorx Detail

Welcome to PHOENIX CONTACT

Communication PC - Control System

Chapter 3Chapter 3

Page 17: PCWorx Detail

Welcome to PHOENIX CONTACT

Communication Paths

Page 18: PCWorx Detail

SerialInterfaceInterface

Page 19: PCWorx Detail

TCP/IP

Page 20: PCWorx Detail

Welcome to PHOENIX CONTACT

Control System yNetwork Settings

Page 21: PCWorx Detail

Setting the IP Adress/Real-Time Clock on the Control SystemReal Time Clock on the Control System

ValidationValidationthrough

reset

Page 22: PCWorx Detail

Assigning the IP Address via BootP

BootP service(default upon

delivery)

Page 23: PCWorx Detail

Entering the MAC AddressActivating the BootP ServerActivating the BootP Server

See addresssticker

Page 24: PCWorx Detail

Welcome to PHOENIX CONTACT

Network Communication

Page 25: PCWorx Detail

Selecting the Network ConnectionNetwork Connection

Manualinput of anIP address

Connection via station

name

Page 26: PCWorx Detail

Editing theStation NamesStation Names

Page 27: PCWorx Detail

Welcome to PHOENIX CONTACT

IBS Configuration

Chapter 4Chapter 4

Page 28: PCWorx Detail

Welcome to PHOENIX CONTACT

Online Configuration

Page 29: PCWorx Detail

Read-In of the ConnectedBus SystemBus System

Page 30: PCWorx Detail

Inserting the DetectedDevicesDevices

Page 31: PCWorx Detail

Welcome to PHOENIX CONTACT

Offline Configuration

Page 32: PCWorx Detail

Insert Devices From Device CatalogFrom Device Catalog

Insert to same level

Insertto branch

Page 33: PCWorx Detail

Device ReplacementUsing the Device CatalogUsing the Device Catalog

Device replacemen

t

Page 34: PCWorx Detail

Welcome to PHOENIX CONTACT

Device Catalog and gDevice Files

Page 35: PCWorx Detail

Display

Page 36: PCWorx Detail

User-DefinedDevice CatalogDevice Catalog

Page 37: PCWorx Detail

Registration of Device Files(Import)(Import)

NEW

XML ICOXML

Page 38: PCWorx Detail

Welcome to PHOENIX CONTACT

PN Configuration

Chapter 5Chapter 5

Page 39: PCWorx Detail

Welcome to PHOENIX CONTACT

Basic Settingsg

Page 40: PCWorx Detail

Setting the Address Area

First IP addressLast IP addressSubnetmask

192.168.0.2192.168.0.254255.255.255.0

Page 41: PCWorx Detail

Importing Addresses

Page 42: PCWorx Detail

Direct IP Address Assignment

192.168.0.2

Page 43: PCWorx Detail

Welcome to PHOENIX CONTACT

Online/Offline Configuration

Page 44: PCWorx Detail

Offline Configuration

Page 45: PCWorx Detail

Online Configuration

Page 46: PCWorx Detail

Show Reachable Devices

Page 47: PCWorx Detail

Inserting Devices into the Project

Page 48: PCWorx Detail

Welcome to PHOENIX CONTACT

Device Settingsg

Page 49: PCWorx Detail

Transmission Intervals

Page 50: PCWorx Detail

Device Names

Page 51: PCWorx Detail

PROFINET Devices in the Network

Page 52: PCWorx Detail

PROFINET Device Naming

Page 53: PCWorx Detail

Welcome to PHOENIX CONTACT

Process Data as Variables

Chapter 6Chapter 6

Page 54: PCWorx Detail

Process Data Assignment WorkspaceAssignment Workspace

PLC address area

Modules ≈ Process d t it f th bdata items of the bus

Page 55: PCWorx Detail

1. Creating Process Data Variables

Page 56: PCWorx Detail

2. Connecting Process DataItems with Global VariablesItems with Global Variables

via Drag & Dropvia Drag & Drop

via context menu

Page 57: PCWorx Detail

Global Variableswith Process Data Connectionwith Process Data Connection

C tConnecteddd

CreatedCreated automatically

Page 58: PCWorx Detail

Welcome to PHOENIX CONTACT

Data Management

Chapter 9Chapter 9

Page 59: PCWorx Detail

Principle of Variable DeclarationDefinition of the identifier: Character set for symbols

Assigning a data type: IEC 61131 data types

Use of variables: keywords

Variable address: Data management

Pre-initializing the variable: SyntaxPre initializing the variable: Syntax

Page 60: PCWorx Detail

Welcome to PHOENIX CONTACT

Elementary Data yTypes in IEC 61131

Page 61: PCWorx Detail

Hierarchy of Data Types

ANY_DATE STRING

ELEMENTARYANY_NUM TIMEANY_BIT

REAL

ANY_REAL BOOL

BYTE

WORD

TIME_OF_DAY

DATE

DATE AND TIME

TIME STRING

LREAL

SINT

ANY_INT

WORD

DWORD

LWORD

DATE_AND_TIME

SINT

INT

DINT

USINT

UINT

LINT

UDINT

ULINT

Page 62: PCWorx Detail

Welcome to PHOENIX CONTACT

Constants - Literals

Page 63: PCWorx Detail

Syntax of Constants

<Data type>#<Basis>#<Constant value><Unit>

BYTE#2#0011_1001 Constant of the01

Tetradseparator

type BYTE inbinary

representation

Page 64: PCWorx Detail

Example for the Representationof Constantsof Constants

12 0 12 456 986I t t t #12456 -12 0 12_456 +986Integer constants

-12.0 0.0 0.456 +2.635e-12Real constants

Int#12456

Real#1.6e3

Word#12094Word constants Word#16#2F3

EWord#2#0010_1111_0011_11

10also

BYTE and DWORD

Bool constants Bool#1

Time#1 64 t#2d 14h 3 5

Bool#0 True False

Time constants Time#1.64s

t#2d_14h_3.5s

String constants String#‘Break?‘ ‘Right now, please!‘

Page 65: PCWorx Detail

Welcome to PHOENIX CONTACT

Use of Variables

Page 66: PCWorx Detail

Local Data

Page 67: PCWorx Detail

Global Data

Page 68: PCWorx Detail

Global VariablesLocal VariablesLocal Variables

POUvariable tables

Globalvariable tables

Localvariables

Interfacevariables

Globalvariables

Programinstance Project

- - - -VAR VAR_EXTERNAL_PG

VAR_EXTERNAL VAR_GLOBAL

VAR_GLOBAL_PG

VAR_INPUTVAR_OUTPUT VAR_EXTERNAL VAR_GLOBALVARVAR_IN_OUT

VAR_INPUT - - - -VAR

Page 69: PCWorx Detail

Overview ofUse of VariablesUse of Variables

Program Functionblock

Functionblock

Globallyusedvariables

VAR_EXTERNALVAR_EXTERNAL_PG

VAR_EXTERNALVAR_EXTERNAL_PGVAR EXTERNAL FB

Localinterface

_ _

VAR_INPUTVAR OUTPUT

VAR_INPUT(o tp t declaredinterface

variables

Local

VAR_OUTPUTVAR_IN_OUT

(output declaredseparately)

VARVAR VARvariables VARVAR VAR

Page 70: PCWorx Detail

Graphical Overview ofUse of VariablesUse of Variables

Program

FunctionBlock

GlobVarVAR INPUT

VAR_OUTPUT

LocVar

VARLocVar

InVar OutVar

_

LocVar

VAR_EXTERNA

Function

GlobVar

LLocVar

InVar

Page 71: PCWorx Detail

Welcome to PHOENIX CONTACT

Managing Variablesg g

Page 72: PCWorx Detail

Variable GroupsStandard

group

Edited:Groups forfunctionblocks

Edited:Groups forfunctionsfunctions

Edited:Groups forprograms

Page 73: PCWorx Detail

Variable DialogAccess to local variable table Access to global

variable tableLocal variable table

Global variable table

Page 74: PCWorx Detail

Welcome to PHOENIX CONTACT

Programming languages according to IEC 61131 3IEC 61131-3

Chapter 10Chapter 10

Page 75: PCWorx Detail

The IEC 61131-3 LanguagesInstruction list Structured Text

Function block diagramFunction block diagramSequential functional chart

Ladder diagram

Page 76: PCWorx Detail

Function Block Diagram (FBD)

• Graphical language, widely used in Europe• Programming elements in form of function blocksg g• Function blocks can be "wired" similarly as in a circuit diagram• Used in a variety of applications responsible for the flow of

information between control system components.

BC

ANDAB

Page 77: PCWorx Detail

Ladder Diagram (LD)

• Standardized limited set of programming• Standardized, limited set of programmingsymbols for relay control systems

• Based on the North-American programming style, similarto the US standard for drawing circuit diagramsto the US standard for drawing circuit diagrams

A B C--| |----| / |--------------( )--

Page 78: PCWorx Detail

Instruction List (IL)

• Assembler model using one accumulator• Assembler model, using one accumulator• Per line one command is allowed,

e.g. saving a value in the accumulator

LD A

ANDN B

ST C

Page 79: PCWorx Detail

Structured Text (ST)

• High level language structured through subprograms• High-level language, structured through subprograms • Syntax similar to PASCAL• Complex and nested instructions

C := A AND NOT B;

Page 80: PCWorx Detail

Sequential Function Chart (SFC)

Step 1

• Powerful, graphical programming language for describing the sequence b h i f t l Action 1Step 1behavior of control programs.

• Used for structuring control problems Transition 1

Action 1

Step 2 Action 2• Clearly arranged programming

language, allows for quick diagnostics

Step 2

Transition 2

Action 2

Step 3• Bacic elements: Steps with action

blocks and transitions

Step 3

• Supports alternative and parallel sequences

Page 81: PCWorx Detail

Welcome to PHOENIX CONTACT

Programming in PC WORX

Chapter 11Chapter 11

Page 82: PCWorx Detail

Welcome to PHOENIX CONTACT

Program gOrganization Units

Page 83: PCWorx Detail

Inserting POUs

Project tree – ViewPOUs

Insertingposition inproject tree

Onlyavailable foravailable for

functions

Page 84: PCWorx Detail

POU Properties

Page 85: PCWorx Detail

POU Groups

Page 86: PCWorx Detail

Welcome to PHOENIX CONTACT

Standard Functions

Page 87: PCWorx Detail

Standard Functions 1

…_TO_... ANYANYData type conversion

F ti ithABS … SQRT

ADD

ANY_REAL

ANY_NUM

ANY_REAL

ANY_NUM

Functions with a numercal variable

St d d ith ti ADD…

EXPT….

ANY_NUM

Standard arithmeticfunctions

SHL…

ROL

ANY_BIT

ANY_INT

ANY_BITStandard bit shiftfunctions

AND…

XOR

ANY_BITANY_BIT

….

ANY_BIT

Bit-wise booleanfunctions

Page 88: PCWorx Detail

Standard Functions 2

Selection functionsSEL…

ANYBOOL/ANY

….Selection functionsMUX

ANY

BOOLANY

Comparison functionsGT…NE

….

ANY

LEN…

FIND

ANY_BIT

ANY_INT

ANY_BITString functions

LEFT…

INSERT

ANY_DATE

ANY_DATE/ANY_INT

ANY_DATEString functions

Page 89: PCWorx Detail

Welcome to PHOENIX CONTACT

Standard Function Blocks

Page 90: PCWorx Detail

Standard Function Blocks 1

Fallingedge

Risingedge

Edge evaluationEdge evaluation

Bistable blocksBistable blocks (flipflops)

Primaryreset

Primarysetting

Page 91: PCWorx Detail

Standard Function Blocks 2Counter countingup/down

Counter counting

down

Counter counting

up

Counter

Timers

Impulse Switch off Switch onImpulse encoder

Switch-offdelay

Switch-ondelay

Page 92: PCWorx Detail

Welcome to PHOENIX CONTACT

FBD - Function Block Diagramm

Chapter 12Chapter 12

Page 93: PCWorx Detail

Language Elements of Function Block DiagramFunction Block Diagram

FB callFB callFU call

FeedbackGreen:ProjectFB/FU

NegatioNegation

Blue:Library

DiagramDiagramin

FB/FUFB/FU FB/FUExecution

order

Red:Firmware FB/FUFirmware FB/FU

of IECYellow:FB/FU not

found

Page 94: PCWorx Detail

Accessing Variables

F5Insertmark

Markedparameter

Page 95: PCWorx Detail

Accessing Functions

Page 96: PCWorx Detail

Accessing Function Blocks

Insertmark

Page 97: PCWorx Detail

Editing Blocks

3

21

4

Page 98: PCWorx Detail

Welcome to PHOENIX CONTACT

IL - Instruction List

Chapter 14Chapter 14

Page 99: PCWorx Detail

Language Elementsin Instruction Listin Instruction List

Ld I xInput1Ld I_xInput1AndN I_xInput2Not St Q_xAccess1 Ld xPulse

St CTU_Access.CULd iM i l

Assignmentsand operators

Ld iMinLimit iBasis, iMaxSt iCorrected

Ld iMaximumvalueSt CTU_Access.PVLd xStopSt CTU_Access.RESET

FU callsand arguments FB calls

d t

Ld I_xInput1JmpC JumpFlag

Cal CTU_Access

Ld CTU_Access.QVSt iDisplayLd CTU Access Q

and arguments

J pC Ju p ag…RetJumpFlag:Ld I_xInput2St Q A 1

Ld CTU_Access.QSt xFullConditional

processing

St Q_xAccess1

Page 100: PCWorx Detail

Assignment and Operators

Ld I I t1Loading an operand

Accumulator content

Ld I_xInput1

AndN I_xInput2

Loading an operandinto the accumulator

Linking the accumulator contentto the operand

E1

E1 * E2_

Or I_xInput3

pE1 * E2

E1 * E2 + E3

Linking the accumulator contentto the operand

St Q_xOutput1E1 * E2 + E3

Saving the accumulator contenton the target operand

Page 101: PCWorx Detail

Operators in Instruction List

LD

ANY ANY_NUM ANY_BIT

LDST

Load

SaveANDORXOR

And

Or

Exclusive Or

ADDSUBMUL

Addition

Subtraction

Multiplication

GT Greater than

XORNOT

Exclusive Or

Complement

MULDIV

Multiplication

DivisionANY_NUM and ANY_BIT

GEEQNE

Greater or equal

Equal

Not equal S SetJMPRET

JumpBOOL

NELELT

Not equal

Less or equal

Less than

SR Reset

RETCAL)

Return

FB call

Page 102: PCWorx Detail

Modifying the Operators

LdN I xInput1 E1 * E2 = E1 + E2LdN I_xInput1AndN I_xInput2And( I_xInput3NotOr I_xInput4)St Q_xOutput1

Page 103: PCWorx Detail

Function Calls

1. Operand explicitely loaded

Ld iMinLimit iQuantity, iMaxSt iCorrectionSt iCorrection

Ld wMinWord_To_Int

accumulator

1. Operand from the

accumulator_ _

Limit iQuantity, iMaxSt iCorrection

Page 104: PCWorx Detail

Editing in PC WORXInserting via the edit wizard

Comments asdummies

LD (* IN as ANY_BIT *)ROR (* N as ANY_INT *)ST (* Result as ANY BIT *) P tST (* Result as ANY_BIT *)

y

Parameter name and

data typeAfter editing by user

Ld wRawsizeRoR INT#8RoR INT#8St wRotates

Page 105: PCWorx Detail

Function Block Calls

Ld I_xInput1 Data import_St TON_Signal.INLd tDelayLd tDelaySt TON_Signal.PT

Calculation

Cal TON_Signal

Ld TON_Signal.QSt Q_xOutput1Ld

Data export

Ld TON_Signal.ETSt tSequence

Page 106: PCWorx Detail

Editing in PC WORXInserting

via theedit

wizarda dDeclaration

dialog

LD xActivate

After editing

LD (* BOOL *)ST TON_1.INLD (* TIME *)ST TON_1.PT

LD xActivateST TON_1.INLD TIME#250msST TON_1.PT

by the user

_CAL TON_1LD TON_1.QST (* BOOL *)LD TON_1.ET

CAL TON_1

LD TON_1.QST xDelayed_

ST (* TIME *)ST xDelayedLD TON_1.ETST tSequence

Page 107: PCWorx Detail

Conditional Code ExecutionJMP | RETJ |

Ld iRawsize

Skip markerGT iMaxJmpC TooGreatLd iRawsize

Conditional jump

Ld iRawsizeLT iMinJmpC TooSmallR t

Skip markerAbsolutefunction block Ret

TooGreat: Ld iMax

end

St iRawsizeRet

TooSmall: Ld iMinTooSmall: Ld iMinSt iRawsize

Page 108: PCWorx Detail

Welcome to PHOENIX CONTACT

LD - Ladder Diagram

Chapter 15Chapter 15

Page 109: PCWorx Detail

Welcome to PHOENIX CONTACT

Basic Elements

Page 110: PCWorx Detail

Editing in Ladder Diagram

s

Insert element

s

Switch-through options

Contact options

Coil optionsCoil options

Page 111: PCWorx Detail

Contact / Coil Dialog

Additional

g

Additional options

compared tovariable dialog

Page 112: PCWorx Detail

Functions and Function Blocksin Ladder Diagramin Ladder Diagram

FunctionFunctionsVariables blocksFunctionsVariables

Page 113: PCWorx Detail

Formatting the Ladder Diagram

Arrange leftpower rails

Arrange power railspower rails rails

Page 114: PCWorx Detail

Welcome to PHOENIX CONTACT

SFC - Sequential Function Chart

Chapter 16Chapter 16

Page 115: PCWorx Detail

Welcome to PHOENIX CONTACT

Basic Structure of the Sequential Function Chart

Page 116: PCWorx Detail

Sequential Function Chart POU in the Project Treein the Project Tree

POU

Transitionfolder

POUbase element

Action

Transition

in ILActionfolder

Transition

in LD

Action in FBD

Page 117: PCWorx Detail

Basic StructureInserting the

basic structure/

further steps

Step

Feedback

Action block

Transition

Page 118: PCWorx Detail

Welcome to PHOENIX CONTACT

Basic Elements

Page 119: PCWorx Detail

The Step

Standard step

Step flag

End stepJumpInitial step

Page 120: PCWorx Detail

The TransitionDirect Connection

Elements fromLD and FBD

Transition asdirect connectiondirect connection

Page 121: PCWorx Detail

The TransitionTransition detail

TransitionTransition as detail

Transition name as variable name

Page 122: PCWorx Detail

The Action Block

Inserting/AddingInserting/Addingan action block

Action blockas action detail

Action blockas booleanparameter

Actionqualifier

Page 123: PCWorx Detail

Action Variable

Page 124: PCWorx Detail

Action Detail

Page 125: PCWorx Detail

Branches

Parellel/simultaneousParellel/simultaneous AlternativeParellel/simultaneousParellel/simultaneousbranch

Alternativebranch

Page 126: PCWorx Detail

Inserting Branches Later On

1

2

3 4

Page 127: PCWorx Detail

Welcome to PHOENIX CONTACT

User-Defined Data Types

Chapter 17Chapter 17

Page 128: PCWorx Detail

Worksheets forUser-Defined Data TypesUser Defined Data Types

Page 129: PCWorx Detail

Welcome to PHOENIX CONTACT

Fields

Page 130: PCWorx Detail

Principle

WORDWORD

WORD

AR_1_4_WWORD

WORD

Name exampleName example

AR_<LowerBound>_<UpperBound>_<BasicType>

Page 131: PCWorx Detail

Declaration

TYPE(*Typename*) : ARRAY [(*From..To*)] OF

(*Typename*);END_TYPE

After editing by the user

T

One-dimensional array Type

AR_1_4_W : Array [1..4] Of Word;

AR 1 8 1 4 W : Array [1 8] Of AR 1 4 W;

array

T di i l

basedon

AR_1_8_1_4_W : Array [1..8] Of AR_1_4_W;End_TypeTwo-dimensional

array

Page 132: PCWorx Detail

Use in Programming

Assigning two array variablesof the same dimensions

arVariable1 := arVariable2;

A i i i l lAssigning a single valueto an element of an

array variable using a constant

Assigning a single valueAssigning a single valueto an element of an

array varable using an index variableLd wVariableSt arVariable[iIndex]

Page 133: PCWorx Detail

Welcome to PHOENIX CONTACT

Structures

Page 134: PCWorx Detail

Principle

REALREAL

INT

ST_PumpINT

BOOL

Name exampleName example

ST_<Function>

Page 135: PCWorx Detail

Declaration

TYPE(*Typename*) :STRUCT

(*Element 1 Name*) : (*DATATYPE*);(*Element 2 Name*) : (*DATATYPE*);(*Element 3 Name*) : (*DATATYPE*);(* . : . *);(* . : . *);(*El t N *) (*DATATYPE*)(*Element n Name*) : (*DATATYPE*);

END_STRUCT; END_TYPE

After editing by the user

TypeTypeST_Pump : Struct

rEngineCurrent : Real;iFlow : Int;iMediaTemperature : Int;xBroken : Bool;

End_Struct; End_Type

Page 136: PCWorx Detail

Use in Programming

Assigning two structure variablesof the same dimensionstP 12 tP 13stPump12 := stPump13;

Assigning a single valueto an element of a structure

variable using named parameters

Page 137: PCWorx Detail

Welcome to PHOENIX CONTACT

Combined User-Defined Data Types

Page 138: PCWorx Detail

Declaration and Use

TypeST_Pump : Struct

rMotorCurrent : Real;Structure iFlow : Int;iMedTemperature : Int;xBroken : Bool;

End_Struct;

Structuredeclaration

_

AR_1_20_Pump : Array [1..20] Of ST_Pump;End_Type

Arraydeclaration

Page 139: PCWorx Detail

Use in Programming

array variables of the same dimensionAssigning two complex

array variables of the same dimension

A i i t t i blAssigning a structure variableto an array element of a complex array variable

Assigning a single value

arPumppark[12] := stPump12;

Assigning a single valueto an element of a

complex array variableLd iFlow_Pump12_St arPumppark[12].iFlow

Page 140: PCWorx Detail

Welcome to PHOENIX CONTACT

ST - Structured Text

Chapter 18Chapter 18

Page 141: PCWorx Detail

Language Elementsof Structured Textof Structured Text

Q_xAccess1 := False;Q xAccess2 := I xInput2 & Not I xInput4;Assignments, operators Q_ _ p _ p ;

If I_xInput1 & I_xInput2 ThenQ_xAccess1 := True;

ElsIf I_xAccess2 & I_xAccess3 ThenQ xAccess2 : True;

RequestsQ_xAccess2 := True;

End_If;

iCorrected := Limit(iMin, iBasis, iMax);FU calls and arguments

CTU_Access(CU := xPulse,PV := iMaxvalue,RESET := xStop);

iDisplay := CTU Access QV;

FB calls and arguments

iDisplay := CTU_Access.QV;xFull := CTU_Access.Q;

RepeatiLoop := iLoop + 1;

Loops Until iLoop = 100End_Repeat;

Loops

Page 142: PCWorx Detail

Assignments and OperatorsAssignment

operator

Q xOutput1 := I xInput1 & Not I xInput2

1122

Q_ p _ p _ pOr I_xInput3;

Assignment directionAssignment direction

11 22

Assignment direction

11 22

Calculation11

22 Assignment

Page 143: PCWorx Detail

Operator HierarchyOperation

Function(Arguments)

(Expression)

Function evaluation

Brackets

SymbolANY

*

Data typegroup

Function(Arguments)Function evaluation

iNumber1 ** iNumber2Potentialization

NegationComplement

-iNumberNOT wCode

NUM

BIT

*

MultiplicationDivisionModulo

iNumber1 * iNumber2rNumber1 / rNumber2

iNumber1 MOD iNumber2

Addition iNumber1 + iNumber2rity NUM

*

**

AdditionSubtraction

iNumber1 + iNumber2rNumber1 - rNumber2

Comparison diA > diB wC < wD iE >= iF

Equality iNumber1 = iNumber2b 1 b 2

Prio

iG <= iH

ANY

*

**Inequality rNumber1 <> rNumber2

xVar1 XOR xVar2Boolean exclusive OR

Boolean AND xVar1 & xVar2wCode1 AND wCode2

BIT

*

bVar1 OR bVar2

a O a

Boolean OR

Boolean exclusive OR

Page 144: PCWorx Detail

Function Calls

iCorrection := Limit(iMin,iMeasuredvalue,iMax);

Functionname

Functionarguments

iCorrection := Limit(iMin,Word To Int(wRawsize),Word_To_Int(wRawsize),iMax);

Return value of 1st function as argument for 2nd function

Page 145: PCWorx Detail

Editing in PC WORXInserting via the edit wizard

Parameter name Comments as

data typeand

data type

Comments asdummies

(* Result as ANY_BIT *) := ROR((* IN as ANY_BIT *),(* N as ANY_INT *));

After editing by the user

wRotates := RoR(wRawsize, INT#8);

Page 146: PCWorx Detail

Function Block Calls

TON_Signal(IN := I_xInput,PT := tDelay);

Data importand calculation

Q_xOutput := TON_Signal.Q;tSequence := TON Signal ET;

Data export

tSequence : TON_Signal.ET;

Alternativecall

TON_Signal.IN := I_xInput,;TON Signal.PT := tDelay;_ g y

TON_Signal();

Q xOutput := TON Signal.Q;Q_ p _ g QtSequence := TON_Signal.ET;

Page 147: PCWorx Detail

Editing in PC WORXInserting

via theedit

wizardD l tiDeclaration

dialog

TON_1(IN:=(* BOOL *), IN:=(* TIME *));(* BOOL *):=TON 1 Q;

Data type only

( BOOL ):=TON_1.Q;(* TIME *):=TON_1.ET;

Comments as dummies

After editing by the user

TON_1(IN := xActivate,PT := TIME#250ms);

xDelayed := TON_1.Q;tSequence := TON_1.ET;

Page 148: PCWorx Detail

FU Call and FB Call in Comparison

Assignment viafunction

Assignmentvia order

iCorrection := Limit(iMin,iMeasuredvalue,FUiMax);

TON Signal(IN := I xInput,TON_Signal(IN : I_xInput,PT := tDelay);

Q_xOutput := TON_Signal.Q;tS TON Si l ET

FB

A i t itSequence := TON_Signal.ET;

Assignment via

Assignment via named formal

parameters

Assignment viaoutput Parameters

Page 149: PCWorx Detail

Welcome to PHOENIX CONTACT

High-Level gLanguage Elements 1Th R tThe Requests

Page 150: PCWorx Detail

IfOpeningkeyword

If (* Boolean condition *) Then

(* Instructions *)

End If;End_If;

Closing

Instructions are only processed by the control

t if diti i tClosingkeyword

system if condition is met

Page 151: PCWorx Detail

If Extensions

If I_xSensor1 & Not I_xSensor2 Then _ _(* Instructions 1 *)

ElsIf I_xSensor2 & Not I_xSensor1Then

Repeatedlyoptional

Then (* Instructions 2 *)

ElseIf iM d l < 100 Th

One-time

optionalIf iMeasuredvalue < 100 Then

(* Instructions 3 *)ElsIf iMeasuredvalue > 100 Then

Nestedcondition

(* Instructions 4 *)End_If;

End If;End_If;

Page 152: PCWorx Detail

If Conditions

If I_xInput1 Then (* I t ti 1 *)

Implicit request f i bl (* Instructions 1 *)

ElsIf iMeasuring >=

of a variable

Boolean result iLimitedvalue Then

(* Instructions 2 *)after operation

Boolean

ElsIf Byte_To_Bool(I_bSensor)Then

(* I t ti 3 *)

return value of a function

(* Instructions 3 *)

Else

Unconditioned

(* Instructions 4 *)

End If;

Page 153: PCWorx Detail

CaseUse for Process Values

Integer operand

Case iProcesssize Of 7 : (* Instructions 1 *)

-2..1 : (* Instructions 2 *)

2, 4 : (* Instructions 3 *)"Case definitions"

8..16, 20..30 : (* Instructions 4 *)

Else(* Instructions 5 *)

End Case;

One-time

optional End_Case;optional

Page 154: PCWorx Detail

CaseUse for Control Values

Case iProcessstep Of 0 : (* Initialize *)( )

If xInit_completed Then iProcessstep := 10;End_If;

10 : (* Execute Prozess 1 *)10 : (* Execute Prozess 1 *)If xProcess1_completed Then iProcessstep := 20;End_If;

20 : (* Execute Prozess 2 *)If xProcess2_completed Then iProcessstep := 30;End_If;

(* etc. *)

500 : (* Exceptionalhandling *)iProcessstep := 0;

End_Case;

Page 155: PCWorx Detail

Welcome to PHOENIX CONTACT

High-Level gLanguage Elements 2Th LThe Loops

Page 156: PCWorx Detail

For

Loop variable

Startvalue

Endvalue

Width of stepoptional

For iIndex := 1 To 20 By 1 Do

(* The following instructions are executed with

1

*)(* the values 1 to 20 for the variable iIndex

*)

If arrMachine[iIndex].iTemp >= iLimitvalue ThenarrMachine[iIndex].iBroken := True;xAlarm := True;Exit;

End_If;

End For;

20

Early abortion of

loop executiond_ o ;

Page 157: PCWorx Detail

Repeat | While

Head-controlled

“Repeat … until …”

Repeat iIndex := iIndex +

10;

0

While

controlled

;

UntiliIndex >= iLimit

eiIndex >= iLimit

DoiI d iI d +

End_Repeat;?

Foot-controlled

iIndex := iIndex + 10;

End While;controlled

_

“As long as …, do …”

Page 158: PCWorx Detail

Welcome to PHOENIX CONTACT

Project Management

Appendix A1Appendix A1

Page 159: PCWorx Detail

Welcome to PHOENIX CONTACT

Project Filesj

Page 160: PCWorx Detail

Saving... / ArchivingSave as ... Archiving

Page 161: PCWorx Detail

Welcome to PHOENIX CONTACT

CPU Control Dialogg

Page 162: PCWorx Detail

CPU Selection

Page 163: PCWorx Detail

Temporary Project - Bootproject

Page 164: PCWorx Detail

Welcome to PHOENIX CONTACT

Project Codesj

Page 165: PCWorx Detail

Memory Concept

Download bootproject

Download project

Reset

Archiving project via

FTP server

Compiledmachine code

Decodablesource code

Page 166: PCWorx Detail

Standard Archive

ZipFile.zwt

Page 167: PCWorx Detail

Welcome to PHOENIX CONTACT

Libraries

Appendix A2Appendix A2

Page 168: PCWorx Detail

Library Directory

Page 169: PCWorx Detail

Welcome to PHOENIX CONTACT

Creating Librariesg

Page 170: PCWorx Detail

Saving

Page 171: PCWorx Detail

Removal and Compilation

Page 172: PCWorx Detail

Welcome to PHOENIX CONTACT

Using Librariesg

Page 173: PCWorx Detail

Including User Libraries

Page 174: PCWorx Detail

Including Firmware Libraries

Page 175: PCWorx Detail

The Library in a User Project

Page 176: PCWorx Detail

Using Projects With LibrariesWith Libraries

Uncompiled library

Page 177: PCWorx Detail

Help on Firmware Libraries

Page 178: PCWorx Detail

Welcome to PHOENIX CONTACT

Testing & Debugging

Appendix A3Appendix A3

Page 179: PCWorx Detail

Status in Worksheets

Page 180: PCWorx Detail

Overwriting/Forcing

Page 181: PCWorx Detail

Powerflow (via Address Status)

Graphicpowerflow

Textualpowerflow

Page 182: PCWorx Detail

Information on Mouse PointerTooltipsTooltips