Rotary Motion Program Buffers in Power PMAC

Modified on Tue, 25 Mar at 12:53 PM


Problem Explanation/Objective

Rotary Motion Program Buffers in Power PMAC are currently documented in many places in the Power PMAC User's and Software Reference manuals. This Technical Guide brings together that information.



Supported devices

Any Power PMAC CPU.



Requirements

No prerequisites other than a good understanding of Power PMAC.



Procedure

Rotary Motion Program Buffers

The rotary motion program buffers allow for the downloading of program lines during the execution of the program and for the overwriting of already executed program lines. This permits continuous execution of programs larger than PMAC’s memory space, and also real-time downloading of program lines.

 

Defining a Rotary Buffer

Each coordinate system can have a rotary program buffer. To create a rotary buffer for a coordinate system, address that coordinate system (&n) and send the define rotary {constant} [,[{constant}]][,{constant}] command. The first {constant} is a positive 32-bit integer equal to 2048 or greater representing the number of bytes of memory to be reserved for this buffer. The optional second {constant} is a positive 32-bit integer equal to 1024 or greater representing the number of bytes of memory to be reserved for the preliminary processing of a single program line. If no number is specified here, a value of 1024 is used. This value must not be greater than one-half of the buffer size specified by the first constant. The optional third {constant} is a positive integer that specifies the size of the local variable “stack offset” used when this program calls a subroutine or subprogram; if no number is specified here, a value of 256 is used.

 

A single axis-move command with a constant destination or distance (e.g. X10) requires 9 bytes of memory. The buffer size specified in the first constant should be large enough to permit the downloading to get ahead of the calculated point in the program far enough so that the calculation will not “catch” up before the next downloading event from the host computer. It must be at least twice as large as the preliminary line-buffer size specified in the second constant, and must be at least 2048 in all cases.

 

The preliminary line-buffer size specified in the (optional) second constant determines the size of the temporary storage buffer that the processed form of each command line is stored in before being placed in the rotary buffer itself. If no value is specified here, 1024 bytes are reserved for this purpose. It is a very rare application that will require more than 1024 bytes to process a single command line.

 

The stack offset size specified in the (optional) third constant determines the maximum number of local variables that can be used by the rotary program itself that will not be reused by the local variables of any subprogram called by the rotary program. If no value is specified here, a stack offset of 256 is used.

 

The rotary program buffer uses memory in the overall (script) program memory space in RAM. This space is 16 megabytes by default, but the size can be changed using the IDE’s project manager.

 

Opening for Entry

The open rotary command causes Power PMAC to open the rotary motion program buffer for the addressed coordinate system for entry. Subsequent program commands valid for rotary motion programs sent on this port are entered into the rotary motion program buffer.

No other program buffers may be open when this command is sent. The rotary buffer must already have been defined for this coordinate system.

 

The rotary motion program buffer is considered motion program 0 for the coordinate system, so the command open prog 0 has the same result. Once the rotary buffer has been defined and opened, program commands that are sent with this coordinate system addressed are automatically entered into the rotary buffer.

 

The open rotary buffer will be closed for further entry when a close command is issued while this coordinate system is addressed.

 

It is important to realize that after the open rotary command, PMAC is treating as many commands as possible as buffered commands, even if it is executing them immediately (some commands mean one thing as an on-line command, and another thing as a buffered command). For instance, an I100 command is a request for a value of I-variable 100 when buffers are closed, but it is a command to do a full circle with a 100-unit radius when a motion program buffer is open (the I-value is the X-axis component of the radial vector; since no axis positions are given, they are all assumed to be the same as the starting point)!

 

Deleting Buffers

The delete rotary command causes Power PMAC to eliminate the defined rotary motion program buffer for the specified coordinate system(s), freeing its memory for other use.

 

If not immediately preceded by a coordinate system list, it will do so for the presently addressed coordinate system. If immediately preceded by a coordinate-system list, it will do so for all coordinate systems in the list.

 

The specified rotary motion program buffer must be closed when this command is given, and execution of the rotary motion program must be fully stopped (as with an “a” abort command), not just suspended (as with an “h” hold, “q” quit, or “s” step command, or execution having reached the end of the buffer).

 

The delete all rotary command causes Power PMAC to eliminate the defined rotary motion program buffers for all coordinate systems, freeing the memory for other use.

 

All rotary motion program buffers must be closed when this command is given, and execution of all rotary motion programs must be fully stopped (as with an “a” abort command), not just suspended (as with an “h” hold, “q” quit, or “s” step command, or execution having reached the end of the buffer).

 

Preparing to Run

To prepare to run a rotary program in a coordinate system, use the B0 command (go to beginning of program zero – the rotary program) when addressing that coordinate system. This must be done when no buffers are open, or it will be interpreted as a B-axis command. Once prepared this way, the program is started with the command. This command can be given with the buffer either open or closed. If the command is given for an empty rotary buffer, the buffer will simply wait for a command to be given to it, and then execute that command immediately.

 

Staying Ahead of Executing Line

The key to the handling of a rotary program buffer is knowing how many lines ahead it is; that is, how many program lines have been loaded ahead of the program line that PMAC is executing. Typically, it will load ahead until a certain number of lines ahead is reached, and then wait until the program catches up to within a smaller number of lines ahead. A real-time application may just work one line ahead of the executing line; an application doing periodic downloading of a huge file may get 1000 lines ahead, and then start again when the program has caught up to within 500 lines.

 

Coord[x].RotStart contains the memory address of the start of the defined rotary motion program buffer for the coordinate system. The difference between the value of Coord[x].RotEnd and its value is the size of the defined rotary buffer in bytes. If no rotary motion program buffer is defined for the coordinate system, Coord[x].RotStart will have a value of 0.

 

Coord[x].RotEnd contains the memory address of the end of the defined rotary motion program buffer for the coordinate system. The difference between its value and that of Coord[x].RotStart is the size of the defined rotary buffer in bytes. If no rotary motion program buffer is defined for the coordinate system, Coord[x].RotEnd will have a value of 0.

 

Coord[x].RotExec contains the memory address of the next program command in the rotary motion program buffer for the coordinate system to be executed. The difference between the value of Coord[x].RotStore and its value (added to the size of the buffer if negative) is the size of the portion of the buffer with program commands that have not yet been executed. The remainder of the buffer is available for downloading new program lines. If no rotary motion program buffer is defined for the coordinate system, Coord[x].RotExec will have a value of 0.

 

Coord[x].RotStore contains the address of the next location in memory where a program line downloaded into the rotary motion program buffer for the coordinate system will be stored. The difference between its value and the value of Coord[x].RotExec (added to the size of the buffer if negative) is the size of the portion of the buffer with program commands that have not yet been executed. The remainder of the buffer is available for downloading new program lines. If no rotary motion program buffer is defined for the coordinate system, Coord[x].RotStore will have a value of 0.


Date/Revision History

First review 3/25/2025 V1.0


Author:

Stephen Milici, Technical Support Engineer"


References

Power PMAC User’s Manual: https://assets.omron.com/m/2c1a63d391d6bfa3/original/Power-PMAC-Users-Manual.pdf

Power PMAC Software Reference Manual: https://assets.omron.com/m/76e3f5e50c46e0e9/original/Power-PMAC-Software-Reference-Manual.pdf

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article