programming instructions (ld/fbd/sfc/st) - · pdf file6f8c1226 programming instructions...

570
6F8C1226 Programming Instructions (LD/FBD/SFC/ST) Unified Controller nv Series Integrated Controller v series

Upload: phungdien

Post on 07-Feb-2018

277 views

Category:

Documents


12 download

TRANSCRIPT

  • 6F8C1226

    Programming Instructions (LD/FBD/SFC/ST)

    Unified Controller

    nv SeriesIntegrated Controllervseries

    1226.2.0810

    Program

    ming Instructions (LD

    /FBD

    /SFC

    /ST)

    Unified

    Controller nv series &

    Integrated C

    ontroller V series

    10E_6F8C1226_Controller_V_series_1022_.indd 1 08.10.22 5:14:21 PM

  • Notice (1) Technical information in this document is described for the explanation of typical operation of

    the product and its application. It shall not be construed as the grant of intellectual property or other right of Toshiba or of other party, nor the consent to use the said right.

    (2) Duplication and reproduction of a part or whole of this document without approval of Toshiba is prohibited.

    (3) The contents of this document are subject to change without notice. (4) This document is prepared with the utmost attention. However, when any doubt, error or

    the matter to be changed is observed in the document, the customer is kindly requested to inform us of it.

    PROSEC, TOSLINE, TOSDIC and CIEMAC are the registered trade names of Toshiba. IBM is a registered trade name of International Business Machines Corporation. Microsoft and Windows are the registered trade name of Microsoft Corporation in the U.S.A. and in other countries. DeviceNet is a registered trade name of Open DeviceNet Vendor Association Inc.

    TOSHIBA CORPORATION 2008 All rights reserved

  • Introduction This manual describes the Ladder Diagram (LD), Function Block Diagram language (FBD), and Sequential Function Chart

    (SFC) instructions for TOSHIBA Integrated Controller V series. The L controller is divided into MCS type version and DS type version and each one is described as follows:

    Classification Series Name Description in this document model 2000 L2PU11, L2PU12 L2 MCS type model 3000 L3PU11 L3 model 2000 L2PU22 L2DS DS type model 3000 L3PU21 L3DS

  • 6F8C1226 1. General 1-1

    1 General

    This manual describes the usage of LD/FBD/SFC instructions and functions of TOSHIBA Integrated Controller V series and

    Unified Controller nv-series. This chapter explains the following items:

    1.1 What are LD, FBD, and SFC Languages? 1.2 Data

    1.2.1 Data Type 1.2.2 Data Structure 1.2.3 Real Number Format 1.2.4 Variables 1.2.5 Variable Memory Allocation Rules 1.2.6 Variable Declaration Examples 1.2.7 Reading and Writing Variable

    1.3 Program Structure 1.3.1 Task 1.3.2 POU (Program Organization Unit) 1.3.3 Program 1.3.4 Function

    1.3.4.1 What is Function? 1.3.4.2 Function Execution Control with EN /ENO 1.3.4.3 User Defined Function 1.3.4.4 Function/Function Block Restrictions

    1.3.5 Function Block 1.3.5.1 What is Function Block? 1.3.5.2 User Defined Function Block

    1.4 Index Registers 1.5 System Flags 1.6 Handling of Real Data 1.7 Instruction Behavior when Exceeding Data Boundary 1.8 Step Counting 1.9 How to Read Instruction Spec. 1.10 Instruction List

  • 6F8C1226 1. General 1-2

    1.1 What are LD, FBD, and SFC Languages?

    LD Language: Ladder Diagram is a graphic language for commonly used Boolean operation and is described using a combination of

    contacts and coils. The LD language can be treated in the same manner as electrical relay circuits and must be connected to the left and right power rails.

    Switch_1 Motor_On

    ADD_INT EN ENO

    Done

    Offset

    LD

    Value

    LD

    Value

    SET

    Switch_3

    Switch_2

    Switch_4

    Horizontal link

    Right power rail Left power rail

    Vertical link

    Note: The characters LD, ST and SET are displayed on the semi-graphic Program Editor, but not displayed on the full-graphic one.

    FBD Language:

    Function block diagram is a graphic language that expresses the flow of signals and data and is described using a combination of functions and function blocks.

    ADD_TIME

    Timer_1

    Switch2

    LD

    Switch1

    LD

    DelayTime

    LD

    AND_BOOL TON

    preset

    LD

    IN

    PT

    Q

    ETT_Value

    ST

    Start

    ST

    Note: The characters LD, ST and SET are displayed on the semi-graphic Program Editor, but not displayed on the full-graphic one.

  • 6F8C1226 1. General 1-3

    SFC Language: Sequential Function Chart is a graphic language suited for sequential control and consists of an SFC structure unit, which

    shows the control flow, action unit, which shows the action performed at each step, and transition condition unit, which shows the conditions for advancing through the steps.

    START

    T0

    S1 S1 S2 Action_1 N LED

    S3

    S1_ON S2_ON

    S3_ON

    T1

    T2

  • 6F8C1226 1. General 1-4

    1.2 Data 1.2.1 Data Type

    The following table shows the data types supported by the Unified Controller nv Series and Integrated Controller V Series and their data range.

    Notation Data type Bits Data range BOOL Boolean 1 0(FALSE), 1(TRUE) INT Integer 16 -32768 to 32767 DINT Double integer 32 -2147483648 to 2147483647 UINT Unsigned integer 16 0 to 65535

    REAL Real numbers 32 -3.4028231038 to -1.40129810-45 0 1.40129810-45 to 3.4028231038

    TIME Duration 32 -2147483648 to 2147483647ms (-596h31m23s648ms to 596h31m23s647ms )

    DATE D (abbreviation)

    Date 32 1998-01-01 to 2097-12-31 (*3)

    TIME_OF_DAY TOD (abbreviation)

    Time of day 32 00:00:00.000 to 23:59:59.999 (*3)

    DATE_AND_TIME DT (abbreviation)

    Date and time of day 64 0001-01-01-00:00:00.000 - 9999-12-31-23:59:59.999 (*3)

    STRING Fixed-length character string

    Maximum number of characters: 256 Character code system: shift JIS Possibility use only with the retained global variable (*2)

    WORD Bit string of length 16 16 0000 to FFFF DWORD Bit string of length 32 32 00000000 to FFFFFFFF PTR (*1) Word pointer PTRB (*1) Bit pointer

    (*1) The integrated controller supports this data type to enable flexible address handling and provide compatibility with programs on conventional machines.

    (*2) When using string definition instruction DEF_STRING, it may be used in variable scope without retain specification. Refer to the Define String instruction page for details.

    (*3) In the DATE, TIME_OF_DAY(TOD), and DATE_AND_TIME(DT) types, an asterisk (*) is displayed in the V engineering tool (program monitor, data value monitor) if data exceeding the range above is set. No setting is allowed from the V engineering tool (e.g. data value monitoring).

  • 6F8C1226 1. General 1-5

    To program constants in one of the data types, do the following: Specify the data type in #.

    # can be omitted in the types other than Duration, Date, and Time of day. Constants can be specified in binary (2#), decimal (default), octal (8#), or hexadecimal (16#).

    If a number is 16 in decimal, the value 2#10000 in binary specification, 8#20 in octal specification, and 16#10 in hexadecimal specification are all equal.

    Underscores ("_") can be inserted between numbers to make constants easy to read. 2#1_0000 in binary specification, 8#2_0 in octal specification, and 16#1_0 in hexadecimal specification are allowed.

    The following table shows examples of constant specification.

    Notation (DataType)

    Data Type DataType

    can be omitted?

    Example of constant specification

    BOOL Boolean Yes BOOL#0, BOOL#FALSE,0, FALSE BOOL#1, BOOL#TRUE, 1, TRUE

    INT Integer Yes INT#15, 15, INT#16#F DINT Double integer Yes DINT#15, 15, DINT#16#F UINT Unsigned integer Yes UINT#15, 15, UINT#16#F REAL Real numbers Yes REAL#15, 15, REAL#16#F, 15.0, 1.5E1

    TIME Duration No

    d=Dayh=Hourm=Minutes=Secondms=MillisecondA decimal point can be used in the last field. Each effective unit can overflow. can be specified in TIME# and T#. TIME#6d_10m, TIME#16d_5h_4m_3s_21ms T#6d_10m, T#12.34s

    DATE D(abbreviation)

    Date No DATE#2007-12-10, D#2007-12-10

    TIME_OF_DAY TOD(abbreviation)

    Time of day No TIME_OF_DAY#1:2:3.456, TOD#1:2:3

    WORD Bit string of length 16 Yes WORD#4660, 4660, WORD#16#1234, 16#12_34

    DWORD Bit string of length 32 Yes DWORD#305419896, 305419896 DWORD#16#1234_5678, 16#12345678

  • 6F8C1226 1. General 1-6

    1.2.2 Data Structure (1) Integer (INT)/Unsigned integer (UNIT)/Bit string of length 16 (WORD)

    data 15 0

    0

    (2)Double integer (DINT)/Real numbers (REAL)/Duration (TIME)/Time of day (TOD)/Bit string of length 32(DWORD)

    data (H)data (L)

    15 0 0 1

    (3)Date (DATE)

    year (INT) 15 0

    month day 0 1

    Example) 1999-10-11

    (4)Date and time of day (DT)

    year (INT)

    15 0

    month day 0 1

    time of day (H) time of day (L) 2

    3

    (5)Fixed-length character string (STRING)

    VARlength15 0

    1st string 2nd string

    0 1 2 3

    String length (n)

    3rd string 4th string 5th string 6th string 4

    An example of 6 character data is show at left.

    Variables:

    Variable Data type Dec. SAMPLE STRING[6] VAR

    (6)Derived data type Array data (ARRAY)

    data [0]

    15 0

    data [1]data [2]

    data [n-1]

    2

    n-1

    0 1

    An example of 16 bit data is show at left. A 32 bit data is stored every 4 bytes as (2) and (3). Variables:

    Variable Data type Dec. data ARRAY [0..n-1] OF INT VAR

  • 6F8C1226 1. General 1-7

    (7)Derived data type Structure (STRUCT)

    data (INT)15 0

    0 1

    data1 (DINT H) data1 (DINT L) 2

    3

    bit0 bit1

    An example of INT+BOO