Master and Slave configuration

From SoftMC-Wiki
Jump to: navigation, search
Language: English

The following example demonstrates how to set master and slave configuration of 2 axes.

program
  
  'attach axes to task
  attach MasterAxis
  attach SlaveAxis

  'setup Master/Slave relationship
  with SlaveAxis
    MasterSource=MasterAxis.PositionCommand
    Slave=GEAR
    GearRatio=1.5
  end with  
  
  'setup and start recording
  RECORD RecFile.rec 100000 Gap=1 RecData = MasterAxis.VCmd, SlaveAxis.VCmd
  RecordON
  
  'Enable axes
  MasterAxis.En=1
  SlaveAxis.En=1
  while (MasterAxis.En <> 1) OR (SlaveAxis.En <> 1)
    sleep 10
  end while
  'move Master Axis
  JOG MasterAxis 100 TimeJog=1000 starttype=immediate

  'wait for Master to finish jog & Slave to finish following
  while (MasterAxis.IsMoving <> 0)
    sleep 10 
  end while
  
  sleep 100   'wait for Slave to finish following
  
  RecordCLOSE 'stop recording
  
  'Disable axes
  MasterAxis.En=0
  SlaveAxis.En=0
  
  'detach axes from task
  detach MasterAxis
  detach SlaveAxis
  
end program