Jump to content
OMRON Forums

using hmz from C


Recommended Posts

As part of our startup routine we need to programmatically issue an hmz command from the rticplc to reset our encoder positions and set the encoder table correctly. Currently we're doing this by issuing something like Command("#01,02,03,04hmz");, but I'd prefer to use a native C structure or function instead of sending the command through ssh.


What commands or assignments can I use to replicate the function of the hmz command from C?

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Is there a specific reason why you want to do that from C? You can always do HOMEZ 1..4 from a script PLC or motion program, no need for the CMD"".


If that is the most appropriate way to do it then I can do it that way. I'd prefer to stick to C since we aren't currently using PLCs for anything else and adding it for a single command seems silly.


That being said -- what is the recommended or most robust way to issue a command like hmz (native in C, via Command() in C, or via PLC)? Or will there be any difference?

Link to comment
Share on other sites



There's actually a C function that directly does it for you. You can look it up in the IDE Help. It's called "MotorHomez". Its description is below:


int MotorHomez (int n)

Does a power on position read if defined, else the home position is modified to make the present position zero



n - Motor number



There's a similar function for homing as normal called MotorHome()


Let me know if you need anything else.

Link to comment
Share on other sites

This topic is now closed to further replies.

  • Create New...