Jump to content
OMRON Forums

cx versus cpx


BoneSkier

Recommended Posts

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

In summary, cx is a one-line PLC, cpx is a one-line motion program. So if you want to do move modes other than rapid mode, you must use cpx.

 

Further detail from the IDE's help file:

 

 

cx

Function: Compile and execute following program command(s) as PLC

 

Scope: Coordinate-system specific

 

Syntax: cx {program command(s)}

 

The cx command causes Power PMAC to compile (parse) the program command sequence that immediately follows it on the same line and execute it as a PLC program. This provides a simple method for executing some basic buffered program commands without going through the full open/download/close/run cycle.

 

The buffered program commands that can be executed with the cx command include:

 

· Single line while loops

 

· Single-line do .. while loops

 

· Single-line if conditional branches

 

· Variable modification assignments (e.g. P1+=1)

 

· Axis moves (forces the coordinate system into rapid mode)

 

 

 

Commands that are legal either as buffered program commands or on-line commands (e.g. {variable}={expression}) do not require the cx command preceding it.

 

For coordinate-system specific actions such as axis moves or modification of coordinate-system variables, the presently addressed coordinate system for the communications thread is affected.

 

Because this executes the commands as a PLC program, there is no automatic implicit execution of a pmatch command to ensure that the axis starting positions for a move command are properly aligned with the present motor positions. If this is required, the command must be included explicitly on the line.

 

Examples

cx while (P100<40) P(P100)=0 P100++ // Execute WHILE loop

 

cx if (Q10<0) Q300=72 // Execute conditional branch

 

cx Motor[4].ProgJogPos+=5000 // Modify data structure element value

 

cx pmatch X10 Y20 Z30 // Execute RAPID-mode move

 

cpx

Function: Compile and execute following program command(s) as motion program

 

Scope: Coordinate-system specific

 

Syntax: cpx {program command(s)}

 

The cpx command causes Power PMAC to compile (parse) the program command sequence that immediately follows it on the same line and execute it as a motion program. This provides a simple method for executing some basic buffered program commands without going through the full open/download/close/run cycle.

 

The buffered program commands that can be executed with the cpx command include:

 

· Single line while loops

 

· Single-line do .. while loops

 

· Single-line if conditional branches

 

· Variable modification assignments (e.g. P1+=1)

 

· Axis moves (any move mode)

 

 

 

Commands that are legal either as buffered program commands or on-line commands (e.g. {variable}={expression}) do not require the cpx command preceding it.

 

For coordinate-system specific actions such as axis moves or modification of coordinate-system variables, the presently addressed coordinate system for the communications thread is affected.

 

Because this executes the commands as a motion program, a pmatch command is automatically and implicitly executed before any of the embedded commands, automatically calculating the starting axis positions.

 

Examples

cpx while (P100<40) P(P100)=0 P100++ // Execute WHILE loop

 

cpx if (Q10<0) Q300=72 // Execute conditional branch

 

cpx Motor[4].ProgJogPos+=5000 // Modify data structure element value

 

cpx linear X10 Y20 Z30 F5 // Execute linear-mode move

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

×
×
  • Create New...