ApossC SDK  V01.15
Macros | Functions
SDK_SignalGenerator.mc File Reference

Functions for the operation of the signal generator. More...

#include <SysDef.mh>
#include "SDK_SignalGenerator.mh"

Go to the source code of this file.

Macros

#define HWSIGGEN_MODE_ENABLE   0x0001
 

Functions

long sdkSigGenAxisSetupMiniMACS6 (long axis, long encPortOut, long indexDistance)
 Settings for a Signal Generator. More...
 
long sdkSigGenOpenloopSetupMiniMACS6 (long encPort, long indexDistance)
 Settings for a Signal Generator. More...
 
void sdkSigGenEnable (long encPort, long enable)
 Enable/Disable Signal Generator. More...
 
void sdkSigGenReset (long encPort)
 Reset Signal Generator. More...
 
void sdkSigGenOpenloopAcceleration (long encPort, long acceleration)
 Set acceleration of Signal Generator. More...
 
void sdkSigGenOpenloopDeceleration (long encPort, long deceleration)
 Set acceleration of Signal Generator. More...
 
void sdkSigGenOpenloopVelocity (long encPort, long velocity)
 Set velocity of Signal Generator. More...
 

Detailed Description

Functions for the operation of the signal generator.

Revision
210

Definition in file SDK_SignalGenerator.mc.

Macro Definition Documentation

◆ HWSIGGEN_MODE_ENABLE

#define HWSIGGEN_MODE_ENABLE   0x0001

Definition at line 16 of file SDK_SignalGenerator.mc.

Function Documentation

◆ sdkSigGenAxisSetupMiniMACS6()

long sdkSigGenAxisSetupMiniMACS6 ( long  axis,
long  encPortOut,
long  indexDistance 
)

Settings for a Signal Generator.

With this function the settings can be made which are required for a signal generator. This is a closed loop signal generator which can generate encoder signals by running a virtual axis. The signal generator can also generate index signals with a defined index distance. This signal will be generated on a digital output. For signal generator 0 this will be digital output 1, for signal generator 1 digital output 2 and so on. The digital output can then not be controlled by normal output functions anymore.

The generated signal cannot be read back. A encoder signal connection to a different port has to be made to receive the generated signals.

Parameters
axisAxis number 0-n
encPortOutEncoder port number. Usually, module instance 0 is connected to X1 and so on. Please refer to product manual
indexDistanceDistance in increments between two index signals.
Returns
value: Process value
value > 0 Process successful
value = 0 Process is active
value < 0 Error
Examples
SetupSignalGeneratorAxis.mc.

Definition at line 41 of file SDK_SignalGenerator.mc.

42 {
43  long virtMasterNo = encPortOut;
44 
45  if(SYS_INFO(SYS_MAX_SIGGEN) == 0)
46  {
47  print("Controller does not support Signal Generator");
48  return(-1);
49  }
50 
51  if((encPortOut+1) > SYS_INFO(SYS_MAX_SIGGEN))
52  {
53  print("Port does not support Signal Generator");
54  return(-2);
55  }
56 
57  if(SYS_INFO(SYS_MAX_VIRTMAST) == 0)
58  {
59  print("Controller does not support Virtual Masters");
60  return(-3);
61  }
62 
63  if((encPortOut+1) > SYS_INFO(SYS_MAX_VIRTMAST))
64  {
65  print("Port does not support Virtual Masters");
66  return(-4);
67  }
68 
69  // Setup selected encoder port as signal generator
70  HWENC_PARAM(encPortOut, HWENCODER_MODE) = HWENCODER_MODE_INCROUTPUT; // signal generator mode
71 
72  HWSIGGEN_PARAM(encPortOut, HWSIGGEN_SIGDIST) = indexDistance; // setup index distance
73 
74  VIRTMAST_PARAM(encPortOut, VIRTMAST_UUFACT_UNITNO) = 0xFFFFF;
75  // Full reference value of REG_REFERENCE is 0xFFFFF
76  // Virtual master works in 1/1000 Hz on each line (Spur)
77  // This results in factor 1000/4 = 250
78  // REG_REFERENCE is scaled with 65'536
79  // 250 % 65.536 = 3.814697265625
80  VIRTMAST_PARAM(encPortOut, VIRTMAST_UUFACT_INCNO) = AXE_PARAM(axis, VELMAXQC) * 3.814697265625;
81 
82  // set velocity source to axis cmdvel value
84  AXE_PARAM(axis, FFVEL) = 1000;
85  AXE_PARAM(axis, KPROP) = 100;
86  AXE_PARAM(axis, KDER) = 0;
87 
88  // scale to 1/1000 HZ (Pulses)
90 
91  HWSIGGEN_PARAM(encPortOut, HWSIGGEN_MODE) = HWSIGGEN_MODE_ENABLE; // enable signal generator
92 
93  return(1);
94 }

◆ sdkSigGenEnable()

void sdkSigGenEnable ( long  encPort,
long  enable 
)

Enable/Disable Signal Generator.

Disabling and Enabling the Signal Generator will reset the index distance counter. This means, an index signal will immediately generated. The next signal will be generated after index distance.

Parameters
encPortEncoder port number. Usually, module instance 0 is connected to X1 and so on. Please refer to product manual
enable1 = enable, 0 = disable
Examples
SetupSignalGeneratorOpenloop.mc.

Definition at line 167 of file SDK_SignalGenerator.mc.

168 {
169  if(enable)
170  HWSIGGEN_PARAM(encPort, HWSIGGEN_MODE) = HWSIGGEN_MODE_ENABLE; // enable signal generator
171  else
172  HWSIGGEN_PARAM(encPort, HWSIGGEN_MODE) = 0; // disable signal generator
173 }

◆ sdkSigGenOpenloopAcceleration()

void sdkSigGenOpenloopAcceleration ( long  encPort,
long  acceleration 
)

Set acceleration of Signal Generator.

Parameters
encPortEncoder port number. Usually, module instance 0 is connected to X1 and so on. Please refer to product manual
accelerationThe acceleration of the generated signal [Hz/s]
Examples
SetupSignalGeneratorOpenloop.mc.

Definition at line 195 of file SDK_SignalGenerator.mc.

196 {
197  VIRTMAST_PARAM(encPort, VIRTMAST_ACC) = acceleration; // acc is in Hz/s
198 }

◆ sdkSigGenOpenloopDeceleration()

void sdkSigGenOpenloopDeceleration ( long  encPort,
long  deceleration 
)

Set acceleration of Signal Generator.

Parameters
encPortEncoder port number. Usually, module instance 0 is connected to X1 and so on. Please refer to product manual
accelerationThe acceleration of the generated signal [Hz/s]
Examples
SetupSignalGeneratorOpenloop.mc.

Definition at line 207 of file SDK_SignalGenerator.mc.

208 {
209  VIRTMAST_PARAM(encPort, VIRTMAST_DEC) = deceleration; // dec is in Hz/s
210 }

◆ sdkSigGenOpenloopSetupMiniMACS6()

long sdkSigGenOpenloopSetupMiniMACS6 ( long  encPort,
long  indexDistance 
)

Settings for a Signal Generator.

With this function the settings can be made which are required for a signal generator. This is an open loop signal generator which can generate an encoder signal with a defined signal speed and and with a ramp of defined acceleration and deceleration. The signal generator can also generate index signals with a defined index distance. This signal will be generated on a digital output. For signal generator 0 this will be digital output 1, for signal generator 1 digital output 2 and so on. The digital output can then not be controlled by normal output functions anymore.

The generated signal cannot be read back. A encoder signal connection to a different port can be made to receive the generated signals.

Parameters
encPortEncoder port number. Usually, module instance 0 is connected to X1 and so on. Please refer to product manual
indexDistanceDistance in increments between two index signals.
Returns
value: Process value
value > 0 Process successful
value = 0 Process is active
value < 0 Error
Examples
SetupSignalGeneratorOpenloop.mc.

Definition at line 117 of file SDK_SignalGenerator.mc.

118 {
119  long virtMasterNo = encPort;
120 
121  if(SYS_INFO(SYS_MAX_SIGGEN) == 0)
122  {
123  print("Controller does not support Signal Generator");
124  return(-1);
125  }
126 
127  if((encPort+1) > SYS_INFO(SYS_MAX_SIGGEN))
128  {
129  print("Port does not support Signal Generator");
130  return(-2);
131  }
132 
133  if(SYS_INFO(SYS_MAX_VIRTMAST) == 0)
134  {
135  print("Controller does not support Virtual Masters");
136  return(-3);
137  }
138 
139  if((encPort+1) > SYS_INFO(SYS_MAX_VIRTMAST))
140  {
141  print("Port does not support Virtual Masters");
142  return(-4);
143  }
144 
145  // Setup selected encoder port as signal generator
146  HWENC_PARAM(encPort, HWENCODER_MODE) = HWENCODER_MODE_INCROUTPUT; // signal generator mode
147 
148  HWSIGGEN_PARAM(encPort, HWSIGGEN_SIGDIST) = indexDistance; // setup index distance
149 
153 
154  HWSIGGEN_PARAM(encPort, HWSIGGEN_MODE) = HWSIGGEN_MODE_ENABLE; // enable signal generator
155 
156  return(1);
157 }

◆ sdkSigGenOpenloopVelocity()

void sdkSigGenOpenloopVelocity ( long  encPort,
long  velocity 
)

Set velocity of Signal Generator.

Parameters
encPortEncoder port number. Usually, module instance 0 is connected to X1 and so on. Please refer to product manual
velocityThe velocity of the generated signal [Hz]
Examples
SetupSignalGeneratorOpenloop.mc.

Definition at line 219 of file SDK_SignalGenerator.mc.

220 {
221  VIRTMAST_PARAM(encPort, VIRTMAST_VEL) = velocity*1000; // vel is in 1/1000 Hz
222 }

◆ sdkSigGenReset()

void sdkSigGenReset ( long  encPort)

Reset Signal Generator.

This function will reset the index distance counter. This means, an index signal will immediately generated. The next signal will be generated after index distance.

Parameters
encPortEncoder port number. Usually, module instance 0 is connected to X1 and so on. Please refer to product manual
Examples
SetupSignalGeneratorOpenloop.mc.

Definition at line 182 of file SDK_SignalGenerator.mc.

183 {
184  HWSIGGEN_PARAM(encPort, HWSIGGEN_MODE) = 0; // disable signal generator
185  HWSIGGEN_PARAM(encPort, HWSIGGEN_MODE) = HWSIGGEN_MODE_ENABLE; // enable signal generator
186 }
VIRTMAST_UUFACT_UNITNO
#define VIRTMAST_UUFACT_UNITNO
Conversion factor uu to 1/1000 Hz, number of user units.
Definition: SdoDictionary.mh:4944
VIRTMAST_DEC
#define VIRTMAST_DEC
Deceleration to reach target velocity.
Definition: SdoDictionary.mh:4935
HWENC_PARAM
#define HWENC_PARAM(modno, parno)
HW Encoder Parameters: Setter.
Definition: SdoDictionary.mh:8383
HWSIGGEN_PARAM
#define HWSIGGEN_PARAM(modno, parno)
HW Signalgen (Enc/Pulse) Parameters: Setter.
Definition: SdoDictionary.mh:9232
KDER
#define KDER
Derivative Factor for PID position control loop.
Definition: SdoDictionary.mh:2413
VIRTMAST_ACC
#define VIRTMAST_ACC
Acceleration to reach target velocity.
Definition: SdoDictionary.mh:4924
REG_REFERENCE
#define REG_REFERENCE
Actual reference value generated by position control loop.
Definition: SdoDictionary.mh:3290
HWSIGGEN_MODE
#define HWSIGGEN_MODE
Enable.
Definition: SdoDictionary.mh:9245
SYS_MAX_VIRTMAST
#define SYS_MAX_VIRTMAST
Number of virtual masters.
Definition: SdoDictionary.mh:1303
VIRTMAST_VEL
#define VIRTMAST_VEL
Target velocity.
Definition: SdoDictionary.mh:4913
HWSIGGEN_MODE_ENABLE
#define HWSIGGEN_MODE_ENABLE
Definition: SDK_SignalGenerator.mc:16
AXE_PARAM
#define AXE_PARAM(modno, parno)
Axis Parameters: Setter.
Definition: SdoDictionary.mh:2293
VIRTMAST_MODE_VELOCITY
#define VIRTMAST_MODE_VELOCITY
Definition: SdoDictionary.mh:4958
AXE_PROCESS_SRCINDEX
#define AXE_PROCESS_SRCINDEX(modno, parno)
Axis Process Data: Source Index.
Definition: SdoDictionary.mh:3181
VIRTMAST_PISRC_CMDVEL
#define VIRTMAST_PISRC_CMDVEL
Index and subindex of the command velocity.
Definition: SdoDictionary.mh:4902
HWENCODER_MODE_INCROUTPUT
#define HWENCODER_MODE_INCROUTPUT
Definition: SdoDictionary.mh:8576
VIRTMAST_MODE
#define VIRTMAST_MODE
Enable / Disable / mode.
Definition: SdoDictionary.mh:4879
VIRTMAST_UUFACT_INCNO
#define VIRTMAST_UUFACT_INCNO
Conversion factor uu to 1/1000 Hz, number of increments.
Definition: SdoDictionary.mh:4953
VIRTMAST_PARAM
#define VIRTMAST_PARAM(modno, parno)
Virtual Master Parameters: Setter.
Definition: SdoDictionary.mh:4868
HWENCODER_MODE
#define HWENCODER_MODE
Encoder type.
Definition: SdoDictionary.mh:8395
VIRTMAST_MODE_PROFILE
#define VIRTMAST_MODE_PROFILE
Definition: SdoDictionary.mh:4959
FFVEL
#define FFVEL
Velocity Feed forward.
Definition: SdoDictionary.mh:2644
SYS_MAX_SIGGEN
#define SYS_MAX_SIGGEN
Number of H/W signal generators.
Definition: SdoDictionary.mh:1393
SYS_INFO
#define SYS_INFO(parno)
System Information: Setter.
Definition: SdoDictionary.mh:1202
KPROP
#define KPROP
Proportional value for PID position control loop.
Definition: SdoDictionary.mh:2404
VELMAXQC
#define VELMAXQC
Maximum velocity.
Definition: SdoDictionary.mh:2384
HWSIGGEN_SIGDIST
#define HWSIGGEN_SIGDIST
Distance between two reference signals.
Definition: SdoDictionary.mh:9290

Data Sheets | Released Software | Software Manuals | Hardware Manuals | Maxon Shop

Maxon Support Center