FEDRA emulsion software from the OPERA Collaboration
MotnCnst.h
Go to the documentation of this file.
1#ifndef ___motncnst_h___
2#define ___motncnst_h___
3
4/*****************************************************************************************
5 This file contains standard definitions used by the Value Motion and Flex Motion
6 motion controller board families.
7
8 The sections in this file are:
9
10 Data Types
11 Board Types
12 Board Class (servo or stepper).
13 Board Family
14 Bus Type
15 Loop Mode
16 Axis Numbers
17
18*****************************************************************************************/
19
20/*********************************** Data Types *****************************************/
21#ifndef __LINUX__
22typedef unsigned char u8;
23typedef unsigned short u16;
24typedef unsigned long u32;
25#else
26 #ifndef __KERNEL__
27 typedef unsigned char u8;
28 typedef unsigned short u16;
29 typedef unsigned long u32;
30 #endif
31#endif
32
33typedef char i8;
34typedef short i16;
35typedef long i32;
36typedef double f64;
37typedef float f32;
38typedef long tBoolean;
39
40#define NIMC_FALSE 0
41#define NIMC_TRUE 1
42/********************************** Board Types *****************************************/
43
44#define PC_SERVO_2A 7
45#define PC_SERVO_4A 3
46#define PC_STEP_2OX 8
47#define PC_STEP_4OX 4
48#define PC_STEP_2CX 9
49#define PC_STEP_4CX 5
50#define PC_FLEXMOTION_6C 16
51
52#define PCI_SERVO_2A 17
53#define PCI_SERVO_4A 11
54#define PCI_STEP_2OX 18
55#define PCI_STEP_4OX 12
56#define PCI_STEP_2CX 19
57#define PCI_STEP_4CX 13
58#define PCI_FLEXMOTION_6C 24
59#define PCI_7344 28
60#define PCI_7324 29
61#define PCI_7314 30
62#define PCI_7334 32
63#define PCI_7332 33
64#define PCI_7348 34
65#define PCI_7342 37
66#define PCI_7346 38
67
68#define PXI_7312 22 // Step-2OX
69#define PXI_7314 20 // Step-4OX
70#define PXI_7322 23 // Step-2CX
71#define PXI_7324 21
72#define PXI_7332 26
73#define PXI_7334 25
74#define PXI_7344 27
75#define PXI_7348 35
76#define PXI_7342 36
77#define PXI_7346 39
78
79#define FW_7344 31 //1394 7344
80#define ENET_7344 41 // Ethernet 7344
81#define SER_7344 51 // Serial 7344
82
83// existing boards no longer being shipped.
84#define PC_CONTROL 0
85#define PC_STEP_OL 1
86#define PC_STEP_CL 2
87#define PC_ENCODER_4A 6
88#define PCI_ENCODER_4A 14
89
90#define PC_SERVO_1P PC_SERVO_2A
91
92// *******************************************************************
93// There are currently 31 boards, and the PC_SERVO_1P is NOT included.
94// *******************************************************************
95
96
98#define NIMC_SERVO 0
99#define NIMC_OPEN_LOOP_STEPPER 1
100#define NIMC_CLOSED_LOOP_STEPPER 2
101
103#define NIMC_FLEX_6C 0
104#define NIMC_FLEX_7344 1
105#define NIMC_FLEX_7334 2
106
108#define SERVO 0
109#define STEPPER 1
110#define SERVO_STEPPER 2
111
113#define NIMC_FLEX_MOTION 0
114#define NIMC_VALUE_MOTION 1
115
117#define NIMC_ISA_BUS 0
118#define NIMC_PCI_BUS 1
119#define NIMC_PXI_BUS 2
120#define NIMC_UNKNOWN_BUS 3
121#define NIMC_1394_BUS 4
122#define NIMC_ENET_BUS 5
123#define NIMC_SERIAL_BUS 6
124
126#define OPEN_LOOP 0
127#define CLOSED_LOOP 1
128
130#define TWO_AXIS 2
131#define THREE_AXIS 3
132#define FOUR_AXIS 4
133#define SIX_AXIS 6
134#define EIGHT_AXIS 8
135
137#define NIMC_UNKNOWN_OS 0xFFFF
138#define NIMC_WIN95 0
139#define NIMC_WIN98 2
140#define NIMC_WINNT 3
141#define NIMC_WIN2000 4
142#define NIMC_PHARLAP 5
143#define NIMC_LINUX 6
144
145/************************************ MISC ********************************************/
146#define MAX_TRIGGER_NUMBER 4
147#define MAX_NUM_AXIS_VALUEMOTION 4
148#define MAX_NUM_AXIS_FLEXMOTION 6
149#define NIMC_MAXBOARDS 32
150
151#define NIMC_BOARD_FAMILY 1100
152#define NIMC_BOARD_TYPE 1120
153#define NIMC_BUS_TYPE 1130
154#define NIMC_CLOSED_LOOP_CAPABLE 1150
155#define NIMC_NOT_APPLICABLE 1500
156#define NIMC_NUM_AXES 1510
157#define NIMC_VALUEMOTION_BOARD_CLASS 2020
158#define NIMC_BOARDTYPE_TO_VALUEMOTION_BOARD_CLASS 2150
159#define NIMC_BOOT_VERSION 3010
160#define NIMC_FIRMWARE_VERSION 3020
161#define NIMC_DSP_VERSION 3030
162#define NIMC_FPGA_VERSION 3040
163#define NIMC_FPGA1_VERSION 3040
164#define NIMC_FPGA2_VERSION 3050
165#define NIMC_FLEXMOTION_BOARD_CLASS 2030
166#define NIMC_CONTROLLER_SERIAL_NUMBER 2040
167
168
169//ValueMotion Axis Status bits
170#define NIMC_VALUEMOTION_PROFILE_COMPLETE 0x400 //profile complete bit for ValueMotion
171#define NIMC_VALUEMOTION_MOTOR_OFF 4 //motor off bit for ValueMotion
172#define NIMC_VALUEMOTION_MOTOR_RUNNING 0x80 //motor running bit for ValueMotion
173#define NIMC_VALUEMOTION_LIMIT_SWITCH 1
174#define NIMC_VALUEMOTION_HOME_SWITCH 2
175#define NIMC_VALUEMOTION_FOLLOWING_ERROR 0x20
176#define NIMC_VALUEMOTION_DIRECTION 0x1000
177#define NIMC_VALUEMOTION_INDEX 0x8
178
179//ValueMotion communication status bits
180#define NIMC_VALUEMOTION_HARDWARE_FAIL 0x40
181#define NIMC_VALUEMOTION_FUNCTION_ERROR 0x10
182#define NIMC_VALUEMOTION_PREVIOUS_FUNCTION_ERROR 0x80
183
184
185#define NIMC_KP 0
186#define NIMC_KI 1
187#define NIMC_IL 2
188#define NIMC_KD 3
189#define NIMC_TD 4
190#define NIMC_KV 5
191#define NIMC_AFF 6
192#define NIMC_VFF 7
193#define NIMC_KS_POS 8
194#define NIMC_KS_NEG 9
195
196#define NIMC_BOTH 0
197#define NIMC_ACCELERATION 1
198#define NIMC_ACCEL NIMC_ACCELERATION
199#define NIMC_DECELERATION 2
200#define NIMC_DECEL NIMC_DECELERATION
201
202#define NIMC_RUN_STOP_STATUS 0
203#define NIMC_MOTOR_OFF_STATUS 1
204#define NIMC_VELOCITY_THRESHOLD_STATUS 2
205#define NIMC_MOVE_COMPLETE_STATUS 3
206
207#define NIMC_DECEL_STOP 0
208#define NIMC_HALT_STOP 1
209#define NIMC_KILL_STOP 2
210
211#define NIMC_LIMIT_INPUTS 0
212#define NIMC_SOFTWARE_LIMITS 1
213
214#define NIMC_OBJECT_SAVE 0
215#define NIMC_OBJECT_DELETE 1
216#define NIMC_OBJECT_FREE 2
217
218#define NIMC_SEND_COMMAND 0
219#define NIMC_SEND_AND_READ 1
220#define NIMC_READ_RDB 2
221
222#define NIMC_WAIT 0
223#define NIMC_WAIT_OR 1
224
225#define NIMC_OPEN_LOOP 0
226#define NIMC_CLOSED_LOOP 1
227
228#define NIMC_MATCH_ALL 0
229#define NIMC_MATCH_ANY 1
230
231#define NIMC_PROGRAM_DONE 0
232#define NIMC_PROGRAM_PLAYING 1
233#define NIMC_PROGRAM_PAUSED 2
234#define NIMC_PROGRAM_STORING 3
235
236//Condition Codes for FlexMotion flex_wait_on_condition() and
237//flex_jump_label_on_condition()
238#define NIMC_CONDITION_LESS_THAN 0 // Less Than
239#define NIMC_CONDITION_EQUAL 1 // Equal
240#define NIMC_CONDITION_LESS_THAN_OR_EQUAL 2 // Less Than or Equal to
241#define NIMC_CONDITION_GREATER_THAN 3 // Greater Than
242#define NIMC_CONDITION_NOT_EQUAL 4 // Not Equal
243#define NIMC_CONDITION_GREATER_THAN_OR_EQUAL 5 // Greater Than or Equal
244#define NIMC_CONDITION_TRUE 6 // TRUE (default)
245#define NIMC_CONDITION_HOME_FOUND 7 // Home Found sequence completed
246#define NIMC_CONDITION_INDEX_FOUND 8 // Index Found on Axes
247#define NIMC_CONDITION_HIGH_SPEED_CAPTURE 9 // High Speed Capt on Axes
248#define NIMC_CONDITION_POSITION_BREAKPOINT 10 // Position breakpoint on Axes
249#define NIMC_CONDITION_ANTICIPATION_TIME_BREAKPOINT 11 // Anticipation Time Breakpoint
250#define NIMC_CONDITION_VELOCITY_THRESHOLD 12 // Velocity Breakpoint
251#define NIMC_CONDITION_MOVE_COMPLETE 13 // Move Complete
252#define NIMC_CONDITION_PROFILE_COMPLETE 14 // Profile Complete
253#define NIMC_CONDITION_BLEND_COMPLETE 15 // Blend Complete
254#define NIMC_CONDITION_MOTOR_OFF 16 // Motor Off
255#define NIMC_CONDITION_HOME_INPUT_ACTIVE 17 // Home Active
256#define NIMC_CONDITION_LIMIT_INPUT_ACTIVE 18 // Limit Active
257#define NIMC_CONDITION_SOFTWARE_LIMIT_ACTIVE 19 // Software Limit Active
258#define NIMC_CONDITION_PROGRAM_COMPLETE 20 // Program has run to completion
259#define NIMC_CONDITION_IO_PORT_MATCH 21 // IO port match
260
261// Operation Modes
262#define NIMC_ABSOLUTE_POSITION 0
263#define NIMC_RELATIVE_POSITION 1
264#define NIMC_VELOCITY 2
265#define NIMC_RELATIVE_TO_CAPTURE 3
266#define NIMC_MODULUS_POSITION 4
267#define NIMC_ABSOLUTE_CONTOURING 5
268#define NIMC_RELATIVE_CONTOURING 6
269
270// ValueMotion breakpoint constants
271#define NIMC_POSITION_BREAKPOINT 0
272#define NIMC_ANTICIPATION_TIME_BREAKPOINT 1
273
274// FlexMotion breakpoint constants
275#define NIMC_BREAKPOINT_OFF 0
276#define NIMC_ABSOLUTE_BREAKPOINT 1
277#define NIMC_RELATIVE_BREAKPOINT 2
278#define NIMC_MODULO_BREAKPOINT 3
279
280#define NIMC_NO_CHANGE 0
281#define NIMC_RESET_BREAKPOINT 1
282#define NIMC_SET_BREAKPOINT 2
283#define NIMC_TOGGLE_BREAKPOINT 3
284
285#define NIMC_OPERATION_SINGLE 0
286#define NIMC_OPERATION_BUFFERED 1
287
288// FlexMotion regeneration mode constants for write_buffer
289#define NIMC_REGENERATION_NO_CHANGE 0
290#define NIMC_REGENERATION_LAST_WRITE 1
291
292// FlexMotion high-speed capture constants
293#define NIMC_HS_NON_INVERTING_LEVEL 0
294#define NIMC_HS_INVERTING_LEVEL 1
295#define NIMC_HS_LOW_TO_HIGH_EDGE 2
296#define NIMC_HS_HIGH_TO_LOW_EDGE 3
297#define NIMC_HS_NON_INVERTING_DI 4
298#define NIMC_HS_INVERTING_DI 5
299
300// These are used for getting error descriptions
301#define NIMC_ERROR_ONLY 0
302#define NIMC_FUNCTION_NAME_ONLY 1
303#define NIMC_RESOURCE_NAME_ONLY 2
304#define NIMC_COMBINED_DESCRIPTION 3
305
306// ADC range constants
307#define NIMC_ADC_UNIPOLAR_5 0
308#define NIMC_ADC_BIPOLAR_5 1
309#define NIMC_ADC_UNIPOLAR_10 2
310#define NIMC_ADC_BIPOLAR_10 3
311
312// RTSI constants (destination)
313#define NIMC_RTSI0 0
314#define NIMC_RTSI1 1
315#define NIMC_RTSI2 2
316#define NIMC_RTSI3 3
317#define NIMC_RTSI4 4
318#define NIMC_RTSI5 5
319#define NIMC_RTSI6 6
320#define NIMC_PXI_STAR_TRIGGER 7
321#define NIMC_HS_CAPTURE1 8
322#define NIMC_HS_CAPTURE2 9
323#define NIMC_HS_CAPTURE3 10
324#define NIMC_HS_CAPTURE4 11
325
326// RTSI constants (source)
327#define NIMC_TRIGGER_INPUT 8
328#define NIMC_BREAKPOINT1 9
329#define NIMC_BREAKPOINT2 10
330#define NIMC_BREAKPOINT3 11
331#define NIMC_BREAKPOINT4 12
332#define NIMC_RTSI_SOFTWARE_PORT 13
333#define NIMC_DONT_DRIVE 14
334#define NIMC_BREAKPOINT5 15
335#define NIMC_BREAKPOINT6 16
336#define NIMC_PHASE_A1 17
337#define NIMC_PHASE_A2 18
338#define NIMC_PHASE_A3 19
339#define NIMC_PHASE_A4 20
340#define NIMC_PHASE_A5 21
341#define NIMC_PHASE_A6 22
342#define NIMC_PHASE_B1 23
343#define NIMC_PHASE_B2 24
344#define NIMC_PHASE_B3 25
345#define NIMC_PHASE_B4 26
346#define NIMC_PHASE_B5 27
347#define NIMC_PHASE_B6 28
348#define NIMC_INDEX1 29
349#define NIMC_INDEX2 30
350#define NIMC_INDEX3 31
351#define NIMC_INDEX4 32
352#define NIMC_INDEX5 33
353#define NIMC_INDEX6 34
354
355/* These are the base CTRL values for resourses.*/
356#define NIMC_AXIS_CTRL 0x00
357#define NIMC_VECTOR_SPACE_CTRL 0x10
358#define NIMC_ENCODER_CTRL 0x20
359#define NIMC_DAC_CTRL 0x30
360#define NIMC_STEP_OUTPUT_CTRL 0x40
361#define NIMC_ADC_CTRL 0x50
362#define NIMC_IO_PORT_CTRL 0x00
363#define NIMC_PWM_CTRL 0x00
364#define NIMC_PROGRAM_CTRL 0x00
365
366#define NIMC_AXIS1 0x01
367#define NIMC_AXIS2 0x02
368#define NIMC_AXIS3 0x03
369#define NIMC_AXIS4 0x04
370#define NIMC_AXIS5 0x05
371#define NIMC_AXIS6 0x06
372
373#define NIMC_VECTOR_SPACE1 0x11
374#define NIMC_VECTOR_SPACE2 0x12
375#define NIMC_VECTOR_SPACE3 0x13
376
377#define NIMC_ENCODER1 0x21
378#define NIMC_ENCODER2 0x22
379#define NIMC_ENCODER3 0x23
380#define NIMC_ENCODER4 0x24
381#define NIMC_ENCODER5 0x25
382#define NIMC_ENCODER6 0x26
383
384#define NIMC_DAC1 0x031
385#define NIMC_DAC2 0x032
386#define NIMC_DAC3 0x033
387#define NIMC_DAC4 0x034
388#define NIMC_DAC5 0x035
389#define NIMC_DAC6 0x036
390
391#define NIMC_STEP_OUTPUT1 0x41
392#define NIMC_STEP_OUTPUT2 0x42
393#define NIMC_STEP_OUTPUT3 0x43
394#define NIMC_STEP_OUTPUT4 0x44
395#define NIMC_STEP_OUTPUT5 0x45
396#define NIMC_STEP_OUTPUT6 0x46
397
398#define NIMC_ADC1 0x51
399#define NIMC_ADC2 0x52
400#define NIMC_ADC3 0x53
401#define NIMC_ADC4 0x54
402#define NIMC_ADC5 0x55
403#define NIMC_ADC6 0x56
404#define NIMC_ADC7 0x57
405#define NIMC_ADC8 0x58
406
407#define NIMC_IO_PORT1 0x01
408#define NIMC_IO_PORT2 0x02
409#define NIMC_IO_PORT3 0x03
410
411#define NIMC_PWM1 0x01
412#define NIMC_PWM2 0x02
413
414// These constants are used by flex_enable_axes to set the PID rate.
415#define NIMC_PID_RATE_62_5 0
416#define NIMC_PID_RATE_125 1
417#define NIMC_PID_RATE_188 2
418#define NIMC_PID_RATE_250 3
419#define NIMC_PID_RATE_313 4
420#define NIMC_PID_RATE_375 5
421#define NIMC_PID_RATE_438 6
422#define NIMC_PID_RATE_500 7
423
424#define NIMC_FORWARD_DIRECTION 0
425#define NIMC_REVERSE_DIRECTION 1
426
427#define NIMC_OUTPUT 0
428#define NIMC_INPUT 1
429
430//Communication Status Register bits
431#define NIMC_READY_TO_RECEIVE 0x01 //Ready to receive
432#define NIMC_DATA_IN_RDB 0x02 //Data in return data buffer
433#define NIMC_PACKET_ERROR 0x10 //Packet error
434#define NIMC_POWER_UP_RESET 0x20 //Power up Reset
435#define NIMC_MODAL_ERROR_MSG 0x40 //Modal error message
436#define NIMC_HARDWARE_FAIL 0x80 //Hardware Fail bit
437
438
439//Read Axis Status bits
440#define NIMC_RUN_STOP_BIT 0x0001 //Axis running bit
441#define NIMC_PROFILE_COMPLETE_BIT 0x0002 //Profile complete bit in 'per Axis' hardware status
442#define NIMC_AXIS_OFF_BIT 0x0004 //Motor off bit
443#define NIMC_FOLLOWING_ERROR_BIT 0x0008 //Following error bit
444#define NIMC_LIMIT_SWITCH_BIT 0x0010 //Hardware Limit
445#define NIMC_HOME_SWITCH_BIT 0x0020 //Home switch bit
446#define NIMC_SW_LIMIT_BIT 0x0040 //Software Limit
447#define NIMC_VELOCITY_THRESHOLD_BIT 0x0100 //Velocity threshold
448#define NIMC_POS_BREAKPOINT_BIT 0x0200 //Position Breakpoint
449#define NIMC_HOME_FOUND_BIT 0x0400 //Home Found
450#define NIMC_INDEX_FOUND_BIT 0x0800 //Index Found
451#define NIMC_HIGH_SPEED_CAPTURE_BIT 0x1000 //High Speed capture
452#define NIMC_DIRECTION_BIT 0x2000 //Direction
453#define NIMC_BLEND_STATUS_BIT 0x4000 //Blend Status
454#define NIMC_MOVE_COMPLETE_BIT 0x8000 //Move Complete
455
456//Gearing Mode constants
457#define NIMC_ABSOLUTE_GEARING 0 //Absolute gearing
458#define NIMC_RELATIVE_GEARING 1 //Relative gearing
459
460//Load Counts/Steps per Revolution constants
461#define NIMC_COUNTS 0
462#define NIMC_STEPS 1
463
464#define NIMC_MAX_FILENAME_LEN 256 // includes nulls byte
465
466#define NIMC_ENABLE_1394_WATCHDOG 1 //Enables the communication watchdog on the
467 //1394 motherboard
468#define NIMC_DISABLE_1394_WATCHDOG 0 //Disables the communication watchdog on the
469 //1394 motherboard
470
471// Buffered Operations Constants
472#define NIMC_GENERAL_PURPOSE_INPUT 0
473#define NIMC_GENERAL_PURPOSE_OUTPUT 1
474#define NIMC_POSITION_DATA 2
475#define NIMC_BREAKPOINT_DATA 3
476#define NIMC_HS_CAPTURE_READBACK 4
477
478// Contouring Points Constants
479#define NIMC_MIN_CONTOURING_INTERVAL 10 // 10 ms
480#define NIMC_MAX_CONTOURING_INTERVAL 90.5 // PID rate of 500 us with splinePoints = 181
481#define NIMC_MAX_SPLINE_POINTS 181 // sqrt(2^15) --
482 // Precondition on DSP code, DX^2 <= 2^15
483
484// Buffer states
485#define NIMC_BUFFER_NOT_EXIST 0
486#define NIMC_BUFFER_READY 1
487#define NIMC_BUFFER_ACTIVE 2
488#define NIMC_BUFFER_DONE 3
489#define NIMC_BUFFER_OLDDATASTOP 4
490
491// informationType Constants for getu32/setu32 functions.
492#define NIMC_BUS_TIMEOUT 256 // Attribute specifying the time out value for remote device
493#define NIMC_BP_WINDOW 512 // Attribute specifying the window for enabling breakpoint
494#define NIMC_PROGRAM_AUTOSTART 768 // Attribute specifying the program that is enabled for auto start
495#define NIMC_PULL_IN_WINDOW 1024 // Attribute specifying the deadband around the target position for a
496 // pull in move (closed loop stepper only).
497#define NIMC_PULL_IN_TRIES 1025 // Attribute specifying the number of tries to pull in a closed loop
498 // stepper move in the target position is not reached.
499#define NIMC_STICTION_MODE 1030 // Attribute the mode of stiction compensation.
500#define NIMC_STICTION_MAX_DEADBAND 1031 // Attribute to set the stiction max deadband (where pid gains reconnected).
501#define NIMC_STICTION_MIN_DEADBAND 1032 // Attribute to set the stiction min deadband (where pid gains disconnected).
502#define NIMC_STICTION_ITERM_OFFSET_FWD 1033 // Attribute to set postive integral error offset (for forward direction).
503#define NIMC_STICTION_ITERM_OFFSET_REV 1034 // Attribute to set negative integral offset (for reverse direction).
504
505//Object Types
506#define NIMC_OBJECT_TYPE_PROGRAM 1
507#define NIMC_OBJECT_TYPE_BUFFER 2
508
509// Pull in Constants (Closed Loop Stepper Only)
510#define NIMC_MAX_PULL_IN_WINDOW 32767
511#define NIMC_MAX_PULL_IN_TRIES 32767
512
513// Stiction parameters (Servo only)
514// Modes
515#define NIMC_STICTION_OFF 0
516#define NIMC_STICTION_ZERO_DAC 1
517#define NIMC_STICTION_KILL 2
518
519
520#endif // ___motncnst_h___
long i32
Definition: MotnCnst.h:35
unsigned long u32
Definition: MotnCnst.h:24
float f32
Definition: MotnCnst.h:37
long tBoolean
Definition: MotnCnst.h:38
double f64
Definition: MotnCnst.h:36
unsigned short u16
Definition: MotnCnst.h:23
char i8
Definition: MotnCnst.h:33
unsigned char u8
Definition: MotnCnst.h:22
short i16
Definition: MotnCnst.h:34