{"id":3243,"date":"2026-11-17T18:39:11","date_gmt":"2026-11-17T10:39:11","guid":{"rendered":"https:\/\/resource.fatek.com\/index.php\/2026\/11\/17\/mplc-m05-en-03\/"},"modified":"2026-11-17T18:39:11","modified_gmt":"2026-11-17T10:39:11","slug":"mplc-m05-en-03","status":"publish","type":"post","link":"https:\/\/resource.fatek.com\/index.php\/2026\/11\/17\/mplc-m05-en-03\/","title":{"rendered":"Chapter 3 Basic Program Structure of Uperlogic ST"},"content":{"rendered":"<h3>1-10 Introduction<\/h3>\n<p>This chapter will explain the methods of applying basic ST Language programming.<\/p>\n<h4>3-1-1 Character Encoding                                                                     <\/h4>\n<p>ST editor supports Unicode(encode in UTF-8). Supports basic characters and most symbols in Japanese, English, Chinese and other languages \u200b\u200bthat appear in program editing. In addition to being used for comments, they can also be used in labels or program and table names.<\/p>\n<h4>3-1-2 Composing Units                                                                     <\/h4>\n<p>The ST language uses the combination of the following symbols to describe the program. Later chapters will explain in detail.<\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td colspan=\"2\">\n<p>Type<\/p>\n<\/td>\n<td>\n<p>Example<\/p>\n<\/td>\n<td>\n<p>Referrence<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">\n<p>Computing Symbols<\/p>\n<\/td>\n<td>\n<p>+\u3001-\u3001*\u3001\/\u3001AND\u3001&amp;\u3001OR\u3001|\u3001XOR\u3001MOD\u3001 &lt;=\u3001 &gt;=\u3001&lt;&gt;\u3001++\u3001&#8211;\u3001&lt;&lt;\u3001&gt;&gt;\u3001NOT\u3001:=\u3001(\u3001)<\/p>\n<\/td>\n<td>\n<p><a href=\"#_Operand_and_Operator\">3-4 Operand and Operator<\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">\n<p>Keywords that control syntax<\/p>\n<p>(Standard identifier being defined)<\/p>\n<\/td>\n<td>\n<p>IF\u3001ELSEIF\u3001END_IF<\/p>\n<p>CASE\u3001OF\u3001END_CASE<\/p>\n<p>WHILE\u3001FOR\u3001END_WHILE<\/p>\n<p>END_FOR<\/p>\n<p>LBL<\/p>\n<p>GOTO\u3001CALL\u3001<\/p>\n<p>LBL_F\u3001GOTO_F<\/p>\n<p>IF_RISINGTRIGGER<\/p>\n<p>IF_FALLINGTRIGGER<\/p>\n<\/td>\n<td>\n<p><a href=\"#_Flow_Control_and\">3-6 Flow Control and Loop<\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td rowspan=\"2\">\n<p>Identifier<\/p>\n<\/td>\n<td>\n<p>Variables, Hardware Register, IO Discretes, Indirect Address&#8230;etc.<\/p>\n<p>(Labels, Elements\u2026etc.)<\/p>\n<\/td>\n<td>\n<p>X0\u3001Y0\u3001M100\u3001R0\u3001DR0\u3001\u3001D0\u3001DD0\u3001IM0\u2026etc<\/p>\n<p>Tag (Register any name)<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>Function Call (FB)<\/p>\n<\/td>\n<td>\n<p>1. System built-in Function<\/p>\n<p>2. (User-created FB Function library)<\/p>\n<\/td>\n<td>\n<p><a href=\"#_Calling_FCM_Function\">3-14 Calling FCM Function modes<\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">\n<p>Constant<\/p>\n<\/td>\n<td>\n<p>Interger: <\/p>\n<p>Defaulted as \u201csigned int\u201d<\/p>\n<p>     Ex:  <strong>R0<\/strong>:=1;  <strong>R0<\/strong>:=-2;<\/p>\n<p>\u201cUnsigned int\u201d<\/p>\n<p>     Ex:  <strong>Tag0<\/strong>:=0xFF;<\/p>\n<p>String: Use only on Label<\/p>\n<p>     Goto, LBL&#8230;etc<\/p>\n<p>Bit (Bool) Type: <\/p>\n<p>TRUE\u3001FALSE<\/p>\n<p>Float: 32-bit Float Constant<\/p>\n<p>     ex:  TagFloat1:=1.1;   <\/p>\n<\/td>\n<td>\n<p><a href=\"#Constant\">3-7-4 Constant<\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">\n<p>Delimiter<\/p>\n<\/td>\n<td>\n<p>\u201c:\u201d appears in <strong>CASE OF<\/strong><\/p>\n<p>\u5206\u9694\u201c,\u201d  Passing multiple function parameters<\/p>\n<\/td>\n<td>\n<p><a href=\"#CaseOf\">3-6-3 Case Of<\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">\n<p>Left\/Right Round Brackets<\/p>\n<\/td>\n<td>\n<p>\u201c(\u201c , \u201c )\u201d<\/p>\n<ol>\n<li>The start and end of Function Call<\/li>\n<\/ol>\n<p>ex: Fun0 ( S:=R0, D:=R1 );<\/p>\n<ol>\n<li>The enforced priority of a general operator<\/li>\n<\/ol>\n<p>R0:= (1+R0)*R2;<\/p>\n<\/td>\n<td>\n<p><a href=\"#parentheses\">3-4-1 ( )<\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">\n<p>RETURN<\/p>\n<\/td>\n<td>\n<p>Used in Sub-program or FB.<\/p>\n<p>To immediately leave the program section.<\/p>\n<\/td>\n<td>\n<p><a href=\"#LBLJMPCALL\">3-6-6\tLabel &amp; Jump\/Call<\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">\n<p>\u201c;\u201d the end of the statement<\/p>\n<\/td>\n<td>\n<p>To mark the end of a sentence running at one end.<\/p>\n<\/td>\n<td>\n<p>&#8211;<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>Spaces, newlines and comments can be freely inserted between each symbol.<\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td>\n<p>Type<\/p>\n<\/td>\n<td>\n<p>Example<\/p>\n<\/td>\n<td>\n<p>Referrence<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>Space<\/p>\n<\/td>\n<td>\n<p>Space (Halfwidth\/Fullwidth), TAB<\/p>\n<\/td>\n<td>\n<p>\uff0d<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>Newline<\/p>\n<\/td>\n<td>\n<p>Newline Code<\/p>\n<\/td>\n<td>\n<p>\uff0d<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>Comment<\/p>\n<\/td>\n<td>\n<p>\/\/\u3001(* &#8230;. *)<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<\/table>\n<\/div>\n<h3>1-11 Statement<\/h3>\n<p><strong><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-001.png\" \/><\/strong>\u201cStatement\u201d is the most basic execution unit in ST Language, which represents a complete work to be executed. A complete statement is not limited to the same line of words; however, it must be ended with \u201c\uff1b.\u201d In addition, a statement is also allowed to contain multiple or multi-level sub-statement, and regardless of the position of the statement, it must be followed by a \u201c;\u201d symbol at the end.<\/p>\n<p>A complete statement is equivalent to a ladder diagram section (NETWORK) with complete functions, and it must be able to clearly express one work. Take the statement in the below program as an example, the work it performs is to compute the content value of each device according to the order R0*(R1+R2) expressed in the mathematical formula, and assign the result of the operation to the R10 device. However, although the content in the red frame in the figure below is legal, it is not a complete statement but an Expression, which represents only a value of a mathematical computation, but not a specific work.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-002.png\" \/><\/p>\n<p>Shown below are some statements of Uperlogic ST Language: <img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-003.png\" \/><\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td colspan=\"2\">\n<p>Type<\/p>\n<\/td>\n<td>\n<p>Content<\/p>\n<\/td>\n<td>\n<p>Example<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">\n<p>Distributive Statement<\/p>\n<\/td>\n<td>\n<p>Substitute the result on the right into the variable on the left.<\/p>\n<\/td>\n<td>\n<p><a href=\"#AssignValue\">:=<\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td rowspan=\"2\">\n<p>Flow Control Syntax<\/p>\n<\/td>\n<td>\n<p>Conditional Statement (IF, CASE)<\/p>\n<\/td>\n<td>\n<p>Select the execution syntax based on the condition.<\/p>\n<\/td>\n<td>\n<p><a href=\"#IFELSE\">3-6-1<\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>Do-While Statement (FOR, WHILE)<\/p>\n<\/td>\n<td>\n<p>Execute multiple times depending on the end condition.<\/p>\n<\/td>\n<td>\n<p><a href=\"#ForLoop\">3-6-2<\/a><\/p>\n<p><a href=\"#WHILE\">3-6-4<\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td rowspan=\"2\">\n<p>Sub-program Statement<\/p>\n<\/td>\n<td>\n<p>Function Block Call Statement<\/p>\n<\/td>\n<td>\n<p>Call FB(FCM)<\/p>\n<\/td>\n<td>\n<p><a href=\"#_Calling_FCM_Function\">3-14<\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>Label Statement<\/p>\n<\/td>\n<td>\n<p>Call LBL<\/p>\n<\/td>\n<td>\n<p><a href=\"#LBLJMPCALL\">3-6-6<\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">\n<p>Toolbox Statement<\/p>\n<\/td>\n<td>\n<p>Convenient statement to execute toolbox instructions<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>Flow control syntax can be layered.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-004.png\" \/>(It can be used in combination with Conditional statements and do-whlie statements))<\/p>\n<h3>1-12 Expression<\/h3>\n<p>\u201cExpression\u201d is a very important element in the structure of a statement and it represents a \u201cvalue\u201d, such as a Boolean value of TRUE or FALSE, or an integer value of 20 or -5. It can be an operation expreesion or a constant, and of course it can also be a variable symbol or device, depending on occasions. The following are some examples of expressions:<\/p>\n<ul>\n<li>M0 &amp; M1 (Expression of Boolean) represents the Boolean value between the computation of M0 and M1.<\/li>\n<li>M0 = FALSE (Expression of Boolean) represents whether the condition \u201cM0=FALSE\u201d is true. When the value of M0 is ON, the Boolean value represented by this expression is FALSE; but when M0 is OFF, the Boolean represented by the expression will be TRUE because the condition is established.<\/li>\n<li>M0 (Expression of Boolean) directly takes the value of M0 as its representative Boolean value. When the value of M0 is ON, the Boolean value represented by the expression will be TRUE, and when M0 is OFF, the Boolean represented by the expression will be FALSE.<\/li>\n<li>D1 + D2 (Expression of Value) represents the result of adding D1 and D2.<\/li>\n<li>D0 (Expression of Value) directly takes the current value of D0 as its representative value.<\/li>\n<li>D2 = D0 + D1 (Expression of Boolean) is a relatively confusing Boolean expression, which represents whether the condition \u201cD2=D0+D1\u201d is true. When the result of adding D0 and D1 is equal to the current value of D2, the expression is TRUE; if the result of adding of D0 and D1 is not equal to the current value of D2, the expression represents FALSE.<\/li>\n<li>D2 := D0 + D1; (Statement, not Expression) is a complete statement rather than an expression, which represents the meaning of the work \u201cAssigning the result of adding D0 and D1 to D2\u201d; but this statement is also composed of the two expressions \u201cD2\u201d and \u201cD0+D1.\u201d<\/li>\n<\/ul>\n<p>Position of the Expression used:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-005.png\" \/><\/p>\n<p>The below table shows Expression types:<\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td colspan=\"2\">\n<p>Type<\/p>\n<\/td>\n<td>\n<p>Data Type of Expression (Computing Result)<\/p>\n<\/td>\n<td>\n<p>Example<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td rowspan=\"3\">\n<p>Operation Expression<\/p>\n<\/td>\n<td>\n<p>Arithmetic Expression<\/p>\n<\/td>\n<td>\n<p>Interger, real number\u2026etc.<\/p>\n<p>(according to computing elements)<\/p>\n<\/td>\n<td>\n<p>R0+R2<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>Logic Expression<\/p>\n<\/td>\n<td>\n<p>Boolean (TRUE\/FALSE)<\/p>\n<\/td>\n<td>\n<p>R0 AND R2<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>Compare Expression<\/p>\n<\/td>\n<td>\n<p>Boolean (TRUE\/FALSE)<\/p>\n<\/td>\n<td>\n<p>R0 &gt; R2<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td rowspan=\"2\">\n<p>Basic Expression<\/p>\n<\/td>\n<td>\n<p>Variables, Constants<\/p>\n<\/td>\n<td>\n<p>Defined data type<\/p>\n<\/td>\n<td>\n<p>M0.R0.123.TRUE<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>Function Call Expression<\/p>\n<\/td>\n<td>\n<p>Data type of return value<\/p>\n<\/td>\n<td>\n<p>Fcm0( PA0:= ,OUT0=&gt; );<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<h4>3-3-1 Opearation Expression                                                                  <\/h4>\n<p>This section uses examples to explain how operation expressions are presented in the ST environment and the LD environment.<\/p>\n<h4>3-3-2 Arithmetic (+\u3001-\u3001*\u3001\/)                                                         <\/h4>\n<p>The four operation symbols are described using the same operation symbols (+, -, *, \/) as the general arithmetic symbols.<\/p>\n<p>For operations that cannot be described in LD diagrams, can be described concisely through single-line expressions.<\/p>\n<p><strong>Program Example:<\/strong><\/p>\n<p>Substitute the adding result of R0-R2 in R3<\/p>\n<p>R3=R0+R1+R2<\/p>\n<p>ST                                                                          <\/p>\n<p>R3:=R0+R1+R2;<\/p>\n<p>LD                                                                          <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-006.png\" \/><\/p>\n<ul>\n<li>When adding multiple operration expressions with one statement, the operation symbol with the highest priority will be processed. For the priority of the four operation symbols, please refer to the chapter on operands. When there are multiple operation symbols with the same priority, the operation starts from the leftmost operation symbol.\u3002<\/li>\n<\/ul>\n<h4>Advanced Operation (Exponents)                                                               <\/h4>\n<p>Exponential or trigonometric operations using general-purpose functions.<\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td rowspan=\"2\">\n<p>Type<\/p>\n<\/td>\n<td rowspan=\"2\">\n<p>Function Name<\/p>\n<\/td>\n<td colspan=\"2\">\n<p>Example<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>General Expression<\/p>\n<\/td>\n<td>\n<p>ST<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>Absolute Value<\/p>\n<\/td>\n<td>\n<p>ABS<\/p>\n<\/td>\n<td>\n<p>|X|<\/p>\n<\/td>\n<td>\n<p>ABS( D:= );<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>Square Root<\/p>\n<\/td>\n<td>\n<p>SQRT<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>FSQR(S:= ,D:= );<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td rowspan=\"3\">\n<p>Trigonometric Functions<\/p>\n<\/td>\n<td>\n<p>SIN\u3001ASIN<\/p>\n<\/td>\n<td>\n<p>B=SIN A<\/p>\n<\/td>\n<td>\n<p>FSIN( S:= , D:= );<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>COS\u3001ACOS<\/p>\n<\/td>\n<td>\n<p>B=COS A<\/p>\n<\/td>\n<td>\n<p>FACOS( S:= , D:= );<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>TAN\u3001ATAN<\/p>\n<\/td>\n<td>\n<p>B=TAN A<\/p>\n<\/td>\n<td>\n<p>FTAN( S:= , D:= );<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p><strong>Program Example<\/strong><\/p>\n<p>Find the length of the hypotenuse of a right triangle.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-007.png\" \/><\/p>\n<p>ST                                                                                <\/p>\n<p>(To use floating point numbers, you need to register Tag first to change the data type.  <\/p>\n<p>ex: A= Float DR0\u3001B= Float DR2\u3001C= Float DR4)<\/p>\n<p>FSQR( S:= A*A+B*B, D:= C);<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-008.png\" \/><\/p>\n<p>LD                                                                                <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-009.png\" \/><\/p>\n<h3>1-13  Operand and Operator<\/h3>\n<p>Operands and operators are the basic elements that make up an expression. The operand refers to the object involved in the operation, and the operator represents the operation performed. For example, in the expression \u201cD0 + D\u201d1, both \u201cD0\u201d and \u201cD1\u201d are operands, and the \u201c+\u201d sign is the operator. As seen from the examples in the previous section, an expression can be a combination of a group of operands and operators, but it can also be represented by an operand alone; while the operand can be a device, a variable symbol or a constant<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-010.png\" \/><\/p>\n<p>Like mathematical forms, operators themselves have a priority order for performing operations. When the priority levels are the same, the order of the operation will be from left to right. The following table is a list of operators in ST syntax in Uperlogic<\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td rowspan=\"2\">\n<p>Symbol<\/p>\n<\/td>\n<td rowspan=\"2\">\n<p>Function<\/p>\n<\/td>\n<td colspan=\"2\">\n<p>Data Form<\/p>\n<\/td>\n<td colspan=\"2\">\n<p>Example of Expression<\/p>\n<\/td>\n<td>\n<p>Priority Level<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>Operand<\/p>\n<\/td>\n<td>\n<p>Operation Result<\/p>\n<p>(Expression Value)<\/p>\n<\/td>\n<td>\n<p>Expression<\/p>\n<\/td>\n<td>\n<p>Value<\/p>\n<\/td>\n<td>\n<p>Highest<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\uff08\uff09<\/p>\n<\/td>\n<td>\n<p>Prior block<\/p>\n<\/td>\n<td>\n<p>Not limited<\/p>\n<\/td>\n<td>\n<p>Not limited<\/p>\n<\/td>\n<td>\n<p>\uff08D0 + 6\uff09* 3<\/p>\n<\/td>\n<td><\/td>\n<td rowspan=\"15\"><\/td>\n<\/tr>\n<tr>\n<td>\n<p>++,&#8211;<\/p>\n<\/td>\n<td>\n<p>To quickly add or subtract 1<\/p>\n<\/td>\n<td>\n<p>Any value<\/p>\n<\/td>\n<td>\n<p>Any value<\/p>\n<\/td>\n<td>\n<p>++D0      D0++<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>&#8211;<\/p>\n<\/td>\n<td>\n<p>Numerical negative sign<\/p>\n<\/td>\n<td>\n<p>Any value<\/p>\n<\/td>\n<td>\n<p>Any value<\/p>\n<\/td>\n<td>\n<p>-D0<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>NOT<\/p>\n<\/td>\n<td>\n<p>Logic inversion<\/p>\n<\/td>\n<td>\n<p>Boolean<\/p>\n<\/td>\n<td>\n<p>Boolean<\/p>\n<\/td>\n<td>\n<p>NOT M0<\/p>\n<\/td>\n<td>\n<p>TRUE<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>*<\/p>\n<\/td>\n<td>\n<p>Multiplication<\/p>\n<\/td>\n<td>\n<p>Any value<\/p>\n<\/td>\n<td>\n<p>Any value<\/p>\n<\/td>\n<td>\n<p>D0*3<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>\/<\/p>\n<\/td>\n<td>\n<p>Division<\/p>\n<\/td>\n<td>\n<p>Any value<\/p>\n<\/td>\n<td>\n<p>Any value<\/p>\n<\/td>\n<td>\n<p>15\/D0<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>+,-<\/p>\n<\/td>\n<td>\n<p>Addition, Subtraction<\/p>\n<\/td>\n<td>\n<p>Any value<\/p>\n<\/td>\n<td>\n<p>Any value<\/p>\n<\/td>\n<td>\n<p>D0+3<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>&lt; , &gt;,&lt;=, &gt;=<\/p>\n<\/td>\n<td>\n<p>Value compare<\/p>\n<\/td>\n<td>\n<p>Any value<\/p>\n<\/td>\n<td>\n<p>Boolean<\/p>\n<\/td>\n<td>\n<p>D0&gt;2<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td rowspan=\"2\">\n<p>=,&lt;&gt;<\/p>\n<\/td>\n<td rowspan=\"2\">\n<p>Equal, <\/p>\n<p>Not Equal<\/p>\n<\/td>\n<td>\n<p>Any value<\/p>\n<\/td>\n<td>\n<p>Boolean<\/p>\n<\/td>\n<td>\n<p>D0&lt;&gt;2<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>Boolean<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>M0=TRUE<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>AND,&amp;<\/p>\n<\/td>\n<td>\n<p>\u201cand\u201doperation<\/p>\n<\/td>\n<td>\n<p>Boolean or Value<\/p>\n<\/td>\n<td>\n<p>Boolean or Value<\/p>\n<\/td>\n<td>\n<p>M0&amp;M1<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>OR, |<\/p>\n<\/td>\n<td>\n<p>\u201cor\u201doperation<\/p>\n<\/td>\n<td>\n<p>Boolean or Value<\/p>\n<\/td>\n<td>\n<p>Boolean or Value<\/p>\n<\/td>\n<td>\n<p>M0 OR M1<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>XOR<\/p>\n<p>XNOR<\/p>\n<\/td>\n<td>\n<p>\u201cexclusive or\u201d operation,<\/p>\n<p>\u201cexclusive nor\u201d<\/p>\n<p>operation<\/p>\n<\/td>\n<td>\n<p>Boolean or Value<\/p>\n<\/td>\n<td>\n<p>Boolean or Value<\/p>\n<p>Integer<\/p>\n<\/td>\n<td>\n<p>M0 XOR M1<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>MOD<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>Value<\/p>\n<\/td>\n<td>\n<p>Value<\/p>\n<\/td>\n<td>\n<p>D0 MOD 3 <\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>&gt;&gt;,&lt;&lt;<\/p>\n<\/td>\n<td>\n<p>Shift right\/left 1<\/p>\n<\/td>\n<td>\n<p>Any value<\/p>\n<\/td>\n<td>\n<p>Any value<\/p>\n<\/td>\n<td>\n<p>D0&gt;&gt;1<\/p>\n<\/td>\n<td>\n<p>2<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>R_TRIG, F_TRIG<\/p>\n<\/td>\n<td>\n<p>Rising Edge<\/p>\n<p>Falling Edge<\/p>\n<\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td>\n<p>Lowest<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>\u25a0 The part with the same background color have the same priority.<\/p>\n<p>\u25a0 AND, OR, XOR, XNOR basically do the role of BitWise (ex R0 AND R1) and the result will be a value.<\/p>\n<p>Unless the left and right sides are both Bool(bit) (ex. M0 AND M1) types, logic operations will be performed and the result will be a Bool(bit) value.<\/p>\n<p>\u25a0 No support &amp;&amp;, ||, == syntax.<\/p>\n<p>The individual Operator will be introduced later.<\/p>\n<h4>3-4-1 (  )                                                                         <\/h4>\n<p>The function is the same as a mathematical formula, and the expression in the round brackets is prioritized for operation.<\/p>\n<p>    <strong>EX: <\/strong><\/p>\n<p><strong>R0:= (R0+2)*3-(R2+3)*56 ; \/\/ R0=1;R2=2 <\/strong><\/p>\n<p><strong>\/\/ R0= &#8211; 271<\/strong><\/p>\n<h4>3-4-2 Arithmetic +, -,* , \/                                                                         <\/h4>\n<p>Operate addition, subtraction, multiplication and division for the operators on both sides.<\/p>\n<p>Calculate addition, subtraction, multiplication and division for the operands on both sides<strong>\t<\/strong><\/p>\n<p><strong>\t\t\tEX:<\/strong><\/p>\n<p><strong>R0:= 5+4-3*2\/1 ;<\/strong><\/p>\n<p><strong>\t\t\t\t\/\/ R0=3<\/strong><\/p>\n<h4>3-4-3 Quick Addition and Subtraction ++, &#8212;                                                                         <\/h4>\n<p>Specifically for operand + 1 or -1<\/p>\n<p>Prefix Syntax:<\/p>\n<p>     ++(Register)<\/p>\n<p>     &#8211;(Register)<\/p>\n<p>           The same result as (Register):=(Register)+1, but the speed is faster.<\/p>\n<p>PostFix Syntax:<\/p>\n<p>     (Register)++<\/p>\n<p>     (Register)&#8211;<\/p>\n<p>          First take (Register) value \u2192 return \u2192 operate (Register):=(Register)+1<\/p>\n<p>      ex:<\/p>\n<p>          R0:=10;<\/p>\n<p>          R2:=10;<\/p>\n<p>          R100:=++R0; \/\/\/\/ R100 is 11, R0 is 11<\/p>\n<p>          R102:=R2++; \/\/\/\/ R102 is 10, R2 is 11<\/p>\n<h4>3-4-4 Value compare  &gt;=,&lt;=,&gt;,&lt;                                                            <\/h4>\n<p>Compare the values \u200b\u200b\u200b\u200bon the left and right sides of the symbol. The left and right sides of two symbols need to be of the same type to be able to compare; otherwise there will be truncate or digital missing (float &lt;-&gt;int)<\/p>\n<p>The result will be TRUE\/ FALSE ( 1\/ 0) <\/p>\n<p>EX:<\/p>\n<p>M0:=R1 &gt;= R2;  \/\/\/ If R1 is greater than or equal to R2, M0 will be TRUE ( 1 )<\/p>\n<h4>3-4-5\tEqual to\/Not equal to = , &lt;&gt;                                                            <\/h4>\n<p>Compare whether the left operator is equal to the right operators.<\/p>\n<p>The result will be TRUE\/ FALSE ( 1\/ 0)<\/p>\n<p>EX:<\/p>\n<p>M0 := R0=100; \/\/ If R0 value=100, M0 will be TRUE ( 1 )<\/p>\n<h4>3-4-6\tBit shift left and right &lt;&lt;, &gt;&gt;                                                            <\/h4>\n<p>For the left-side value, shift left or right by the number of bits on the right side.<\/p>\n<p>EX: <\/p>\n<p>R10:=R0&lt;&lt;4; <strong>\/\/R0=1(0b0_0001)<\/strong><\/p>\n<p>\/\/ R0 value will be shifted right with 4 bits, and assign to R10    <\/p>\n<p>\/\/ R10=16(0b1_0000)<\/p>\n<p>P.S. R0 will not be changed<\/p>\n<h4>3-4-7\tNegation of Operand NOT                                                             <\/h4>\n<p>Perform Bitwise NOT operation on the right operand.<\/p>\n<p>EX:<\/p>\n<p>R0:=NOT R2;  \/\/  Do \u201cone&#8217;s complmenet\u201d to the value in R2 and save it to R0<\/p>\n<p>R2=1(0b0_0001) =&gt; NOT R2= -2(0b1111_1110)<\/p>\n<p>M0:= NOT ( M0 OR M2 ); \/\/  M0 OR M2 result is negated and stored in M0<\/p>\n<h4>3-4-8\tNegative Sign of Operand &#8211;                                                                 <\/h4>\n<p>Perform negation (sign reversal) on the right operand.<\/p>\n<p>EX:  <\/p>\n<p>\t\t\tIF R_TRIG( S:=M1 ) THEN<\/p>\n<p>R0:=-R2;\t\t\/\/R2=1 0b0_0000_0000_0001)=&gt; R0=-1(0b1111_1111_1111_1111)<\/p>\n<p>END_IF<\/p>\n<h4>3-4-9\tAssign Value :=                                                             <\/h4>\n<p>Assign the right value (variables) to the left variable of the symbol.<\/p>\n<p>EX: <\/p>\n<p>R1:=R0;  \/\/  Move R0 to R1<\/p>\n<p>R1:=1;    \/\/  Set R1 as integer 1<\/p>\n<h4>3-4-10\tLogic Operand AND ( &amp; )\u3001OR ( | )\u3001XOR\u3001XNOR                                                            <\/h4>\n<p>Perform logic operations (Bitwise) on the left and right operators, and the result of the value will be the same as the type of the operator.<\/p>\n<p>EX:<\/p>\n<p>R0:= R1 AND R2; \/\/ Perform bitwise AND operation on the values \u200b\u200bof R1 and R2 and store them in R0<\/p>\n<p>              \/\/ If R1=1(0b0_0001) R2=15(0b0_1111) then R0 =1(0b0_0001)<\/p>\n<p>DR0:= R10 &amp; DR12; <\/p>\n<p>\/\/ Perform bitwise AND operation on the values \u200b\u200bof R10 and DR12 and store them in DR0<\/p>\n<p>\/\/ If R10=1118481(0x11_1111H) DR12=69905(0x1_1111H) Then DR0 =4369(0x1111H)<\/p>\n<p>R0:= R1 | R2; \/\/ Perform bitwise OR operation on the values \u200b\u200bof R1 and R2 and store them in R0<\/p>\n<p>           \/\/ If R1=1(0b0_0001) R2=15(0b0_1111) then R0 =15(0b0_1111)<\/p>\n<p>DR0:= DR10 OR R12; <\/p>\n<p>\/\/ Perform bitwise OR operation on the values \u200b\u200bof R10 and DR12 and store them in DR0<\/p>\n<p>\/\/ If DR10=4369(0x1111H) R12=69905(0x1_1111H) Then DR0 =4369(0x1111H)<\/p>\n<p>R0:= R1 XOR R2; <\/p>\n<p>\/\/ Perform bitwise inverse OR operation on the values \u200b\u200bof R1 and R2 and store them in R0<\/p>\n<p>\/\/ If R1=1(0b0_0001) R2=15(0b0_1111) then R0 =14(0b0_1110)<\/p>\n<p>R0:= R1 XNOR R2;<\/p>\n<p>\/\/ If R1=1(0b0_0001) R2=15(0b0_1111) then R0 =-15(0b1111_0001)<\/p>\n<h4>3-4-11\tRemainder MOD                                                           <\/h4>\n<p>Operates the remainder of the left and right operands which are equal to C\u2019s \u201c%\u201d symbol<\/p>\n<p>EX:<\/p>\n<p>R0:= R1 MOD R2 ;  \/\/ R0 is the remainder after dividing R1 by R2<\/p>\n<p><strong>\t\t\t\t\t<\/strong>\/\/  R1=10,R2=3  The quotient of 10\/3 is equal to 3, the remainder is equal to 1, R0=1<\/p>\n<h3>1-5  Comment<\/h3>\n<p>Comments are those used by program developers for easy maintainance in the future. There are single-line or multiline comments appeared with light gray text, and these parts will be ignored by the editor and will not generate operating data.<\/p>\n<h4>3-5-1\tSingle-Line Comment   \/\/                                                               <\/h4>\n<p>Ligh gray will appear after the symbol, and will not generate the operating program codes.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-011.png\" \/><\/p>\n<h4>3-5-2\tMultiline Comment  (*     *)                                                           <\/h4>\n<p>A continuous comment that can be multiple-line (or a single line), and the text between these two symbols will be seen as a comment.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-012.png\" \/><\/p>\n<p>P.S. Users can also use quick keys (Ctrl+ \/ ) to comment on the selected rows and columns in batches (add\/remove).<\/p>\n<h3>1-6  Flow Control and Loop<\/h3>\n<p>When writing ST, some conditions or loop control are usually required for easier design.<\/p>\n<p>Introduction as shown below:<\/p>\n<h4>3-6-1 IF ELSE                                                                    <\/h4>\n<p><strong>      <\/strong><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-013.png\" \/><\/p>\n<p>When the expression after IF is TRUE or 1 at the end, the description after IF will be operated immediately, otherwise the description after ELSE will be operated.<\/p>\n<p>EX:<\/p>\n<p>        <img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-014.png\" \/><\/p>\n<p>If M5 is Rise Trigger, and M88 is TRUE (1) , R100 = 10, and R10 = 12<\/p>\n<p>Use ELSEIF if there are multiple comditions.<\/p>\n<p>EX:<\/p>\n<p><strong>      <\/strong><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-015.png\" \/><\/p>\n<h4>3-6-2\tFor Loop                                                                        <\/h4>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-016.png\" \/><\/p>\n<p><strong>Parameters<\/strong>\uff1a<\/p>\n<p><strong>(\uff0aReg\uff0a)<\/strong>\uff1aCounter register<\/p>\n<p>Repeat the statement from FOR to END_FOR until the counter register reaches the target value.<\/p>\n<p>Each time it is repeated, an incremental value or decremental value is added to the target value <\/p>\n<p><strong>(\uff0aStart\uff0a)<\/strong>\uff1aInitial value<\/p>\n<p><strong>(\uff0aEnd\uff0a)<\/strong>\uff1aTarget value<\/p>\n<p><strong>(\uff0a&lt; inc &gt;\uff0a)<\/strong>\uff1aIncremental value or decremental value<\/p>\n<p><strong>(\uff0aStatements\uff0a)<\/strong>\uff1aProgram to be executed in a loop<\/p>\n<p><em>P.S. The <\/em>BY<em> field can be omitted (the default is 1) as shown below<\/em><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-017.png\" \/><\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td><\/td>\n<td>\n<p>Counter register<\/p>\n<\/td>\n<td>\n<p>Initial value<\/p>\n<\/td>\n<td>\n<p>Target value<\/p>\n<\/td>\n<td>\n<p>Incremental value or decremental value<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>Single word<\/p>\n<\/td>\n<td>\n<p>\u25cb<\/p>\n<\/td>\n<td>\n<p>\u25cb<\/p>\n<\/td>\n<td>\n<p>\u25cb<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>Double word<\/p>\n<\/td>\n<td>\n<p>\u25cb<\/p>\n<\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>Constant<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>\u25cb<\/p>\n<\/td>\n<td>\n<p>\u25cb<\/p>\n<\/td>\n<td>\n<p>\u25cb<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p><em>P.S. If the loop count is incrementing, then initial value &lt; target value.<\/em><\/p>\n<p><em>If the loop count is incrementing, then initial value &gt; target value.<\/em><\/p>\n<p>EX:<\/p>\n<p>FOR DR0:=R2 TO R4 BY 2 DO   \/\/DR0 from R2, R2+2, R2+4,&#8230;.etc, until it reaches to R4<\/p>\n<p>    R10++;                              <strong>\/\/ DR0=R4,R10=R0+(R4-R2)\/2<\/strong><\/p>\n<p>END_FOR<\/p>\n<h4>3-6-3 Case Of                                                                    <\/h4>\n<p>Selection of Integer conditions:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-018.png\" \/><\/p>\n<p>It will read the value of the target register, and run after the specified conditions are fully read: the following description .<\/p>\n<p>If none are satisfied, the description after ELSE will be run<\/p>\n<p>Conditions only support integer constants or constants within the range .. symbols<\/p>\n<p>EX:<\/p>\n<p>        <img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-019.png\" \/><\/p>\n<p>        R0 = 1               \/\/R100 = 10<\/p>\n<p>      \t     \t\t\t\t\t\t\t\/\/3, 4, 5, 6, 7, 8, 9  ,R100 = 11<\/p>\n<h4>3-6-4 WHILE LOOP &amp; REPEAT                                                       <\/h4>\n<p>Repeat the run description until the condition is (not) met<\/p>\n<p>WHILE LOOP:<\/p>\n<p>          <img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-020.png\" \/><\/p>\n<p>EX:<\/p>\n<p><strong><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-021.png\" \/><\/strong><\/p>\n<p>REPEAT:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-022.png\" \/><\/p>\n<p>EX:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-023.png\" \/><\/p>\n<p>NOTICE: Because of the logic of hardware running, if the WHILE does not jump out of the loop for a long time, the PLC device will not be able to handle other IO states, resulting in system errors. Users should be careful when using it.<\/p>\n<h4>3-6-5\tBREAK \/ EXIT                                                                  <\/h4>\n<p>In the loop situation of FOR, WHILE, REPEAT, you can leave the loop early with BREAK or EXIT at the appropriate time<\/p>\n<p>EX:<\/p>\n<p>          <img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-024.png\" \/><\/p>\n<p>When R0 is greater than or equal to 100, it will run BREAK and jump out of the WHILE loop.<\/p>\n<p>NOTICE: Because of the logic of hardware running, if the WHILE does not jump out of the loop for a long time, the PLC device will not be able to handle other IO states, resulting in system errors. Users should be careful when using it.<\/p>\n<h4>3-6-6\tLBL, JMP, CALL                                                                  <\/h4>\n<p>The LBL command can achieve the same effect as LD FUN_65, with a Label of up to 6 ASCII characters.<\/p>\n<p><strong>EX:<\/strong><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-025.png\" \/> <\/p>\n<p><strong>The keywords that can be used to call Label in the ST environment are as follows:<\/strong><\/p>\n<p><strong>JMP_66, GOTO (for detailed description, please refer to FUN 66)<\/strong><\/p>\n<p><strong>        EX:<\/strong><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-026.png\" \/> <\/p>\n<p><strong>CALL\uff0cCALL_67 (for detailed description, please refer to FUN 67)<\/strong><\/p>\n<p><strong>        EX:<\/strong><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-027.png\" \/> <img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-028.png\" \/> <img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-029.png\" \/><\/p>\n<p><strong>When using the Label function in a subroutine, the LBL instruction combined with RETURN will have different results.<\/strong><\/p>\n<p><strong>EX:<\/strong><\/p>\n<p><strong><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-030.png\" \/><\/strong><\/p>\n<p><strong>R0=2, because the Label of A.B is called at the same time and the result is RETURN.<\/strong><\/p>\n<p><strong><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-031.png\" \/><\/strong><\/p>\n<p><strong>R0=1, because only the Label of A is called, and the result is RETURN<\/strong><\/p>\n<p><strong><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-032.png\" \/><\/strong><\/p>\n<p><strong>R0=2, because the Label of A is called, but RETURN is after the Label of B<\/strong><\/p>\n<p><strong><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-033.png\" \/><\/strong><\/p>\n<p><strong>R0=3, because the Label of &quot;Sub-unit 0&quot; A is called, but RETURN is after the Label of &quot;Sub-unit 1&quot; C (special attention is required)<\/strong><\/p>\n<p>If you need to use tags in the FCM environment, you need to use the LBL_F\u3001FLBL_165 instructions.<\/p>\n<p><strong>The Label keyword can only be called in FCM<\/strong><\/p>\n<p><strong>GOTO_F (Label that can only be used in FB)<\/strong><\/p>\n<p><strong>FJMP_166<\/strong><\/p>\n<p><strong>EX:<\/strong><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-034.png\" \/><\/p>\n<h3>1-7 Variables and Data Type<\/h3>\n<p>In the programming language, the use of variables and data types are an important part. In order to ensure that variables have typed characteristics, it is convenient for programmers to view and debug. ST uses Tag (Global, Local) to give variables a specific type.<\/p>\n<p>The following introduces the data types and usage supported by ST.<\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td>\n<p><strong>Precautions<\/strong><\/p>\n<p><strong>If the operation result exceeds the value range that the data type can handle, the correct result (numeric value) will not be reflected in subsequent processing.<\/strong><\/p>\n<p><strong>The data type of the operation object variable should be converted in advance into a data type within the range that can process the operation results.<\/strong><\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<h4>Tag creation example <\/h4>\n<p>Labels are divided into global labels and regional labels. The label name created by the global label cannot be shared with the regional label. It is a label name that can be shared by the entire project. The label name created by the regional label can use the same name between different main programs, sub-programs, and Fcm programs without affecting each other (but the addresses must be different).<\/p>\n<p><strong><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-035.png\" \/><\/strong><\/p>\n<p><strong>In order to cooperate with program operations of different data types, the following will demonstrate how to create different types of labels.<\/strong><\/p>\n<p><strong>The Rx.Dx register is defaulted to INT16, and the DRx.DDx register is defaulted to INT32 integer variable.<\/strong><\/p>\n<p><strong>EX<\/strong><\/p>\n<p><strong>Double-click to select the Global Tag-&gt;Add new Tag<\/strong><\/p>\n<p><strong><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-036.png\" \/><\/strong><\/p>\n<p><strong><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-037.png\" \/><\/strong><\/p>\n<p><strong><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-038.png\" \/><\/strong><\/p>\n<p><strong>If the selected address and data type are not supported, a reminder will pop up to block it.<\/strong><\/p>\n<h4>3-7-1\tBool \/ Bit                                                                   <\/h4>\n<p>As long as the data represented is a bit or a value comparison operation (ex. &lt;, &gt;, &lt;&gt; &#8230; etc.), these results are all Bool (Bit) type, and 0 or 1, TRUE, FALSE can be used here accepted as a constant representing type Bool.<\/p>\n<p>Among them, the switch of the relay is also represented by Bool\/Bit ( ex. M0, X0, Y0&#8230;etc).<\/p>\n<p><strong>EX:<\/strong><\/p>\n<p><strong>   <\/strong><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-039.png\" \/><\/p>\n<h4>3-7-2\tInteger Type                                                                <\/h4>\n<p>There are four integer types of ST: INT16, UINT16, INT32, UINT32<\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td>\n<p>Type<\/p>\n<\/td>\n<td>\n<p>Description<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>INT16<\/p>\n<\/td>\n<td>\n<p>16-bit integer<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>UINT16<\/p>\n<\/td>\n<td>\n<p>16-bit positive integer<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>INT32<\/p>\n<\/td>\n<td>\n<p>32-bit integer<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>UINT32<\/p>\n<\/td>\n<td>\n<p>32-bit positive integer<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>If a 16-bit register position (ex. R0, R1..etc) is used, the system will default to INT16 data type to process; if it is a 32-bit register (ex. DR0, DR2&#8230; etc), it will be seen as INT32<\/p>\n<p>.<\/p>\n<h4>3-7-3\tFloating Point                                                                 <\/h4>\n<p>Floating-point defined for IEEE-754.<\/p>\n<p>For ST operations on floating point, it is necessary to generate the corresponding Tag first, so that the system can know which variable refers to the register position representing a floating point.<\/p>\n<p>Among them, when using floating-point operations, there will be some defaulted implicit behaviors. The descriptive example is in the figure below:<\/p>\n<p>         <img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-040.png\" \/><\/p>\n<p><strong>Line 1: Indicates that the floating point value of label 0 is assigned to 69905.14159<\/strong><\/p>\n<p><strong>Line 3: Indicates converting the floating point value of label 0 into an int32 integer value<\/strong><\/p>\n<p><strong>And there is a position of DR10, and the decimal point will be removed.<\/strong><\/p>\n<p><strong>(ex. Tag 0 is 69905.141, then the DR10 content is 69905)<\/strong><\/p>\n<p><strong>Line 5: Indicates that the floating point value of label 0 will be converted into an int16 integer value.<\/strong><\/p>\n<p><strong>And there is a position of R12, the integer value exceeding int16 and the decimal point will be removed.<\/strong><\/p>\n<p><strong>(ex. Tag 0 is 69905.141, then R12 content is 4369)<\/strong><\/p>\n<p><strong><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-041.png\" \/><\/strong><\/p>\n<p><strong>Line 2: DR14 (INT32) is converted into a floating-point data type and stored in the label 0<\/strong><\/p>\n<p><strong>(The digital representation of observable floating point numbers is different from that of integers and can be used as Fun 200 I -&gt; F)<\/strong><\/p>\n<p><strong>EX:<\/strong><\/p>\n<p><strong><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-042.png\" \/><\/strong><\/p>\n<h4>3-7-4 Constant                                                                    <\/h4>\n<p>The table below shows the ST-supported constant types:<\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td>\n<p>Type<\/p>\n<\/td>\n<td>\n<p>Format andnd Sample<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>Bool (Bit)<\/p>\n<\/td>\n<td>\n<p>0, 1, TRUE, FALSE<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>M0:=1;<\/p>\n<p>M0:=TRUE;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>Integer<\/p>\n<\/td>\n<td>\n<p>Integer:<\/p>\n<p>    R0:=1;<\/p>\n<p>    R0:=-10;<\/p>\n<p>Binary:<\/p>\n<p>   2#  followed by the value of 0,1,<\/p>\n<p>       underscores can be used to divide groups<\/p>\n<p>    R0:=2#1111_0000;<\/p>\n<p>Octal:<\/p>\n<p>   8#  followed by the value,<\/p>\n<p>       underscores can be used to divide groups<\/p>\n<p>    R0:=8#243;<\/p>\n<p>Hexadecimal:<\/p>\n<p>   16#  followed by the value,<\/p>\n<p>        underscores can be used to divide groups<\/p>\n<p>    0x  followed by the value,<\/p>\n<p>        underscores can be used to divide groups<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>Scientific Tag<\/p>\n<\/td>\n<td>\n<p> Tag_FlR100:=1E3;            \/\/1000<\/p>\n<p> Tag_FlR100:=1.2E+3;        \/\/1200<\/p>\n<p> Tag_FlR100:=1E-3;          \/\/0.001<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>Unit Symbol<\/p>\n<\/td>\n<td>\n<p>G: 1e+9<\/p>\n<p>M: 1e+6<\/p>\n<p>K,k: 1e+3<\/p>\n<p>m: 1e-3 <\/p>\n<p>u: 1e-6<\/p>\n<p>n: 1e-9<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>DR0:=1G;<\/p>\n<p>R0:=1K;<\/p>\n<p>R0:=1k;<\/p>\n<p>DR0:=1M;<\/p>\n<p>Tag_FlR100:=1m;<\/p>\n<p>Tag_FlR100:=1n;<\/p>\n<p>Tag_FlR100:=1u;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>String<\/p>\n<p>(Currently only the Label command can be used)<\/p>\n<\/td>\n<td>\n<p>Use ASCII string quoted by\u201c symbol <\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>LBL ( &quot;my_lab&quot; )<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<h3>1-8  Using PLC Register and Memory<\/h3>\n<p>In addition to using the created Tag to call the corresponding register, users can also directly enter the name of the register to perform operations or flow control, as long as the data type of the register is single word 16bit &#8212;&gt; INT16 double word 32bit &#8212;&gt; INT32<\/p>\n<p>EX:<\/p>\n<p>      R29:=100;<\/p>\n<p>V:=19; \/\/ index register<\/p>\n<p>R200:= R10V+100;\t\tR200=200<\/p>\n<p>Among them, the special T and C bits will only have the characteristics of bit or int according to the logic of the program<\/p>\n<p>EX:<\/p>\n<p>      \/\/\/ T1 indicates bit type<\/p>\n<p>      \/\/\/ whether timeout<\/p>\n<p> IF T1 THEN<\/p>\n<p> R10:=20;<\/p>\n<p>\/\/\/ T1 represents the value of current timer<\/p>\n<p>\/\/\/ is the integer of int16<\/p>\n<p>ELSEIF T1&gt;100 THEN<\/p>\n<p>R10:=30;<\/p>\n<p>END_IF<\/p>\n<p>\/\/\/At this time, T1 will be regarded as a Bit type for negation<\/p>\n<p>M0:=NOT T1;<\/p>\n<h3>1-9 Calling System Built-In Functions<\/h3>\n<p>The description of the built-in functions will be shown as below:<\/p>\n<p><em>&lt;Function&gt; (  &lt;Parameter 1&gt; := &lt;Input Parameter 1&gt; ,  \u2026.);<\/em><\/p>\n<p>Like the ladder diagram, ST has some built-in functions for users to call, which will appear in the toolbox column on the right.<\/p>\n<p>You can drag and drop from the toolbox or double-click the field and it will be added to the text.<\/p>\n<p>When calling, the order of parameters can be changed at will, but it cannot be omitted.<\/p>\n<p>Unless some special values are allowed to be omitted<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-043.png\" \/><\/p>\n<p>Some of the functions will be divided into 32 bit mode (the default is 16 bit mode), you will need to add D_ in front of the function to clearly indicate that the function is in 32 bit mode. You can directly input D_ and the corresponding will appear the list of hints indicates those with 32 bit mode.<\/p>\n<p><strong>EX:<\/strong> <strong>Binary code conversion to Gray code      <\/strong><\/p>\n<p><strong>Error conversion                          Correct conversion  <\/strong><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-044.png\" \/> <img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-045.png\" \/> <\/p>\n<p>Most functions are executed as soon as they are called. If you want to execute the action only once after the condition is met, please refer to the writing method.<\/p>\n<p>EX:<\/p>\n<p>IF R_TRIG( S:=&quot;condition&quot; ) then<\/p>\n<p>&quot;Function&quot;<\/p>\n<p>END_IF<\/p>\n<p>!Note! The &quot;Motion Basic&quot;.&quot;Motion Mode1&quot;. &quot;Motion Mode2&quot;. &quot;Motion Mode3&quot; functions in the toolbox are only executed once unless the conditional state changes.<\/p>\n<p>For the detailed parameter content of each call function, please refer to FUN file. The following is an introduction for different FUN.<\/p>\n<h4>3-9-1\tTimer                                                                       <\/h4>\n<p>Prototype:<\/p>\n<p>Timer( \tTrigger:=  (* Trigger Bit Rising Edge -&gt;ON, Falling Edge -&gt;OFF *), <\/p>\n<p>T:=        (* Timer 0~1023 *), <\/p>\n<p>PV:=       (* preset value (0~32767) *), <\/p>\n<p>IsTimeout=&gt;\t (* time out bit *));<\/p>\n<p>      Parameter:<\/p>\n<p>  Trigger     (bool)        :  Rising Edge  Start Timer<\/p>\n<p>                         Falling Edge  Stop run<\/p>\n<p>        T         (int)         :  Integer from 0~1023 represent Timer T0~T1023<\/p>\n<p>     PV        (int)         \t:  Timer threshold<\/p>\n<p>        IsTimeout (bool)        :  Whether Timer reaches the target<\/p>\n<p>For detailed description, please refer to corresponding LD Timer files.<\/p>\n<h4>3-9-2\tCounter \/ Counter_L                                                         <\/h4>\n<p>There are two groups of Counter functions here, so that users can easily distinguish whether they are currently calling the counter of single word (Counter) or the version of double words (Counter_L)<\/p>\n<p>Prototype:<\/p>\n<p>Counter( Pulse:= (* Pulse Signal *), <\/p>\n<p>Clr:= (* CLR Signal *), <\/p>\n<p>C:= (* counter number (0~1023) *), <\/p>\n<p>PV:= (* Preset value (Single Word 0~65535) *), <\/p>\n<p>IsUp=&gt; (* Counter Is Up *));<\/p>\n<p>Counter_L( Pulse:= (* Pulse Signal *), <\/p>\n<p>Clr:= (* CLR Signal *), <\/p>\n<p>C:= (* counter number (1024~1279 Long counter) *), <\/p>\n<p>PV:= (* Preset value (Double Words) *), <\/p>\n<p>IsUp=&gt; (* Counter Is Up *));<\/p>\n<p>Parameter:<\/p>\n<p>  Pulse      (bool)         :  Off-&gt;On  Count once\t\t\t\/\/M0,M9129\u2026etc<\/p>\n<p>       Clr        (bool)         :  Whether to clear counter<\/p>\n<p>     C         (int)           :  Counter id 0~1279 <\/p>\n<p>       PV        (int)           :  Counter  Default value<\/p>\n<p>  IsUp             (bool)          :  Whether Counter reaches the target  \/\/M0,C0\u2026etc<\/p>\n<h4>3-9-3\tR_TRIG \/ F_TRIG                                                             <\/h4>\n<p>Rising Edge and Falling Edge\u2019s  detecting function<\/p>\n<p>Prototype:<\/p>\n<p>      Mode 1:\t\t<\/p>\n<p>R_TRIG( S:= , D=&gt; )<\/p>\n<p>F_TRIG( S:= , D=&gt; )<\/p>\n<p>Mode 2:<\/p>\n<p>R_TRIG( S:= )<\/p>\n<p>F_TRIG( S:= )<\/p>\n<p>     Implied with Return Value D<\/p>\n<p>Parameter:<\/p>\n<p>            S   (bool)    :  Rising \/ Falling Edge  Detecting source<\/p>\n<p>            D   (bool)   :   Detecting result<\/p>\n<p>Example: <\/p>\n<p>       Mode 1:  R_TRIG(S:=M0, D:=M5);<\/p>\n<p>       Mode 2: <\/p>\n<p>                      IF R_TRIG(S:=M0) THEN<\/p>\n<p>                            ++R100;<\/p>\n<p>                      END_IF<\/p>\n<h4>3-9-4\tTARESUB and TAREZEOFFSET                                                         <\/h4>\n<p>These two functions are derived from the original FUN258. Removed from Tare Weight Deduction Command mode .<\/p>\n<p>For detailed parameter settings from MODCONF, please refer to the original FUN258 file.<\/p>\n<p>Splitting into two independent functions is also a function that is convenient for users to call at a glance when writing.<\/p>\n<p>Prototype<\/p>\n<p>TAREZEOFFSET( EN:= , MD:= , ID:= , CH:= , WR:= , ERR=&gt; , DN=&gt; )<\/p>\n<p>TARESUB( EN:= , RST:= , ID:= , CH:= , SB:= , ERR=&gt; )<\/p>\n<h3>1-10 Functions with multiple calling modes<\/h3>\n<p>Such as the trigger detection instructions in the previous chapter 3-9-3. These instructions support two types, one is a direct complete call, and the other is to omit the register location (D) where the result is stored. The following table is is a function that currently has this feature.<\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td>\n<p>Function<\/p>\n<\/td>\n<td>\n<p>Parameter specialized in Return<\/p>\n<\/td>\n<td>\n<p>Function Format<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>FSQR<\/p>\n<\/td>\n<td>\n<p>D<\/p>\n<\/td>\n<td>\n<p>FSQR(S:= ,D:= )<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>FSIN<\/p>\n<\/td>\n<td>\n<p>D<\/p>\n<\/td>\n<td>\n<p>FSIN(S:= ,D:= )<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>FCOS<\/p>\n<\/td>\n<td>\n<p>D<\/p>\n<\/td>\n<td>\n<p>FCOS(S:= ,D:= )<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>FTAN<\/p>\n<\/td>\n<td>\n<p>D<\/p>\n<\/td>\n<td>\n<p>FTAN(S:= ,D:= )<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>FASIN<\/p>\n<\/td>\n<td>\n<p>D<\/p>\n<\/td>\n<td>\n<p>FASIN(S:= ,D:= ,MD:= )<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>FACOS<\/p>\n<\/td>\n<td>\n<p>D<\/p>\n<\/td>\n<td>\n<p>FACOS(S:= ,D:= ,MD:= )<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>R_TRIG<\/p>\n<\/td>\n<td>\n<p>D<\/p>\n<\/td>\n<td>\n<p>R_TRIG(S:= ,D:= )<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>F_TRIG<\/p>\n<\/td>\n<td>\n<p>D<\/p>\n<\/td>\n<td>\n<p>F_TRIG(S:= ,D:= )<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>ItoF<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>D<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>ItoF(S:= ,D:= )<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>FtoI<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>D<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>FtoI(S:= ,D:= )<\/strong><\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>That is to say, the parameters of the above-mentioned functions with return characteristics can be omitted when calling again, and directly use another parameter to undertake or directly operate.<\/p>\n<p>EX:<\/p>\n<p>Without omission:<\/p>\n<p>FSIN(S:=Tag_Float_DR100, D:=Tag_Float_DR102);<\/p>\n<p>Omit the return parameter: (Since values \u200b\u200band representative results are returned, some four arithmetic operations or conditional judgments can be directly introduced)<\/p>\n<p>Tag_Float_DR200 := FSIN(S:=Tag_Float_DR100) + FSIN(S:=Tag_Float_DR102);<\/p>\n<h3>1-11 Multi-cycle instruction<\/h3>\n<p>The following instruction list shows the instructions operating continuously in the background. The way to use it is to place it outside the IF loop to execute it every scan cycle, and determine the operating state of the function according to the EN signal.<\/p>\n<p>As the example shown below:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-046.png\" \/><\/p>\n<p>Because these instruction classes are called, the execution time usually exceeds one scan cycle.<\/p>\n<p>The following table shows the Multi-cycle instruction currently included:<\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td>\n<p><strong>Function<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>Function ID<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>LCNV<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>33<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>MLC<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>34<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>TPCTL2<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>99<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>RAMP2<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>98<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>HSPWM<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>139<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>HSPSO<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>140<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>MPARA<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>141<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>PSOFF<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>142<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>PSCNV<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>143<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>MPG<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>148<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>ModBUS<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>150<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>CLINK<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>151<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>ReadWriteFileReg<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>160<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>WriteSDMem<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>161<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>ReadSDMem<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>162<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>PID2<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>38<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>DBUF<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>115<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>ICA<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>137<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>ICF<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>138<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>NCR<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>152<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>CMCTL<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>156<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>ME_START<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>176<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>ME_SYSSTOP<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>177<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>ME_HOME<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>178<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>ME_POS<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>179<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>ME_JOG<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>180<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>ME_CHGPRM<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>181<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>ME_PAUSE<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>182<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>ME_RESUME<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>183<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>ME_HALT<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>184<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>ME_RSTALM<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>185<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>ME_STOP<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>186<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>ME_SYSINIT<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>187<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>ME_RCPR<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>188<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>ME_RCPW<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>189<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>ME_CAMR<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>191<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>ME_CAMW<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>192<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>ME_GEAR_IN<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>193<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>ME_VEL_CTL<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>194<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>ME_TOR_CTL<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>195<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>ME_CAM_GEN<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>196<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>ME_AXI_MOV<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>197<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>ME_SET_MAP<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>198<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>ME_VIR_AXI<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>235<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>HSPWM2<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>144<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>TARESUB<\/strong><\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>TAREZEOFFSET<\/strong><\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<\/table>\n<\/div>\n<h3>1-12 Enable\/Disable Interrupt and Special Instructions<\/h3>\n<p>Please refer to FUN 145, 146<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-047.png\" \/><\/p>\n<p>LB parameters input integers from 1 to 49, corresponding to the types of interrupts.<\/p>\n<p>For all supported types, please refer to the chapter of special instructions.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-048.png\" \/><\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td>\n<p><strong>INT No.<\/strong><\/p>\n<p><strong>UserView<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>Interrupt Source<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>Priority<\/strong><\/p>\n<p><strong>\u3000<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>Interrupt Label<\/strong><\/p>\n<p><strong>\u3000<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>Condition<\/strong><\/p>\n<p><strong>\u3000<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>Note<\/strong><\/p>\n<p><strong>\u3000<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>1<\/p>\n<\/td>\n<td>\n<p>Build-in Digital Inputs<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X0+I (INT0+)<\/p>\n<\/td>\n<td>\n<p>X0 positive edge trigger<\/p>\n<\/td>\n<td rowspan=\"16\">\n<p>The software high speed counter HSC4~HSC7 can be assigned as the trigger source of any interrupt X0~X15. Therefore, the<\/p>\n<p>interrupt priority of the<\/p>\n<p>software high speed<\/p>\n<p>counter depends on<\/p>\n<p>the priority of X0~X15.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>2<\/p>\n<\/td>\n<td><\/td>\n<td><\/td>\n<td>\n<p>X0\u2212I (INT0-)<\/p>\n<\/td>\n<td>\n<p>X0 negative edge trigger<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>3<\/p>\n<\/td>\n<td><\/td>\n<td><\/td>\n<td>\n<p>X1+I (INT1+)<\/p>\n<\/td>\n<td>\n<p>X1 positive edge trigger<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>4<\/p>\n<\/td>\n<td><\/td>\n<td><\/td>\n<td>\n<p>X1\u2212I (INT1-)<\/p>\n<\/td>\n<td>\n<p>X1 negative edge trigger<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>5<\/p>\n<\/td>\n<td><\/td>\n<td><\/td>\n<td>\n<p>X2+I (INT2+)<\/p>\n<\/td>\n<td>\n<p>X2 positive edge trigger<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>6<\/p>\n<\/td>\n<td><\/td>\n<td><\/td>\n<td>\n<p>X2\u2212I (INT2-)<\/p>\n<\/td>\n<td>\n<p>X2 negative edge trigger<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>7<\/p>\n<\/td>\n<td><\/td>\n<td><\/td>\n<td>\n<p>X3+I (INT3+)<\/p>\n<\/td>\n<td>\n<p>X3 positive edge trigger<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>8<\/p>\n<\/td>\n<td><\/td>\n<td><\/td>\n<td>\n<p>X3\u2212I (INT3-)<\/p>\n<\/td>\n<td>\n<p>X3 negative edge trigger<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>9<\/p>\n<\/td>\n<td><\/td>\n<td><\/td>\n<td>\n<p>X4+I (INT4+)<\/p>\n<\/td>\n<td>\n<p>X4 positive edge trigger<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>10<\/p>\n<\/td>\n<td><\/td>\n<td><\/td>\n<td>\n<p>X4\u2212I (INT4-)<\/p>\n<\/td>\n<td>\n<p>X4 negative edge trigger<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>11<\/p>\n<\/td>\n<td><\/td>\n<td><\/td>\n<td>\n<p>X5+I (INT5+)<\/p>\n<\/td>\n<td>\n<p>X5 positive edge trigger<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>12<\/p>\n<\/td>\n<td><\/td>\n<td><\/td>\n<td>\n<p>X5\u2212I (INT5-)<\/p>\n<\/td>\n<td>\n<p>X5 negative edge trigger<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>13<\/p>\n<\/td>\n<td><\/td>\n<td><\/td>\n<td>\n<p>X6+I (INT6+)<\/p>\n<\/td>\n<td>\n<p>X6 positive edge trigger<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>14<\/p>\n<\/td>\n<td><\/td>\n<td><\/td>\n<td>\n<p>X6\u2212I (INT6-)<\/p>\n<\/td>\n<td>\n<p>X6 negative edge trigger<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>15<\/p>\n<\/td>\n<td><\/td>\n<td><\/td>\n<td>\n<p>X7+I (INT7+)<\/p>\n<\/td>\n<td>\n<p>X7 positive edge trigger<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>16<\/p>\n<\/td>\n<td><\/td>\n<td><\/td>\n<td>\n<p>X7\u2212I (INT7-)<\/p>\n<\/td>\n<td>\n<p>X7 negative edge trigger<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>17<\/p>\n<\/td>\n<td rowspan=\"8\">\n<p>Hardware Time Tick<\/p>\n<\/td>\n<td>\n<p>3<\/p>\n<\/td>\n<td>\n<p>STM0I<\/p>\n<\/td>\n<td>\n<p>Interval from 1ms~60000ms<\/p>\n<\/td>\n<td>\n<p>Tick unit 1ms\uff0cValue=1~60000<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>18<\/p>\n<\/td>\n<td>\n<p>3<\/p>\n<\/td>\n<td>\n<p>STM1I<\/p>\n<\/td>\n<td>\n<p>Interval from 1ms~60000ms<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>19<\/p>\n<\/td>\n<td>\n<p>3<\/p>\n<\/td>\n<td>\n<p>STM2I<\/p>\n<\/td>\n<td>\n<p>Interval from 1ms~60000ms<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>20<\/p>\n<\/td>\n<td>\n<p>3<\/p>\n<\/td>\n<td>\n<p>STM3I<\/p>\n<\/td>\n<td>\n<p>Interval from 1ms~60000ms<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>21<\/p>\n<\/td>\n<td>\n<p>3<\/p>\n<\/td>\n<td>\n<p>LTM0I<\/p>\n<\/td>\n<td>\n<p>Interval from 10ms~60000ms<\/p>\n<\/td>\n<td>\n<p>Tick unit 10ms\uff0cValue=1~6000<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>22<\/p>\n<\/td>\n<td>\n<p>3<\/p>\n<\/td>\n<td>\n<p>LTM1I<\/p>\n<\/td>\n<td>\n<p>Interval from 10ms~60000ms<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>23<\/p>\n<\/td>\n<td>\n<p>3<\/p>\n<\/td>\n<td>\n<p>LTM2I<\/p>\n<\/td>\n<td>\n<p>Interval from 10ms~60000ms<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>24<\/p>\n<\/td>\n<td>\n<p>3<\/p>\n<\/td>\n<td>\n<p>LTM3I<\/p>\n<\/td>\n<td>\n<p>Interval from 10ms~60000ms<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>25<\/p>\n<\/td>\n<td rowspan=\"4\">\n<p>HST<\/p>\n<\/td>\n<td>\n<p>1<\/p>\n<\/td>\n<td>\n<p>HST0I<\/p>\n<\/td>\n<td>\n<p>Interval from 0.1ms to 6000ms<\/p>\n<\/td>\n<td>\n<p>Tick uint 100us\uff0cValue=1~60000<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>26<\/p>\n<\/td>\n<td>\n<p>1<\/p>\n<\/td>\n<td>\n<p>HST1I<\/p>\n<\/td>\n<td>\n<p>Interval from\u00a00.1ms to 6000ms<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>27<\/p>\n<\/td>\n<td>\n<p>1<\/p>\n<\/td>\n<td>\n<p>HST2I<\/p>\n<\/td>\n<td>\n<p>Interval from\u00a00.1ms to 6000ms<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>28<\/p>\n<\/td>\n<td>\n<p>1<\/p>\n<\/td>\n<td>\n<p>HST3I<\/p>\n<\/td>\n<td>\n<p>Interval from\u00a00.1ms to 6000ms<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>33<\/p>\n<\/td>\n<td rowspan=\"8\">\n<p>HSC<\/p>\n<\/td>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>HSC0I<\/p>\n<\/td>\n<td>\n<p>Interval from HSC0 to (CV=PV)<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>34<\/p>\n<\/td>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>HSC1I<\/p>\n<\/td>\n<td>\n<p>Interval from HSC1 to (CV=PV)<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>35<\/p>\n<\/td>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>HSC2I<\/p>\n<\/td>\n<td>\n<p>Interval from HSC2 to (CV=PV)<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>36<\/p>\n<\/td>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>HSC3I<\/p>\n<\/td>\n<td>\n<p>Interval from HSC3 to (CV=PV)<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>37<\/p>\n<\/td>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>HSC4I<\/p>\n<\/td>\n<td>\n<p>Interval from HSC4 to (CV=PV)<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>38<\/p>\n<\/td>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>HSC5I<\/p>\n<\/td>\n<td>\n<p>Interval from HSC5 to (CV=PV)<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>39<\/p>\n<\/td>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>HSC6I<\/p>\n<\/td>\n<td>\n<p>Interval from HSC6 to (CV=PV)<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>40<\/p>\n<\/td>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>HSC7I<\/p>\n<\/td>\n<td>\n<p>Interval from HSC7 to (CV=PV)<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\n<p>66<\/p>\n<\/td>\n<td rowspan=\"16\">\n<p>Build-in Digital Inputs (MA Series)<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X8+I (INT8+)<\/p>\n<\/td>\n<td>\n<p>X8 positive edge trigger<\/p>\n<\/td>\n<td rowspan=\"32\">\n<p>The software high speed counter HSC4~HSC7 can be assigned as the trigger source of any interrupt X0~X15. Therefore, the<\/p>\n<p>interrupt priority of the<\/p>\n<p>software high speed<\/p>\n<p>counter depends on<\/p>\n<p>the priority of X0~X15.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>67<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X8\u2212I (INT8-)<\/p>\n<\/td>\n<td>\n<p>X8 negative edge trigger<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>68<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X9+I (INT9+)<\/p>\n<\/td>\n<td>\n<p>X9 positive edge trigger<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>69<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X9\u2212I (INT9-)<\/p>\n<\/td>\n<td>\n<p>X9 negative edge trigger<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>70<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X10+I (INT10+)<\/p>\n<\/td>\n<td>\n<p>X10 positive edge trigger<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>71<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X10\u2212I (INT10-)<\/p>\n<\/td>\n<td>\n<p>X10 negative edge trigger<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>72<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X11+I (INT11+)<\/p>\n<\/td>\n<td>\n<p>X11 positive edge trigger<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>73<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X11\u2212I (INT11-)<\/p>\n<\/td>\n<td>\n<p>X11 negative edge trigger<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>74<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X12+I (INT12+)<\/p>\n<\/td>\n<td>\n<p>X12 positive edge trigger<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>75<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X12\u2212I (INT12-)<\/p>\n<\/td>\n<td>\n<p>X12 negative edge trigger<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>76<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X13+I (INT13+)<\/p>\n<\/td>\n<td>\n<p>X13 positive edge trigger<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>77<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X13\u2212I (INT13-)<\/p>\n<\/td>\n<td>\n<p>X13 negative edge trigger<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>78<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X14+I (INT14+)<\/p>\n<\/td>\n<td>\n<p>X14 positive edge trigger<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>79<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X14\u2212I (INT14-)<\/p>\n<\/td>\n<td>\n<p>X14 negative edge trigger<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>80<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X15+I (INT15+)<\/p>\n<\/td>\n<td>\n<p>X15 positive edge trigger<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>81<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X15\u2212I (INT15-)<\/p>\n<\/td>\n<td>\n<p>X15 negative edge trigger<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>82<\/p>\n<\/td>\n<td rowspan=\"16\">\n<p>MQ model DI Plug-in<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X16+I (INT15+)<\/p>\n<\/td>\n<td>\n<p>X16\u4e0a\u6cbf\u89f8\u767c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>83<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X16\u2212I (INT15-)<\/p>\n<\/td>\n<td>\n<p>X16 \u4e0b\u6cbf\u89f8\u767c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>84<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X17+I (INT15+)<\/p>\n<\/td>\n<td>\n<p>X17\u4e0a\u6cbf\u89f8\u767c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>85<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X17\u2212I (INT15-)<\/p>\n<\/td>\n<td>\n<p>X17 \u4e0b\u6cbf\u89f8\u767c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>86<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X18+I (INT15+)<\/p>\n<\/td>\n<td>\n<p>X18\u4e0a\u6cbf\u89f8\u767c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>87<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X18\u2212I (INT15-)<\/p>\n<\/td>\n<td>\n<p>X18 \u4e0b\u6cbf\u89f8\u767c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>88<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X19+I (INT15+)<\/p>\n<\/td>\n<td>\n<p>X19\u4e0a\u6cbf\u89f8\u767c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>89<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X19\u2212I (INT15-)<\/p>\n<\/td>\n<td>\n<p>X19 \u4e0b\u6cbf\u89f8\u767c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>90<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X20+I (INT15+)<\/p>\n<\/td>\n<td>\n<p>X20\u4e0a\u6cbf\u89f8\u767c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>91<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X20\u2212I (INT15-)<\/p>\n<\/td>\n<td>\n<p>X20\u4e0b\u6cbf\u89f8\u767c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>92<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X21+I (INT15+)<\/p>\n<\/td>\n<td>\n<p>X21\u4e0a\u6cbf\u89f8\u767c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>93<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X21\u2212I (INT15-)<\/p>\n<\/td>\n<td>\n<p>X21\u4e0b\u6cbf\u89f8\u767c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>94<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X22+I (INT15+)<\/p>\n<\/td>\n<td>\n<p>X22\u4e0a\u6cbf\u89f8\u767c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>95<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X22\u2212I (INT15-)<\/p>\n<\/td>\n<td>\n<p>X22 \u4e0b\u6cbf\u89f8\u767c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>96<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X23+I (INT15+)<\/p>\n<\/td>\n<td>\n<p>X23\u4e0a\u6cbf\u89f8\u767c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>97<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X23\u2212I (INT15-)<\/p>\n<\/td>\n<td>\n<p>X23 \u4e0b\u6cbf\u89f8\u767c<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<h3>1-13 Variable names with special meanings<\/h3>\n<ol>\n<li><strong>Timer, Counter<br \/>   T0~TN,  C0~CN<\/strong><\/li>\n<\/ol>\n<p><strong>In the ST environment, these two variables are given the characteristics of Bool and the characteristics of Integer.     <\/strong><\/p>\n<p><strong>  EX:<\/strong><\/p>\n<p><strong>            R0:=T1;  <\/strong><\/p>\n<p><strong>\/\/The currently calculated value of Timer1 will be stored in R0(Integer)<\/strong><\/p>\n<p><strong>M0:=T1; <\/strong><\/p>\n<p><strong>\/\/ Will save the status of whether Timer1 is currently running to M0 (Bool)<\/strong><\/p>\n<p><strong>M3:=C1&gt;10; <\/strong><\/p>\n<p><strong>\/\/ Will determine whether Counter 1 counts more than 10<\/strong><\/p>\n<p><strong>             IF R_TRIG( T1 ) THEN<\/strong><\/p>\n<p><strong>\/\/\/ When Timer1 changes from 0 to 1 (the moment it starts running), it will be executed\t\t\t\t\t\t\t<\/strong><\/p>\n<p><strong>END_IF<\/strong><\/p>\n<ol>\n<li><strong>Interrupt (Enum)<br \/>   <\/strong>Originally, only constants could be input for Enable\/Disable interrupts. In order to improve the readability of the program, it was modified to allow the input of system default Enum parameters. If you type INT_, the corresponding series of available Enums will be displayed<strong>.<br \/>       <\/strong><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-049.png\" \/><\/li>\n<\/ol>\n<p><strong>       EX:<\/strong><\/p>\n<p><strong>IF M2 THEN<\/strong><\/p>\n<p><strong>    INTEnable( LB:= INT_STM1I);<\/strong><\/p>\n<p><strong>ELSE<\/strong><\/p>\n<p><strong>    INTDisable( LB:= INT_STM1I);<\/strong><\/p>\n<p><strong>END_IF<\/strong><\/p>\n<ol>\n<li><strong>High-speed counting Enum \u201cHSC_\u201d Prefix<\/strong><\/li>\n<\/ol>\n<p><strong> Call related high-speed instructions such as<\/strong><\/p>\n<p><strong> HSCTR( CN:= (* 0~7 *));<\/strong><\/p>\n<p><strong> HSCTW( S:= , CN:= , D:= );;<\/strong><\/p>\n<p>Among them, the parameter expressions of CN, and D support constant integers. For the convenience of reading, Enum starting with HSC_ is also imported.<\/p>\n<p><strong>   <img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-050.png\" \/><\/strong><\/p>\n<p><strong>   Make programs more readable<\/strong><\/p>\n<p><strong>   EX:<\/strong><\/p>\n<p><strong>            HSCTR( CN:= HSC_HSC0(* 0~7 *));<\/strong><\/p>\n<p><strong>            HSCTW( S:=R0 , CN:=HSC_HSC0 , D:=HSC_PV );<\/strong><\/p>\n<ol>\n<li><strong>File Register Enum  F0~F32767<br \/>   For the Sb parameter of FUN 160, in addition to using 0~32767, you can use the Enum of F0~F32767 to represent the corresponding position.<\/strong><\/li>\n<\/ol>\n<p><strong>   EX:<\/strong><\/p>\n<p><strong>   <\/strong><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-051.png\" \/><\/p>\n<h3>1-14 Calling FCM Function<\/h3>\n<p>The calling method is similar to calling system function, while the functions are built by users themselves.<\/p>\n<p>The built functions will be placed in FCM List in the command column on the left.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-052.png\" \/><\/p>\n<p>Users can double-click the section to insert the selected function to the text.<\/p>\n<p>FCM can specify a Return Value, which can be call directly when programming.<\/p>\n<p>EX:<\/p>\n<p>FCM: <\/p>\n<p><strong>   <img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-053.png\" \/><\/strong><\/p>\n<p>Calling side:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m05-en-03\/mplc-m05-en-03-054.png\" \/><\/p>\n<p>In this way, some temporarily unnecessary variable declarations can be reduced in a timely manner.<\/p>\n<h3>1-15 Function notes<\/h3>\n<p>Whether it is built-in call system or FCM, they all have the following common characteristics:<\/p>\n<p><strong>A. Calling method:<\/strong><\/p>\n<p><strong>    1. Enter the complete parameter name<\/strong><\/p>\n<p><strong>    2. Omit parameter names<\/strong><\/p>\n<p><strong>    3. Output parameters (=&gt;) can be directly ignored and not passed.<\/strong><\/p>\n<p><strong>       example:<\/strong><\/p>\n<p><strong>       Take the R_TRIG function as an example<\/strong><\/p>\n<p><strong>       Complete performance: R_TRIG( S:= M0, D=&gt;M1);<\/strong><\/p>\n<p>If you use parameters to bring it in, it is not allowed to follow the preset order.<\/p>\n<p>                  The above function can be changed to<\/p>\n<p><strong>                  R_TRIG( D=&gt;M1, S:= M0 );<\/strong><\/p>\n<p><strong>                  R_TRIG( D=&gt;M1);<\/strong><\/p>\n<p><strong>                  All are legal inputs<\/strong><\/p>\n<p><strong>       Omit parameter name: R_TRIG(M0, M1);<\/strong><\/p>\n<p><strong>       Those with Return effect or output do not need to be passed :<\/strong><\/p>\n<p><strong>                   R_TRIG( S:= M0 );<\/strong><\/p>\n<p><strong>                   R_TRIG( M0 );<\/strong><\/p>\n<p><strong> <\/strong>Those with the Return attribute can be mixed with other variables or descriptive sentences.<\/p>\n<p><strong>                   IF R_TRIG(M0) THEN<\/strong><\/p>\n<p><strong>                     \/\/\/\/ some statements<\/strong><\/p>\n<p><strong>                   END_IF<\/strong><\/p>\n<p><strong>                   M10:= R_TRIG(M0) AND R_TRIG(M1);<\/strong><\/p>\n<p><strong>         <br \/>! Note! Calling methods with parameters and without parameters cannot be mixed. For example:<\/strong><\/p>\n<p><strong>                R_TRIG(S:=M0, M1);<\/strong><\/p>\n<p><strong>                R_TRIG(M1,D:=M2);<\/strong><\/p>\n<p><strong>                Both of the above are illegal inputs.               <\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1-10 Introduction This chapter will explain the methods [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[49],"tags":[],"class_list":["post-3243","post","type-post","status-publish","format-standard","hentry","category-en-mplc-m05"],"_links":{"self":[{"href":"https:\/\/resource.fatek.com\/index.php\/wp-json\/wp\/v2\/posts\/3243","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/resource.fatek.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/resource.fatek.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/resource.fatek.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/resource.fatek.com\/index.php\/wp-json\/wp\/v2\/comments?post=3243"}],"version-history":[{"count":0,"href":"https:\/\/resource.fatek.com\/index.php\/wp-json\/wp\/v2\/posts\/3243\/revisions"}],"wp:attachment":[{"href":"https:\/\/resource.fatek.com\/index.php\/wp-json\/wp\/v2\/media?parent=3243"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/resource.fatek.com\/index.php\/wp-json\/wp\/v2\/categories?post=3243"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/resource.fatek.com\/index.php\/wp-json\/wp\/v2\/tags?post=3243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}