发布于 2011-10-20 13:18:37
2楼
谢谢了,问题得到解决了,
再请问个问题啊,我用ST编写了一个小程序,就是控制轴动,但是怎么都编译不过去,出现错误码6003,能帮忙看下嘛
INTERFACE
USEPACKAGE CAM;
VAR_GLOBAL
SetBit1:BOOL:=0;
SetBit2:BOOL:=0;
SetBit3:BOOL:=0;
Var1:WORD:=0;
Var2:WORD:=0;
Var3:WORD:=0;
Var4:WORD:=0;
Var5:WORD:=0;
END_VAR
PROGRAM bg;
PROGRAM Speed_specification;
PROGRAM fault;
PROGRAM stop;
PROGRAM position;
END_INTERFACE
IMPLEMENTATION
PROGRAM bg
VAR
_myRetDWORD:DWORD;
END_VAR
IF SetBit1=1 THEN
_myRetDWORD :=_restarttaskid(_gettaskid(MotionTask_1));
ELSE
IF
SetBit2=1 THEN
_myRetDWORD :=_restarttaskid(_gettaskid(MotionTask_2 ));
ELSE
IF SetBit3=1 THEN
_myRetDWORD := _restarttaskid(_gettaskid(MotionTask_3 ));
ELSE
;
END_IF;
END_IF;
END_IF;
END_PROGRAM
PROGRAM Speed_specification
VAR
_myRetDINT : DINT;
END_VAR;
Var1:=15;
SetBit1:=0;
_myRetDINT :=_enableaxis(axis :=_to.Axis_1,enablemode := ALL,servocontrolmode := ACTIVE
,servocommandToActualMode := INACTIVE,nextcommand:=WHEN_COMMAND_DONE,
commandid :=_getcommandid() ,forcecontrolmode := INACTIVE);
_myRetDINT :=
_move(
axis:=_to.Axis_1
,direction :=POSTIVE
,velocitytype := DIRECT
,velocity := 100.0
,movetimeouttype := WITHOUT_TIME_LIMIT
// ,positiveacceltype := USER_DEFAULT
// ,positiveaccel := 100.0
// ,negativeacceltype := USER_DEFAULT
// ,negativeaccel := 100.0
// ,positiveaccelstartjerktype := USER_DEFAULT
// ,positiveaccelstartjerk := 100.0
// ,positiveaccelendjerktype := USER_DEFAULT
// ,positiveaccelendjerk := 100.0
// ,negativeaccelstartjerktype := USER_DEFAULT
// ,negativeaccelstartjerk := 100.0
// ,negativeaccelendjerktype := USER_DEFAULT
// ,negativeaccelendjerk := 100.0
// ,velocityprofile := USER_DEFAULT
,mergemode :=IMMEDIATELY
,nextcommand := AT_MOTION_START
,commandid :=_getcommandid()
,movingmode := SPEED_CONTROLLED
);
END_PROGRAM
PROGRAM position
VAR
myRetDINT:DINT;
END_VAR;
SetBit2:=0;
myRetDINT :=_enableaxis(axis :=_to.Axis_1,enablemode := ALL,servocontrolmode := ACTIVE
,servocommandToActualMode := INACTIVE,nextcommand:=WHEN_COMMAND_DONE,
commandid :=_getcommandid() ,forcecontrolmode := INACTIVE);
myRetDINT :=
_pos(
axis :=_to.Axis_1
,direction :=POSTIVE
,positioningmode :=RELATIVE
,position := 360
,velocitytype := DIRECT
,velocity := 100.0
// ,positiveacceltype := USER_DEFAULT
// ,positiveaccel := 100.0
// ,negativeacceltype := USER_DEFAULT
// ,negativeaccel := 100.0
// ,positiveaccelstartjerktype := USER_DEFAULT
// ,positiveaccelstartjerk := 100.0
// ,positiveaccelendjerktype := USER_DEFAULT
// ,positiveaccelendjerk := 100.0
// ,negativeaccelstartjerktype := USER_DEFAULT
// ,negativeaccelstartjerk := 100.0
// ,negativeaccelendjerktype := USER_DEFAULT
// ,negativeaccelendjerk := 100.0
// ,velocityprofile := USER_DEFAULT
,blendingmode := INACTIVE
,mergemode := IMMEDIATELY
,nextcommand := WHEN_MOTION_DONE
,commandid :=_getcommandid()
);
myRetDINT :=
_disableaxis(
axis :=_to.Axis_1
,disablemode := ALL
,servocontrolmode := INACTIVE
,servocommandtoactualmode := ACTIVE,nextcommand:=WHEN_COMMAND_DONE
,commandid :=_getcommandid()
,forcecontrolmode := INACTIVE
// ,stwbitset := 0
);
END_PROGRAM
PROGRAM fault
;
END_PROGRAM
PROGRAM stop
VAR
myRetDINT:DINT;
END_VAR;
SetBit3:=0;
myRetDINT :=
_stop(
axis := _to.Axis_1
,stopmode := STOP_WITHOUT_ABORT
,stopspecification := ALL_AXIS_MOTION
,stopid :=_getcommandid()
// ,positiveacceltype := USER_DEFAULT
// ,positiveaccel := 100.0
// ,negativeacceltype := USER_DEFAULT
// ,negativeaccel := 100.0
// ,positiveaccelstartjerktype := USER_DEFAULT
// ,positiveaccelstartjerk := 100.0
// ,positiveaccelendjerktype := USER_DEFAULT
// ,positiveaccelendjerk := 100.0
// ,negativeaccelstartjerktype := USER_DEFAULT
// ,negativeaccelstartjerk := 100.0
// ,negativeaccelendjerktype := USER_DEFAULT
// ,negativeaccelendjerk := 100.0
// ,velocityprofile := USER_DEFAULT
,mergemode := IMMEDIATELY
,nextcommand :=WHEN_MOTION_DONE
,commandid :=_getcommandid()
,movingmode := CURRENT_MODE
);
myRetDINT :=
_disableaxis(
axis := _TO.Axis_1
,disablemode := ALL
,servocontrolmode := ACTIVE
,servocommandtoactualmode := ACTIVE
,nextcommand :=WHEN_COMMAND_DONE
,commandid :=_getcommandid()
,forcecontrolmode := INACTIVE
// ,stwbitset := 0
);
END_PROGRAM
END_IMPLEMENTATION
错误6003::Variable ID expected positive:(在 _myRetDINT :=
_move(
axis:=_to.Axis_1
,direction :=POSTIVE
,velocitytype := DIRECT
,velocity := 100.0
,movetimeouttype := WITHOUT_TIME_LIMIT
里的,velocitytype := DIRECT
)是什么意思啊,我一直编译不过去,是ST编程的,不明白啥意思呢,哪位大哥解答下啊