
102
SM-Applications Modules & Motion Processors User Guide
Issue Number: 4
9.6
Virtual Master Example
9.6.1
Example Master Code
The following code shows how the master would be set up to generate reference data
and send the data to the slaves. It also shows that the master acts as a slave by using
the reference data it has generated. This is done with the
CTSYNCGetSlaveReferences
function block.
The example generates Virtual Master data as a triangular ramp and also implements a
Virtual Slave which outputs the data to the drive.
Initial
{
#81.06=25 //CTSync Master
#81.12=2 //Pos task at 500us
REINIT
//Set up Virtual Master Ramp Reference.
Ramp% = 0
//Configure Slave output channel 1 to menu 18, parameter 11.
CTSYNCSetupOutputChannel(1,18,11)
//Enable the configured output channel.
CTSYNCEnableOutputChannel(1)
}
POS0
{
//Perform Slave function first, so timing is identical between master and slave:
(Slaveref1%,Slaveref2%,Auxref%, Status%) = CTSYNCGetSlaveReferences()
//Status% should be checked here to ensure the data was received correctly.
if Status% = USR_VALUE_OK then
//Output to the drive at the start of next motion period.
CTSYNCWriteOutputChannel(1,Slaveref1%)
endif
//Perform Master function, in this case a ramp:
Ramp% = Ramp% + 1
//Apply reset to ramp profile if required
if Ramp% > 999 then
//Wrap back to zero
Ramp% = 0
endif
//Pass Reference Data to Slaves. Note only reference1 used.
CTSYNCSetMasterReferences(Ramp%,0,0)
}
Summary of Contents for Digitax ST Indexer
Page 131: ......
Page 132: ...0471 0062 04...