tweekzilla Posted May 6, 2013 Share Posted May 6, 2013 I'd like to be able to pass new position (and feed-rates) to a motion control program via P variables - The code below does indeed see the P-variables at startup but does not recheck the values whilst running. Is it possible to do the following? open prog 3 dwell 0 EncTable[3].type = 10; //setup for trigger; EncTable[3].pEnc1 = Acc24E3[1].Chan[2].Status.a; //point to arming flag linear; X0 F180; while(P0 != 0) { X(P1) F100; } X1000 F100; close Link to comment Share on other sites More sharing options...
curtwilson Posted May 7, 2013 Share Posted May 7, 2013 Your example worked just fine for me. Programs do use the present values of variables, not just the values when the program starts. Remember that the program will be working a couple of moves ahead of execution so moves can be blended together properly, so changes can appear to be delayed. Also, if you are not sure about whether you are in absolute or incremental mode, it is easy to get confused about what it is doing. Link to comment Share on other sites More sharing options...
tweekzilla Posted May 7, 2013 Author Share Posted May 7, 2013 Just to update on this - The following works fine (along with an expected lag due to the lookahead), unless you make P12=P13 then it will get stuck in a loop - i.e. setting P12 != P13 after setting P12=P13 does not execute the move. You also cannot exit the loop by setting P10 = 0. Maybe this is expected? open prog 3 dwell 0 EncTable[3].type = 10; //setup for trigger; EncTable[3].pEnc1 = Acc24E3[1].Chan[2].Status.a; //point to arming flag linear; X0 F180; while(P10 != 0) { X(P12) F100; x(P13) F50; } X1000 F100; close Link to comment Share on other sites More sharing options...
curtwilson Posted May 8, 2013 Share Posted May 8, 2013 Make sure that your acceleration time is not zero. I think you are actually faulting out of the program due to "zero time" moves. Use ta or ts commands to specify your acceleration times -- the acceleration time is the minimum time for a move, even a zero distance move. Zero acceleration time is also pretty lousy dynamically, as it causes step changes in commanded velocity, which can be rather hard on the equipment. Link to comment Share on other sites More sharing options...
Recommended Posts