Jump to content
OMRON Forums

simple pmc code


Recommended Posts

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

If you are able to close the loop on the motor and jog it this should work as you have implemented it.


Did you "Begin" the program in the C.S. (&1B1)?

What is the exact message you get from the IDE when you try to run it (&1R)?


Yes I can close the loop and jog the motor without any problems.


&1B1 doesn't work from the terminal. I'm really really struggling to find in the documentation how to run simple motion control programs and how to setup coordinate systems from a plc. For example I wrote a simple PLC that sets up a single axis coordinate system.


open plc 2
disable plc 2


This just will not compile/transmit to the PMAC.


Maybe I'm missing a document (I have the user manual and the reference manual) but I'm having no luck at all with the basics (but I can happily compile my own servo code in C....)

Link to comment
Share on other sites

A few key points you may be missing:


You must always keep in mind the difference between buffered program commands and on-line commands. When you send buffered program commands to the PMAC, they are simply stored (in the specified open program buffer) for later execution. So when you send:


open prog 1




you have simply stored the program command "X1000" in motion program buffer 1 for later execution. Note that this program does not "belong" to any coordinate system in PMAC, but any coordinate system in PMAC can potentially point to it and run it.


To get this program to cause actual motor motion, you must first have a coordinate system with one or more motors assigned to the X axis. This set up must be done before you try to run the program. This is done with "on-line" commands. On-line commands are executed immediately when they are sent to the PMAC, and then they are thrown away. They are not stored as program commands are.


So to set up the coordinate system, you want to use two on-line commands:


&1 // Address C.S.1, so that future C.S.-specific commands operate on C.S.1

#1->X // Assign Motor 1 to the X-axis in the addressed C.S.


Remember that these are on-line commands, and not part of any PMAC program. You can just type them into the terminal window.


You can check to see if your axis definition "took" with the query command




You should get a response that includes:




Now, we want to set the motion program counter for this coordinate system to the beginning of our motion program. This is usually also done with on-line commands. Again, you can type them into the terminal window.


&1 // Address C.S. 1 (not needed if already addressed, but won't hurt)

B1 // Point motion program counter to Beginning of Motion Program 1


You are now ready to run the motion program if all of the motors assigned to axes in this coordinate system (which should be just one motor in your case) are enabled in closed-loop mode with no error conditions. The on-line C.S.-specific "R" command should run the program at this point.


Most of the time, you will combine these on-line commands into a single command line:




or if already addressed, just



Link to comment
Share on other sites

Ah Many thanks,


I now have a simple motion program up and running.


Is there no way though to setup coordinate systems from a plc script? Would you always have to use the on-line system to do that? It's not a huge deal but I can imagine if you had a large number of motors in a complex coordinate system you would want to automate that

Link to comment
Share on other sites

Almost always, the coordinate system setup is part of the initial configuration that is saved for an application. Once saved to flash memory, it is automatically there as soon as you turn on the PMAC. There should be no need to execute a program each time you power up to re-create that setup.


You can create the axis definitions interactively through the "Setup Variables" window in the IDE. (Delta Tau/Configure/Setup Variables/Coordinate Systems/Axis Definitions. Alternately, you can put them in one of your project files as on-line commands so they are made every time you download your project from the IDE.

Link to comment
Share on other sites

This topic is now closed to further replies.

  • Create New...