quote:以下是引用haha在2012-06-18 13:23:04的发言:
可以读出行号。每一个回车就算一行程序,通过PLC可以读出此行号。
还可以读出子程序号等。
des cription:
$P_LINENO[n]
Supplies the last programmed line number of program level n.
Example:
$P_LINENO[0]
Supplies the line number of the program on program level 0 = main program level.
PLC with NC-Var-Selector:
Area: C[.]
Data module: SPARP
Variable: actLineNumber[.]
Area number = Channel number
line = 1
系统变量测试:
DEF real _Abc
G4F1
G0G91X1
n9999
_Abc=$P_LINENO[0]
G4F1
G0G91X1
Y1
N1234Z1
m2
最后编程的段号,如果所有程序段无“N...",读出的是空的。
PLC with NC-Var-Selector:
Area: C[.]
Data module: SPARP
Variable: lastBlockNoStr[.]
Area number = Channel number
line = 1
试验:
系统变量
$P_BLOCKNO[n]
Supplies the last programmed block number of program level n.
Example:$P_BLOCKNO[0]
Supplies the modal block number of the program on program level 0 = main program name.
MD 10284 $MN_DISPLAY_FUNCTION_MASK Bit0 must be = 1.
Block numbers programmed during DISPLOF cannot be read with $P_BLOCKNO.
DEF STRING[10] _ASD
G4F1
G0G91X1
Y1
n9999 Z1
_ASD=$P_BLOCKNO[0]
G4F1
G0G91X1
Y1
N1234Z1
m2
