User Tools

Site Tools


plc:m88_m89_stop_motion_from_plc_if_input_pin_activated

This is an old revision of the document!


M88, M89 PLC procedures. Stop Motion if Input pin activated

One of the most popular job for the PLC procedure is moving to given direction till input pin triggered.

It's used in

  • Homing procedures,
  • Probing,
  • Tool Length measure
  • Surface measure
  • Gantry Alignment procedure
  • and many others

This procedure can be handled in Hardware PLC. We offer M88 and M89 PLC procedures which do this job as a standard procedure. However, it can be customized easily according to customer needs.

M88.plc
//Watch on given sensor number, Soft Stop if sensor triggered
//used for homing, surface measure, tool length measure etc
 
main ()
{
 
  input=eparam&0xFFFF;	//P-parameter
  state=eparam>>16;	//L-parameter
  timer=0;
 
  message=PLCCMD_MOTION_CONTINUE;
  timer=30;do{timer--;}while(timer>0);
 
  ready=0;
 
  do {
    a=portget(input);
    if (state==0)
    {
      if (a==0) {ready=1;};
    };
    if (state!=0)
    {
      if (a!=0) {ready=1;};
    };
  }while(ready==0);
 
  message=PLCCMD_MOTION_SOFT_SKIP;
  timer=30;do{timer--;}while(timer>0);
 
  exit(99);
};
plc/m88_m89_stop_motion_from_plc_if_input_pin_activated.1537895670.txt.gz · Last modified: 2018/09/25 13:14 by skirillov

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki