这个与加减乘除有多少没有关系,是您的计算表达式写入错误。对于您期待的结果,正确的galil表达式应该是
pTSCTMP2=(pTSCSX-((pTSCNS-1-pTSCCL)*pTSCTSP))*pRESX
至于说明书的哪里会提到,不同版本的手册可能有一点差异:
在指令手册关于括号()的说明:
Remarks
Note that the controller evaluates expressions from left to right, and does not follow academic algebraic standards (e.g. multiplication and division first, followed by addition or subtraction )
It is required to use parentheticals to ensure intended mathematical precedence
在指令手册里关于乘号*、除号/、加号+的说明
Remarks
This is a binary operator ( takes two arguments and returns one value ). The result of this operation is a value, which is not valid on its own. It must be coupled with a command. See examples below.
Mathmatical operations are calculated left to right rather than multiplication and division calculations performed prior to addition and subraction.
Example: 1+2*3 = 9;' not 7
It is recommended that parenthesis be used when more than one mathmatical operation is combined in one command.
Example: var = ((10*30)+(60/30));' evaluates as 302
var = 10*30+60/30;' evalutes as 12
在产品手册的 Mathematical and Functional Expressions 算术和函数表达式一节中,也写了
Mathematical operations are executed from left to right. Calculations within parentheses have precedence.
Examples:
speed = 7.5*V1/2 The variable, speed, is equal to 7.5 multiplied by V1 and divided by 2
count = count+2 The variable, count, is equal to the current value plus 2.
result =_TPX-(@COS[45]*40) Puts the position of X - 28.28 in result. 40 * cosine of 45 is 28.28