User Tools

Site Tools

Translations of this page:


MyCNC Shop

MyCNC website

myCNC Price List


How to add mandatory Homing after Emergency Button and-or Servo ready alarm

For many CNC applications, it's very important to have precise machine position all the time. The homing procedure should be done to find the correct machine position if any servo driver fault happens or Emergency button pressed.

However, plasma/gas cutting users don't care about homes quite often and mostly use “working” position.

Mandatory Homing procedure handler can be implemented with Software PLC

There are Homing flags situated in global variables 7391-7399

Address Global variable Description
7391 X axis homing flag
7392 Y axis homing flag
7393 Z axis homing flag
7394 A axis homing flag
7395 B axis homing flag
7396 C axis homing flag

The flags are set automatically to “1” if

  1. The myCNC software just loaded
  2. Emergency button pressed
  3. Corresponding Servo Ready alarm triggered

Software PLC Homing procedure handler monitors the flags and stops running G-code if any of the flags is set.

hx=gvarget(7391); //monitor axes flags X, Y, Z and C
a++; if(a>9){a=1;};
gvarset(99,c+b); //build variable to display which axis is not ready
home=hx+hy+hz+hc; //check if any of axis is not ready
if (home!=0)  //if any of axis is not ready, then ...
  if (prg!=0) //Check if Program running is started and Stop it immediately
	gvarset(0xffffff,1); //Stop Program
  gvarset(9100,1); //display the message #1 on the screen, if any of home alarm activated
  gvarset(9100,0); //hide the message #1, if everything's ok

Writing a “1” to global variable #9100 will show Popup Message #0. Content to show in the Popup message should be programmed in cnc-variables.xml configuration file.

 <value name="cnc-popup-message-0" 
 width="600" height="300" 
 buttonImage="machine-home-find-all" buttonWidth="80"
 buttonHeight="80" buttonAction="direct-run:M138" 
 header="Machine position lost due to either Emergency Stop or Servo Alarm" 
 headerHeight="40" headerFontSize="16" 
 message="Please run Homing" fontSize="20" 
 footer="[%d]" footerFontSize="20" footerHeight="20" 
 timeout="5" dest="cnc-gvariable-99" K="1">0</value>

A popup message has 3 sections -

  • header,
  • message,
  • footer

For each section can be set up

  • section text
  • section font family, size and style
  • section height and width

The popup message may contain a button to run something. The button has attributes

  • buttonImage - skin image for the button
  • buttonWidth - the button width in px
  • buttonHeight - the button height in px
  • buttonAction - action for button pressed event

Any of message section may show global variable value to show for example current state or build countdown timer.

  • dest attribute defines which variable to show
  • K attribute defines show ratio for the variable value
  • section message should contain C-like format string, for example, “%d” will print the value only as integer value
plc/how_to_add_mandatory_homing_after_emergency_button_and-or_servo_ready_alarm.txt · Last modified: 2018/08/14 13:33 by skirillov

Translations of this page: