Difference between revisions of "Program Examples:Camming by Virtual Master"

From SoftMC-Wiki
Jump to: navigation, search
(Created page with "== Introduction == Slave axis is driven by a virtual(simulated) master axis == Setup == Both master and slave axes are set as in previous examples == Program example == ...")
 
(Creating Cam Table)
Line 11: Line 11:
 
== Creating Cam Table ==
 
== Creating Cam Table ==
  
Creating a 360 deg sine table
+
Declaring a cam-table type global variable:
 +
<pre>
 +
common shared CamTable1 as cam
 +
</pre>
 +
 
 +
Creating an empty cam table:
 +
 
 +
* This table is not cyclic:
 +
<pre>
 +
    CamTable1.Cycle = 1
 +
</pre>
 +
 
 +
* Not linked to anything other cam-tabels:
 +
 
 +
<pre>
 +
    CamTable1.Next = none
 +
    CamTable1.Prev = none
 +
</pre>
 +
 
 +
* making it 10000 points
 +
 
 +
<pre>
 +
  dim camsize as long = 10000
 +
  createcamdata camsize CamTable1
 +
</pre>
  
 +
* Defining a 360 deg sine table:
  
 
<pre>
 
<pre>
Line 21: Line 46:
 
</pre>
 
</pre>
  
Store the created file onto flash disk
+
* Store the created file onto flash disk:
  
 
<pre>
 
<pre>
 
   storecamdata ct1.cam CamTable1   
 
   storecamdata ct1.cam CamTable1   
 +
</pre>
 +
 +
Once the table is stored on the flash it can be re-loaded as:
 +
<pre
 +
  loadcamdata ct1.cam CamTable1
 
</pre>
 
</pre>

Revision as of 11:02, 3 August 2014

Introduction

Slave axis is driven by a virtual(simulated) master axis

Setup

Both master and slave axes are set as in previous examples

Program example

Creating Cam Table

Declaring a cam-table type global variable:

common shared CamTable1 as cam

Creating an empty cam table:

  • This table is not cyclic:
    CamTable1.Cycle = 1 
  • Not linked to anything other cam-tabels:
    CamTable1.Next = none
    CamTable1.Prev = none
  • making it 10000 points
  dim camsize as long = 10000
  createcamdata camsize CamTable1
  • Defining a 360 deg sine table:
  for i = 1 to CamTable1.Size 
    CamTable1.MasterData [i] = 360*(i-1)/CamTable1.Size ' Master in degrees
    CamTable1.SlaveData  [i] = cam_amplitude *sin (CamTable1.MasterData [i] * pi/180)
  next
  • Store the created file onto flash disk:
  storecamdata ct1.cam CamTable1   

Once the table is stored on the flash it can be re-loaded as: <pre

 loadcamdata ct1.cam CamTable1

</pre>