Siemens PLC Learning note Five-(programming language, data type)

Source: Internet
Author: User

1. Programming languages

PLC programming language has STL (statement table), LAD (Ladder diagram), FBD (function block diagram), graph (sequential function diagram), SCL (structured Control Language), Higraph (Graphics programming language), CFC (continuous function diagram) and so on. STL, LAD, FBD are basic programming languages in STEP7, and can be converted automatically in STEP7 software.

2. Data type

1) Basic Data type


2) Complex data types

Complex data types need to be pre-defined, and their variables can only be declared in global data blocks, as parameters or as local variables of logical blocks.

The types supported in STEP7 are: array, structure, string, date, time, user-defined type, function block type.

A. Arrays

The number of dimensions of an array is 1~6, which is 6-dimensional maximum. The following is how the 3-D array is defined:

A array[1..3,1..5,1..7] INT
A represents a 3*5*7 array of three-dimensional shapes that can be referenced by an array name and subscript to refer to an element in the array, such as a[2,3,4]

B. Structure

Example: Motor:struct

Speed:int

Current:real

End_struct

C. String

String strings are a one-dimensional array of up to 254 characters (CHAR), with a maximum length of 256 bytes (the first 2 bytes are information that stores the length of the string). such as ' I ' M is string '

D. Date and time

The date and time (Date_and_time) is used to store the year, month, day, hour, minute, second, millisecond, and week, accounting for 8 bytes, saved in BCD format. Week 1~7 represents Monday to Sunday

such as: dt#2014-09-28-10:28:33.300 September 28, 2014 10:28 33.3 seconds

E. Custom types

A custom type (UDT) represents a custom structure, is stored in a UDT block (udt1~udt65535), and is used as a data type "template" in another data type.

Example: The structure is stored in the UDT1, and the array ABC array[1..10] UDT1 can be defined in the database.

Several of the above complex types are defined in DB blocks such as:






Siemens PLC Learning note Five-(programming language, data type)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.