!LSP Set event when positive limit switch (LSP) goes low or high |
Syntax
Binary code
The programmed event is automatically erased when the event occurs or if the timeout for the WAIT! command expires. Remark: After setting UPD! or STOP! you need to wait until the programmed event occurs using WAIT!, otherwise, the program will continue with the next instructions that may override the event monitoring.
Example //Reverse when positive limit switch is reached //Position feedback: 500 lines encoder (2000 counts/rev) CACC = 0.0637; //acceleration rate = 200[rad/s^2] CSPD = 16.6667; //jog speed = 500[rpm] MODE SP; UPD; //execute immediate ENLSP1;//Enable positive limit switch for low->high transitions !LSP; //Set event on positive limit switch(low->high transition) WAIT!;//Wait until the event occurs !MC; // limit switch is active -> quick stop mode active WAIT!;// wait until the motor stops because only then the new // motion commands are accepted CSPD = -40; //jog speed = -1200[rpm] MODE SP; //after quick stop set again the motion mode UPD; //execute immediate |