Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Copy the "Calling Program" code into a new file in Motion Composer
  2. Modify the axis names to reflect the axes used to create the spiral
  3. Save as a PGM file.
  4. Open scope and configure to collect the position command of the X/Y axes. 
  5. Compile and run the file 
  6. Change scope display mode to 2D to view the path of the X/Y axes commanded position.

 


Info
iconfalse
titleMacro
// Macro Implementation
// Spiral($x,$y,$rad,$count,$speed) 
//$x and $y are the location of the center of the spiral. This implementation changes the radius at the 0 and 180 degree points.
//the starting angle is 0 so the starting location of the X axis is offset from the circle center by the radius
//$rad is the maximum radius of the spiral
//$count is the number of iterations of the spiral
//$speed is the velocity used along the spiral path

//Comments:
//A critical section is used to ensure continuous motion through the "For-Next" loop. Otherwise the motion could stop during the 
//variable increment and test
//Macro's cannot declare variables so a task variable ($task0) is used as the index variable for the loop
//Change to a different task or global variable if the $task0 is used in the calling program for other purposes
#MACRO Spiral($x,$y,$rad,$count,$speed) G0 X $x+$rad Y $y \ 
 CRITICAL START 600 \ 
 for $task0=$count To 1 STEP -1 \ 
 G2 P0 Q180 R $task0*$rad/$count \ 
 G2 P180 Q0 R ($task0-0.5)*$rad/$count \ 
 next $task0 \ 
 CRITICAL END \
//END


...