Jump to content
OMRON Forums

Getting Homing to work in the HMI?


jackvoxel8.com
 Share

Recommended Posts

Hi All, I am currently trying to get the "Home" button in PMAC-NC to work. I can currently home motors 1, 2, and 3 from the terminal in the PowerPMAC IDE with the #1..3hm command. The PPMAC source that ships with the NC code comes with a stubbed program that integrators should modify. Here is how I modified it:

 

open plc HomePlc

Ldata.coord = 1

 

if (CommandReg == UI_Home)

{

CommandReg = UI_None

 

abort;

enable;

 

// Integrator should insert custom homing script here.

home 3

home 1,2

homez 5,6,7,8

 

// Acknowledge HMI homing process is complete.

send1 "HomeCompleted"

}

close

 

Any help would be appreciated.

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

There is nothing wrong with the code changes you have made but you probably want to enhance the functionality by including some checks to each homing sequence as shown below.

 

Can you elaborate on the problem you are having? Although you show this code example you have not detailed what your problem actually is. Is the "Home" button simply not initiating the homing process? Or does the code not act as you would like?

 

open plc HomePlc

Ldata.coord = 1

 

if (CommandReg == UI_Home)

{

CommandReg = UI_None

abort;

enable;

 

// Small Timer to allow Motors to Close Loop if not already

call timer(0.25)

 

// Home Motor 3 First

home3

// Small Timer to Allow Motion to Start

call timer(0.1)

// Check to Make sure Motor is Homed & In-Postion Before Homing Others

while (!(Motor[3].HomeComplete) || !(Motor[3].InPos)) {}

 

// Home Motors 1 & 2

home1,2

// Small Timer to Allow Motion to Start

call timer(0.1)

// Check to Make sure Motors Homed and In-Postion

while (!(Motor[1].HomeComplete) || !(Motor[1].InPos) || !(Motor[2].HomeComplete) || !(Motor[2].InPos)) {}

 

// Home Motors 5,6,7,8

homez5,6,7,8

// Small Timer to Allow Motion to Start

call timer(0.1)

// Truncated While Loop to insure all motors in the CS are homed.

while(!(Coord[1].HomeComplete)){}

 

// Acknowledge HMI homing process is complete.

send1 "HomeCompleted"

}

 

close

Link to comment
Share on other sites

Thanks for the reply vinceb

 

Your code it working for me. Previously it just wouldnt work at all. Sometimes it would hang and othertimes it would immediately send the HomeCompleted message.

 

Instead of using the timer to wait for motion to start, would the following line of code work? Using the timers feels fragile.

 

while (Motor[1].HomeInProgress == 0) { }

Link to comment
Share on other sites

  • 1 month later...
Guest
This topic is now closed to further replies.
 Share


×
×
  • Create New...