老外写的ST语言教程_很详细

上传人:l**** 文档编号:121769499 上传时间:2020-02-25 格式:PPT 页数:54 大小:3.37MB
返回 下载 相关 举报
老外写的ST语言教程_很详细_第1页
第1页 / 共54页
老外写的ST语言教程_很详细_第2页
第2页 / 共54页
老外写的ST语言教程_很详细_第3页
第3页 / 共54页
老外写的ST语言教程_很详细_第4页
第4页 / 共54页
老外写的ST语言教程_很详细_第5页
第5页 / 共54页
点击查看更多>>
资源描述

《老外写的ST语言教程_很详细》由会员分享,可在线阅读,更多相关《老外写的ST语言教程_很详细(54页珍藏版)》请在金锄头文库上搜索。

1、1 ST Language Basic Course 2 ST Language Key word If there is any unclear or uncorrected please feel free to speak out Basic Course 3 Requirements Hardware The programming language ST is only available for following programmable controllers pCO3 Supernode pCO5 pCO compact BIOS To support ST language

2、 bios version must greater than 5 0 Software Use a version of 1tool 2 1 x pCO3 pCO5 Supernode 4 Creation of a solution ST Language Choosing FBD the application will be mixed it will consist of a main with Atoms Macroblocks but you can use routines functions and function blocks written in the ST ST t

3、he application will be developed entirely using ST language 5 Basic concepts When programming in ST the application can be organised using three fundamental programming elements generically called Program Organization Units POU PROGRAM FUNCTION FUNCTION BLOCK POU typeKeywordDescription ProgramPROGRA

4、M main END PROGRAM Main program that includes read write I O definition of local variables calls to Functions or Function Blocks FunctionFUNCTION END FUNCTION ST statements block with input variables local variables and if specified a return value This can be called at different points of the progra

5、m Recursion is not allowed Function block FUNCTION BLOCK END FUNCTION BLOCK ST statements block with input variables local variables and output variables This can be called at different points of the program Recursion is not allowed POU Note we can define more functions and function blocks but only

6、one program main 6 The basic types KeywordData typeLower limitUpper limitMemory Space BOOLBooleanFALSE 0 TRUE 1 8 Bit BYTEBit string02558 Bit WORDBit string06553516 Bit DWORDBit string04 294 967 2 95 32 Bit SINTShort Integer 1281278 Bit USINTUnsigned Short Integer 02558 Bit INTInteger 327683276716 B

7、it UINTUnsigned Integer 06553516 Bit DINTDouble Integer 2 31 2 31 132 Bit UDINTUnsigned Double Integer 02 32 132 Bit REALReal Number 10 3810 3832 Bit Bitstring Integers The following table lists all the properties of basic types IECType 7 Declaration of Global variables There are two ways to declare

8、 Global variables Variable List Textual mode of ST language Button User Button Extend IECType BOOL INT REAL IECType BOOL INT REAL Variable ListTextual mode CarelType Boolean Integer Analo g Global variables declaration Usable in any environment Usable only in the Strategy Editor ST no MASK FBD Strat

9、egy Editor You don t see these variables in Variable List Note if you want to see the variable in the pGD please declare the variable in the Variable List 8 Assignment operator Syntax Assign to a variable In assignment operations the variables involved must all be the same type each statement must u

10、se as the statement terminator In assignment operations with BOOL values 1 or TRUE or 0 or FALSE can be used indifferently a constant value the value of another variable the result of an expression Varaible name expression Assignment operator Statement terminator Note there is a in the end of statem

11、ent 9 Textual declaration To declare variables in ST you have to use the following declaration block Global variables declared in text mode will not be visible in the Variable List TypeSyntaxDescrition GloabalVAR GLOBAL END VAR Declares a group of global variables shared by program functions or func

12、tion blocks LocalVAR END VAR Declares a group of local variables to a program function or function block Note 1 there is no in the end of END VAR 2 we can give the default value in the declaration 10 Rules of the identifiers variables name a z A Z 0 9 Valid identifiers Invalid identifiers Note Mn22M

13、nThe 1st character must not be numeric 3exit 3exit 1 is not included in the set of characters Enrg offEnrg offSpaces are not allowed Drill DrillOnly single underscores are allowed Valve VALVENot case sensitive The variable names are not case sensitive Valve VaLVe e VALVE are the same variable The na

14、me of an identifier variable or constant can be any combination see Example of the characters listed below Example Rules to create identifiers 11 The qualifier CONSTANT Textual declaration of Constants The keyword CONSTANT can declare a constant The constants do not occupy space in memory as the var

15、iables During compilation instead of the constant is replaced a numeric value TypeSyntaxDescription Costanti Locali VAR CONSTANT END VAR Declares a group of local constants to a program function or function block Costanti Globali VAR GLOBAL CONSTANT END VAR Declares a group of global constants share

16、d by program functions or function blocks 12 Comments Comment using keyword REGION ENDREGION You can hide several lines of code using the keyword REGION ENDREGION So increase the readability of the code on the screen The code is replaced with a comment Clicking on comment it will appear again the code The code comments You can use two ways to make a comment To comment a single code line use To comment more code lines use and There is no in between END and REGION 13 The qualifier RETAIN Textual d

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 工作范文

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号