| ApossC SDK V01.15

SDK_SignalGenerator.mc
Go to the documentation of this file.
1
10 #pragma once
11
12 #include <SysDef.mh>
13 #include "SDK_SignalGenerator.mh"
14
15 #ifndef HWSIGGEN_MODE_ENABLE
16 #define HWSIGGEN_MODE_ENABLE 0x0001
17 #endif
18
41 long sdkSigGenAxisSetupMiniMACS6(long axis, long encPortOut, long indexDistance)
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
83 VIRTMAST_PARAM(encPortOut, VIRTMAST_PISRC_CMDVEL) = AXE_PROCESS_SRCINDEX(axis, REG_REFERENCE);
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)
89 VIRTMAST_PARAM(encPortOut, VIRTMAST_MODE) = VIRTMAST_MODE_VELOCITY;
90
91 HWSIGGEN_PARAM(encPortOut, HWSIGGEN_MODE) = HWSIGGEN_MODE_ENABLE; // enable signal generator
92
93 return(1);
94 }
95
117 long sdkSigGenOpenloopSetupMiniMACS6(long encPort, long indexDistance)
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
150 VIRTMAST_PARAM(encPort, VIRTMAST_UUFACT_UNITNO) = 1;
151 VIRTMAST_PARAM(encPort, VIRTMAST_UUFACT_INCNO) = 1;
152 VIRTMAST_PARAM(encPort, VIRTMAST_MODE) = VIRTMAST_MODE_PROFILE;
153
154 HWSIGGEN_PARAM(encPort, HWSIGGEN_MODE) = HWSIGGEN_MODE_ENABLE; // enable signal generator
155
156 return(1);
157 }
158
167 void sdkSigGenEnable(long encPort, long enable)
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 }
174
182 void sdkSigGenReset(long encPort)
183 {
184 HWSIGGEN_PARAM(encPort, HWSIGGEN_MODE) = 0; // disable signal generator
185 HWSIGGEN_PARAM(encPort, HWSIGGEN_MODE) = HWSIGGEN_MODE_ENABLE; // enable signal generator
186 }
187
195 void sdkSigGenOpenloopAcceleration(long encPort, long acceleration)
196 {
197 VIRTMAST_PARAM(encPort, VIRTMAST_ACC) = acceleration; // acc is in Hz/s
198 }
199
207 void sdkSigGenOpenloopDeceleration(long encPort, long deceleration)
208 {
209 VIRTMAST_PARAM(encPort, VIRTMAST_DEC) = deceleration; // dec is in Hz/s
210 }
211
219 void sdkSigGenOpenloopVelocity(long encPort, long velocity)
220 {
221 VIRTMAST_PARAM(encPort, VIRTMAST_VEL) = velocity*1000; // vel is in 1/1000 Hz
222 }
sdkSigGenAxisSetupMiniMACS6
long sdkSigGenAxisSetupMiniMACS6(long axis, long encPortOut, long indexDistance)
Settings for a Signal Generator.
Definition: SDK_SignalGenerator.mc:41
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
sdkSigGenReset
void sdkSigGenReset(long encPort)
Reset Signal Generator.
Definition: SDK_SignalGenerator.mc:182
sdkSigGenOpenloopDeceleration
void sdkSigGenOpenloopDeceleration(long encPort, long deceleration)
Set acceleration of Signal Generator.
Definition: SDK_SignalGenerator.mc:207
HWENC_PARAM
#define HWENC_PARAM(modno, parno)
HW Encoder Parameters: Setter.
Definition: SdoDictionary.mh:8383
sdkSigGenOpenloopVelocity
void sdkSigGenOpenloopVelocity(long encPort, long velocity)
Set velocity of Signal Generator.
Definition: SDK_SignalGenerator.mc:219
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
sdkSigGenOpenloopAcceleration
void sdkSigGenOpenloopAcceleration(long encPort, long acceleration)
Set acceleration of Signal Generator.
Definition: SDK_SignalGenerator.mc:195
sdkSigGenOpenloopSetupMiniMACS6
long sdkSigGenOpenloopSetupMiniMACS6(long encPort, long indexDistance)
Settings for a Signal Generator.
Definition: SDK_SignalGenerator.mc:117
sdkSigGenEnable
void sdkSigGenEnable(long encPort, long enable)
Enable/Disable Signal Generator.
Definition: SDK_SignalGenerator.mc:167
VIRTMAST_VEL
#define VIRTMAST_VEL
Target velocity.
Definition: SdoDictionary.mh:4913
SDK_SignalGenerator.mh
Declaration of the signal generator functions.
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