!LSN Set event when the negative limit switch (LSN) 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 negative 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 ENLSN1;//Enable negative limit switch for low->high transitions !LSN; //Set event on negative 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
|