局部变量与全局变量相关的一个程序问题...在线等...
#define func_trigger I2 //定义I2为功能触发器#define Fbit0 I7
//#define Fbit1 I12
#define Fbit2 I5
proc P_unitTransfer(float *P) do
......
proc V_unitTransfer(float *V) do
......
proc A_unitTransfer(float *A) do
......
proc move(float Posi,float Vel,float Acc,float Dcc,float sf) do
......
proc p2p_move(float Posi,float Vel,float Acc,float Dcc,float sf) do
......
proc home_exec(float HomeVel,float OffsVel,float OffsPosi,float Acc,float sf) do
......
proc Jog_move(float Vel,float Acc) do
......
#task/1;
#short bitsum;
_triger_loop:
till(func_trigger); //wait trigger On
bitsum=0;
if(Fbit0) bitsum=1;
//if(Fbit1) bitsum+=2;
if(Fbit2) bitsum+=4;
if (X_en=0) do //if motor has not enabled yet, go to __triger_loop label
printl/101(" Fail : Motor has not enabled yet! ");
goto _triger_loop;
end;
//Jog funcion insert into here
/*
if (bitsum=0 & X_en=1) do
//##(move velocity,acc)
Jog_move(100,150);
goto _triger_loop;
end;
*/
//end Jog
till(~func_trigger); //wait trigger off
/*
if (bitsum=0 & X_en=1) do
//##(index vel,offset vel,offset position,Acc,smooth factor)
//home_exec(3,20,10,15,100);
//##(abs positon,move velocity,acc,dcc,smooth factor)
//p2p_move(0,15,150,150,300);
//##(abs positon,move velocity,acc,dcc,smooth factor)
//move(30,10,150,150,300);
goto _triger_loop;
end;
*/
//##(abs positon,move velocity,acc,dcc,smooth factor)
p2p_move(150,150,300,150,100);
sleep 0;
//以下进程要求用I9端口信号触发,该怎样设置?
p2p_move(0,150,300,150,300);
goto _triger_loop;
ret;
==============================
程序功能:I2端口输入一个信号,触发进程
p2p_move(150,150,300,150,100);
现在,要修改程序,使得以下进程用I9端口信号触发
p2p_move(0,150,300,150,300);
有没有大侠知道这个程序怎样改啊?
[ 本帖最后由 changzhenga 于 2012-12-10 21:23 编辑 ]