// ************************************************************** // // // UMAC.H // // Seva Kaplounenko, Stanford Linear Accelerator Center // 6/28/2006 // #ifndef __UMAC_HEADER #define __UMAC_HEADER #define TRUE 1 //added 02/28/2014 #define FALSE 0 //added 02/28/2014 #if defined(__cplusplus) || defined(__cplusplus__) extern "C" { #endif /////////////////////////////////////////////////////////////////////////// //////////////////////// axis parameters structure //////////////////////// /////////////////////////////////////////////////////////////////////////// #define UMAC_NUM_AXIS 9 typedef struct tag_UMAC_PARAM_STRUCT { //UMAC settings int cs_counts_per_mm ; //coordinate system setting unsigned int position_scale_factor; //ix08 * 32 take at init int axis_on; //enrgize drive (1 -enable 0-disable drive double velocity; //m/s double acceleration; //m/s*s //curently are not supported, use PWIN software instead double home_velocity; double home_acceleration; int home_direction; double init_offset; //needed to X and Y axes to proper initialize fpga //end of not implemented variables } UMAC_PARAM_STRUCT; typedef UMAC_PARAM_STRUCT *LPUMAC_PARAM_STRUCT; //axes definitions for UMAC controller //#define umac_z 1 //#define umac_x 2 //#define umac_y 3 //#define umac_w 4 /*#define umac_z 1 #define umac_x 3 #define umac_y 2 #define umac_w 4*/ #define umac_z 1 #define umac_y 2 #define umac_x 3 #define umac_zp 4 #define umac_a 5 #define umac_v 6 #define umac_w 7 #define umac_b 8 #define umac_c 9 //Modified on 03/28/2014 // ************************************************************** // PUBLIC FUNCTION DECLARATIONS void umac_set_soft_positive_limit( DWORD id, int motor, double limit); DWORD umac_init (DWORD dev_id, int *ID, UMAC_PARAM_STRUCT pParam[]); void umac_exit (DWORD dev_ID); BOOL umac_command (DWORD id,char * result , int rlength, char * command ); int umac_get_axis ( DWORD id); void umac_set_axis ( DWORD id , int axis); double umac_get_velocity ( DWORD id, int motor); void umac_set_velocity ( DWORD id, int motor, double velocity); double umac_get_acceleration ( DWORD id, int motor); void umac_set_acceleration ( DWORD id, int motor, double acceleration); double umac_get_distance ( DWORD id, int motor); void umac_set_distance ( DWORD id, int motor, double distance); BOOL umac_get_mot_position ( DWORD dev_ID, int axis, double* pos); BOOL umac_get_mot_status ( DWORD dev_ID, int axis, unsigned long * status_x, unsigned long * status_y); BOOL umac_get_cs_status ( DWORD dev_ID, int cs, unsigned long * status_x, unsigned long * status_y1, unsigned long * status_y2); BOOL umac_set_controller_zero( DWORD dev_ID, int axis,double position); BOOL umac_rel_move ( DWORD dev_ID, int axis, double acc, double vel, double dis); BOOL umac_abs_move ( DWORD dev_ID, int axis, double acc, double vel, double pos); void umac_go_home ( DWORD dev_ID, int axis, double acc, double vel); BOOL umac_get_mot_position ( DWORD dev_ID, int axis, double* pos); BOOL umac_zero ( DWORD dev_ID, int axis); BOOL umac_AxisIsMoving ( DWORD dev_ID, int axis); BOOL umac_set_z_break_manual ( DWORD id, BOOL state); int umac_LimitSwitchesStatus( DWORD dev_ID, int axis); int umac_homing ( DWORD dev_ID, int axis,int homing_direction); int umac_moveToLimit ( DWORD dev_ID, int axis,int moving_direction, double acc, double vel, double step, double offset); void umac_set_position ( DWORD dev_ID, int axis, double position); void umac_getParameters ( LPUMAC_PARAM_STRUCT pParam , int axis); void umac_setParameters ( LPUMAC_PARAM_STRUCT pParam , int axis); int umac_is_dev_open ( DWORD dev_id ); void umac_add_log (char buf[], BOOL newline ); //Motor status definitions #define MOTOR_INPOSITION_Y 0 #define MOTOR_HOME_COMPLETE_Y 10 #define MOTOR_STOP_POS_LIMIT_Y 11 #define MOTOR_DESIRED_VELOCITY0_X 13 #define MOTOR_MOVE_TIMER_ACTIVE_X 17 #define MOTOR_OPEN_LOOP_X 18 #define MOTOR_AMPLIFIER_ENABLED_X 19 #define MOTOR_POSITIVE_LIMIT_SET_X 21 #define MOTOR_NEGATIVE_LIMIT_SET_X 22 #define MOTOR_ACTIVATED_X 23 //Coordinate system status definitions #define CS_INPOSITION_Y1 17 #define CS_RUNPROGRAM_X 0 /* ************************************************************** */ /* SEMI-PERMANENT PARAMETERS */ #define UMAC_MAX_NUM_DEV 1 //to increase redo global parameters structure #define UMAC_MAX_CMD 256 /* ************************************************************** */ /* DONE */ #if defined(__cplusplus) || defined(__cplusplus__) } #endif #endif