// i8094_dll.h : main header file for the I8094_DLL DLL
//

#ifndef _I8094_DLL_H_
#define _I8094_DLL_H_

#include "i8094_localtypes.h"

//================================================================================
// Axis define
#define AXIS_X 				0x1
#define AXIS_Y 				0x2
#define AXIS_Z 				0x4
#define AXIS_U 				0x8

#ifndef AXES_IN_I8094
   #define AXES_IN_I8094		4
#endif

#ifndef PARAMETER_IGNORED
   #define PARAMETER_IGNORED		0xFF
#endif

#define MOVE_DIRECTION_FORWARD		1
#define MOVE_DIRECTION_REVERSE		0

#define FEEDBACK_SRC_LOGIC_COMMAND	0x0
#define FEEDBACK_SRC_ENCODER_POSITION	0x1

#define MOTION_DONE			1
#define MOTION_NOT_DONE			0

//---------------------------------------------------------------------------------

#define CMPSRC_LOGIC_POSITION		0x00
#define CMPSRC_ENCODE_POSITION		0x01

#define COMP_PLUS_REGISTER		0x00
#define COMP_MINUS_REGISTER		0x01

// Status Codes
#define   YES    1
#define   NO     0
#define   ON     1
#define   OFF    0

#define LOGIC_ACTIVE_LOW		0x0
#define LOGIC_ACTIVE_HIGH		0x1

#define SERVO_OFF			0x0
#define SERVO_ON			0x1

#define DISABLE_FEATURE			0x0
#define ENABLE_FEATURE			0x1

#define MOVE_FORWARD			0x1
#define MOVE_REVERSE 			0x0

#define STOP_SLOWDOWN			0x26
#define STOP_SUDDEN			0x27

#define RATIO2_OPPOSITE_DIRECTION	0x1
#define RATIO2_SAME_DIRECTION		0x0


// Filter Configuration
#define INT_EVENT_ENABLE_FEATURE	ENABLE_FEATURE 
#define INT_EVENT_DISABLE_FEATURE	DISABLE_FEATURE

// Output Pulse Configuration
#define PULSE_MODE_CW_CCW		0x0000
#define PULSE_MODE_PULSE_DIRECTION	0x0040

#define PULSE_LOGIC_ACTIVE_HIGH		0x0000
#define PULSE_LOGIC_ACTIVE_LOW		0x0080

#define PULSE_FORWARD_ACTIVE_LOW	0x0000
#define PULSE_FORWARD_ACTIVE_HIGH	0x0100

//Encoder Configuration
#define ENCODER_MODE_AB			0x0000  // Quadrature pulse input
#define ENCODER_MODE_AB_DIVID_2		0x0400
#define ENCODER_MODE_AB_DIVID_4		0x0800
#define ENCODER_MODE_CW_CCW		0x0200	// Up/Down pulse input

// Hardware Limit Configuration
#define LIMIT_STOP_SUDDEN		0x0000
#define LIMIT_STOP_SLOWDOWN		0x0004

#define LIMIT_LOGIC_ACTIVE_LOW		0x0000
#define LIMIT_LOGIC_ACTIVE_HIGH		0x0018


// Software Limit Configuration
#define SW_LIMIT_ENABLE_FEATURE		0x0003 
#define SW_LIMIT_DISABLE_FEATURE	0x0000

#define SW_LIMIT_CMP_SRC_LOGIC_COMMAND		0x0000
#define SW_LIMIT_CMP_SRC_ENCODER_POSITION	0x0020


// INP Configuration
#define INP_ENABLE_FEATURE		0x8000
#define INP_DISABLE_FEATURE		0x0000

#define INP_LOGIC_ACTIVE_HIGH		0x4000
#define INP_LOGIC_ACTIVE_LOW		0x0000

// ALARM Configuration
#define ALARM_ENABLE_FEATURE		0x2000
#define ALARM_DISABLE_FEATURE		0x0000

#define ALARM_LOGIC_ACTIVE_HIGH		0x1000
#define ALARM_LOGIC_ACTIVE_LOW		0x0000

// IN3 Configuration
#define IN3_ENABLE_FEATURE		0x0080
#define IN3_DISABLE_FEATURE		0x0000

#define IN3_LOGIC_ACTIVE_HIGH		0x0040
#define IN3_LOGIC_ACTIVE_LOW		0x0000

// Variable Ring Command/Encoder Counter
#define VARIABLE_RING_ENABLE_FEATURE	0x0010
#define VARIABLE_RING_DISABLE_FEATURE	0x0000

// (fixed-pulse Trapezodal motion) Avoid Triangle feature
#define AVOID_TRIANGLE_ENABLE_FEATURE	0x0008
#define AVOID_TRIANGLE_DISABLE_FEATURE	0x0000

// Filter Configuration
#define FILTER_ENABLE_FEATURE		ENABLE_FEATURE 
#define FILTER_DISABLE_FEATURE		DISABLE_FEATURE

#define FILTER_CFG_EMG_EL_ORG_NORG	0x0100
#define FILTER_CFG_ENCODER_Z_PHASE	0x0200
#define FILTER_CFG_INP_ALARM		0x0400
#define FILTER_CFG_EXP_EXPLSN		0x0800
#define FILTER_CFG_IN3			0x1000

#define FILTER_DELAY_2us		0x0000 
#define FILTER_DELAY_256us		0x2000
#define FILTER_DELAY_512us		0x4000
#define FILTER_DELAY_1024us		0x6000
#define FILTER_DELAY_2048us		0x8000
#define FILTER_DELAY_4096us		0xA000
#define FILTER_DELAY_8192us		0xC000
#define FILTER_DELAY_16384us		0xE000

// IN0/NHOME Configuration
#define NHOME_LOGIC_ACTIVE_HIGH		0x0001
#define NHOME_LOGIC_ACTIVE_LOW		0x0000

// IN1/HOME Configuration
#define HOME_LOGIC_ACTIVE_HIGH		0x0004
#define HOME_LOGIC_ACTIVE_LOW		0x0000

// IN2/INDEX Configuration
#define INDEX_LOGIC_ACTIVE_HIGH		0x0010
#define INDEX_LOGIC_ACTIVE_LOW		0x0000

// Auto-Homing Steps Configuration
#define AUTO_HOME_STEP1_DISABLE		0x0000
#define AUTO_HOME_STEP1_FORWARD		0x0001
#define AUTO_HOME_STEP1_REVERSE		0x0003

#define AUTO_HOME_STEP2_DISABLE		0x0000
#define AUTO_HOME_STEP2_FORWARD		0x0004 
#define AUTO_HOME_STEP2_REVERSE		0x000C

#define AUTO_HOME_STEP3_DISABLE		0x0000
#define AUTO_HOME_STEP3_FORWARD		0x0010
#define AUTO_HOME_STEP3_REVERSE		0x0030

#define AUTO_HOME_STEP4_DISABLE		0x0000
#define AUTO_HOME_STEP4_FORWARD		0x0040
#define AUTO_HOME_STEP4_REVERSE		0x00C0

// External Signal Configuration
#define EXP_DISABLE_FEATURE		0x0000
#define EXP_AB_PHASE_MPG		0x0018
#define EXP_FIXED_PULSE_START 		0x0010
#define EXP_CW_CCW_ACTIVE_LOW_MPG	EXP_FIXED_PULSE_START
#define EXP_CONTI_MOVE_ACTIVE		0x0008


#define CMP_SRC_LOGIC_COMMAND		0x0000
#define CMP_SRC_ENCODER_POSITION	0x0020

// Synchronous Action Configuration
#define SYNC_ENABLE_FEATURE		ENABLE_FEATURE
#define SYNC_DISABLE_FEATURE		DISABLE_FEATURE

// Synchronization Factor/Provocative
#define SYNC_CONDITION_NONE			0x0000
#define SYNC_CONDITION_EXCEED_CMP_POSITIVE	0x0001
#define SYNC_CONDITION_LESS_CMP_POSITIVE	0x0002
#define SYNC_CONDITION_LESS_CMP_NEGATIVE	0x0004
#define SYNC_CONDITION_EXCEED_CMP_NEGATIVE	0x0008
#define SYNC_CONDITION_START_DRIVING		0x0010
#define SYNC_CONDITION_END_DRIVING		0x0020
#define SYNC_CONDITION_IN3_RAISING_EDGE		0x0040
#define SYNC_CONDITION_IN3_FALLING_EDGE		0x0080

#define SYNC_CONDITION_MASK_CMP_POSITIVE	( SYNC_CONDITION_EXCEED_CMP_POSITIVE | SYNC_CONDITION_LESS_CMP_POSITIVE )
#define SYNC_CONDITION_MASK_CMP_NEGATIVE	( SYNC_CONDITION_LESS_CMP_NEGATIVE | SYNC_CONDITION_EXCEED_CMP_NEGATIVE )
#define SYNC_CONDITION_MASK_VALID_COMPARATORS   0x000F
#define SYNC_CONDITION_VALID_MASK		(~0x003F)

// Synchronization Action
#define SYNC_ACTION_NONE			0x0000
#define SYNC_ACTION_FIXED_FORWARD_DRIVE		0x0001
#define SYNC_ACTION_FIXED_REVERSE_DRIVE		0x0002
#define SYNC_ACTION_CONTINUE_FORWARD_DRIVE	0x0004
#define SYNC_ACTION_CONTINUE_REVERSE_DRIVE	0x0008
#define SYNC_ACTION_SLOWDOWN_STOP		0x0010
#define SYNC_ACTION_SUDDEN_STOP			0x0020
#define SYNC_ACTION_LOGIC_CMD_LATCH		0x0040
#define SYNC_ACTION_ENCODER_POS_LATCH		0x0080
#define SYNC_ACTION_WR6_WR7_TO_LOGIC_CMD	0x0100
#define SYNC_ACTION_WR6_WR7_TO_ENCORDER_POS	0x0200
#define SYNC_ACTION_WR6_WR7_TO_PULSE_REG	0x0400
#define SYNC_ACTION_WR6_TO_VELOCITY_REG		0x0800
//---------------------------------------------------------------------------------

// Interporation Arc move
#define INTERP_ARC_DIRECTION_CLOCKWISE		0x0032
#define INTERP_ARC_DIRECTION_COUNTER_CLOCKWISE  0x0033

// Interporation Continue feature
#define INTERP_CONTINUE_ENABLE_FEATURE		ENABLE_FEATURE
#define INTERP_CONTINUE_DISABLE_FEATURE		DISABLE_FEATURE

// Interporation Continue feature
#define INTERP_CONTINUE_START			0x0000
#define INTERP_NEXT_CONTINUOUS_MOTION		0x0001

#define INTERP_CONTINUE_STOP_CHECK_SKIP		0x0000
#define INTERP_CONTINUE_STOP_CHECK_NEED		0x0001

// INT Factors settings
#define INT_FACTOR_DISABLE			0x0000
#define INT_FACTOR_PULSE			0x0100
#define INT_FACTOR_EXCEED_CMP_NEGATIVE		0x0200
#define INT_FACTOR_LESS_CMP_NEGATIVE		0x0400
#define INT_FACTOR_LESS_CMP_POSITIVE		0x0800
#define INT_FACTOR_EXCEED_CMP_POSITIVE		0x1000
#define INT_FACTOR_END_CONST_SPEED_MOVE		0x2000
#define INT_FACTOR_START_CONST_SPEED_MOVE	0x4000
#define INT_FACTOR_END_DRIVING			0x8000
#define INT_FACTOR_END_AUTO_HOMING		0x0020
#define INT_FACTOR_SYNC_ACTION			0x0080 

// INT active status
#define INT_STATUS_PLUSE			0x0001
#define INT_STATUS_EXCEED_CMP_NEGATIVE		0x0002
#define INT_STATUS_LESS_CMP_NEGATIVE		0x0004
#define INT_STATUS_LESS_CMP_POSITIVE		0x0008
#define INT_STATUS_EXCEED_CMP_POSITIVE		0x0010
#define INT_STATUS_END_CONST_SPEED_MOVE		0x0020
#define INT_STATUS_START_CONST_SPEED_MOVE	0x0040
#define INT_STATUS_END_DRIVING			0x0080
#define INT_STATUS_END_AUTO_HOMING		0x0100
#define INT_STATUS_SYNC_ACTION			0x0200 

#define INT_STATUS_ENABLE_DIRECT_ACCESS		ENABLE_FEATURE
#define INT_STATUS_DISABLE_DIRECT_ACCESS	DISABLE_FEATURE

#ifdef _INTERRUPT_SUPOORT_
#define FRNET_PERIODIC_READING_ENABLE_FEATURE	ENABLE_FEATURE
#define FRNET_PERIODIC_READING_DISABLE_FEATURE	DISABLE_FEATURE
#endif // _INTERRUPT_SUPOORT_

#define FRNET_ENABLE_DIRECT_ACCESS		ENABLE_FEATURE 
#define FRNET_DISABLE_DIRECT_ACCESS		DISABLE_FEATURE



// FRNET configuration
#define FRNET_RA0				0x0
#define FRNET_RA1				0x1
#define FRNET_RA2				0x2
#define FRNET_RA3				0x3
#define FRNET_RA4				0x4
#define FRNET_RA5				0x5
#define FRNET_RA6				0x6
#define FRNET_RA7				0x7

#define FRNET_SA8				0x8
#define FRNET_SA9				0x9
#define FRNET_SA10				0xA
#define FRNET_SA11				0xB
#define FRNET_SA12				0xC
#define FRNET_SA13				0xD
#define FRNET_SA14				0xE
#define FRNET_SA15				0xF

#ifndef I8094_MaxModules
   #define I8094_MaxModules 8  /* for the Hardware ID */
#endif

#ifndef _DEF_I8094_AXIS_RANGE_SETTINGS
#define _DEF_I8094_AXIS_RANGE_SETTINGS

typedef struct _AXIS_RANGE_SETTINGS_
{
   DWORD AcceRate_Max; // for Jerk & Deceleration
   DWORD AcceRate_Min;
   DWORD Acce_Min; // for Acceleration & Deceleration
   DWORD Acce_Max;
   DWORD Speed_Min; // for Initial Speed & Driving Speed
   DWORD Speed_Max;
} AXIS_RANGE_SETTINGS, *PAXIS_RANGE_SETTINGS;

#endif // _DEF_I8094_AXIS_RANGE_SETTINGS


#ifdef __cplusplus
extern "C"
{
#endif

//============================================================================
//====================== I8094 DLL (V3.0) Release Functions===================
//============================================================================
// OS Configuration Routines
short i8094_scan
    (
    short* pCardNum,         /* pointer to available ICPDAS-I8094 cards */
    BYTE* pAvailModules      /* pointer to available module array */
    );

short i8094_get_cardinfo
    (
    int ScannedIndex,	/* PISO-VS600 scanned index, start with 0 */
    BYTE* pSlotNum,	/* pointer to Slot-Number */
    WORD* pModuleID     /* pointer to ModuleID */
    );

short i8094_open
    (
    BYTE bSlotNum         /* the specific Slot-Number that is configured by onboard DIP-switch */
    );

short i8094_close
    (
    BYTE bSlotNum         /* the specific Slot-Number that is configured by onboard DIP-switch */
    );

short i8094_reset
    (
    BYTE bSlotNum         /* the specific Slot-Number that is configured by onboard DIP-switch */
    );

short i8094_get_range_settings
    (
    BYTE bSlotNum,         /* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    AXIS_RANGE_SETTINGS* pAxisRangeSetting  /* the point to I8094_AXIS_CONFIG structure  */
    );

short i8094_set_range
    (
    BYTE bSlotNum,         /* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    DWORD dwRange         /* the valid dwRange value is 16000 ~ 8000000  */
    );

// Hardware Configuration Routines (Required)
short i8094_set_pls_cfg
    (
    BYTE bSlotNum,         /* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    WORD wPulseMode,      /* pulse mode: the settings will be PULSE_MODE_CW_CCW or PULSE_MODE_PULSE_DIRECTION  */
    WORD wPulseLogic,     /* pulse polarity: the settings will be PULSE_LOGIC_ACTIVE_HIGH or PULSE_LOGIC_ACTIVE_LOW */
    WORD wDirectionLogic  /* direction polarity: the settings will be PULSE_FORWARD_ACTIVE_HIGH or PULSE_FORWARD_ACTIVE_LOW. This setting is valid for PULSE_MODE_PULSE_DIRECTION mode */
    );

short i8094_set_enc_cfg
    (
    BYTE bSlotNum,         /* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    WORD wEncoderMode,    /* encoder mode: the settings will be ENCODER_MODE_AB, ENCODER_MODE_AB_DIVID_2, ENCODER_MODE_AB_DIVID_4 or ENCODER_MODE_CW_CCW  */
    BYTE bCounterSource   /* this setting is reserved and ignored */
    );

short i8094_set_limit
    (
    BYTE bSlotNum,         /* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    WORD wLimitLogic,     /* EL(Limit Sensor) polarity: the settings will be LIMIT_LOGIC_ACTIVE_HIGH or LIMIT_LOGIC_ACTIVE_LOW */
    WORD wStopMode		  /* stop mode: the setting will be LIMIT_STOP_SUDDEN or LIMIT_STOP_SLOWDOWN */
    );

// Hardware Configuration Routines (Optional)
short i8094_set_inp
    (
    BYTE bSlotNum,         /* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    WORD wINPEnable,      /* INP_ENABLE_FEATURE/INP_DISABLE_FEATURE to enable/disable in-position signal */
    WORD wINPLogic		  /* in-position signal polarity: the setting will be INP_LOGIC_ACTIVE_HIGH or INP_LOGIC_ACTIVE_LOW */
    );

short i8094_set_alarm
    (
    BYTE bSlotNum,         /* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    WORD wAlarmEnable,    /* ALARM_ENABLE_FEATURE/ALARM_DISABLE_FEATURE to enable/disable in-position signal */
    WORD wAlarmLogic	  /* in-position signal polarity: the setting will be ALARM_LOGIC_ACTIVE_HIGH or ALARM_LOGIC_ACTIVE_LOW */
    );

short i8094_servo_on
    (
    BYTE bSlotNum,         /* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    BYTE bServoON,		  /* SERVO_ON/SERVO_OFF to switch on/off servo*/
    BYTE bAutoOFF		  /* i8094_close()/i8094_close_all() Turn off Servo */
    );

short i8094_load_config
    (
    char* FileName       /* pointer to pathname of configuration file */
    );

short i8094_set_filter
    (
    BYTE bSlotNum,         /* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    WORD wFilterEnable,	  /* FILTER_ENABLE_FEATURE/FILTER_DISABLE_FEATURE to enable/disable filter feature */
    WORD wFilterCfg,	  /* combanation of FILTER_CFG_EMG_EL_ORG_NORG, ... FILTER_CFG_IN3  */
    WORD wDelayTime	      /* FILTER_DELAY_2us, FILTER_DELAY_256us, ... FILTER_DELAY_8192us*/
    );

short i8094_set_softlimit
    (
    BYTE bSlotNum,         /* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    WORD SWLimitEnable,	  /* SW_LIMIT_ENABLE_FEATURE/SW_LIMIT_DISABLE_FEATURE to enable/disable filter feature */
    WORD wCmpSource,	  /* CMP_SRC_LOGIC_COMMAND/CMP_SRC_ENCODER_POSITION */
    long LimitPositive,	  /* -2147483647 ~ 2147483647 */
    long LimitNegaitive   /* -2147483647 ~ 2147483647 */
    );

// Home Operation
short i8094_set_home_cfg
    (
    BYTE bSlotNum,         /* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    WORD wHomeLogic,	  /* HOME_LOGIC_ACTIVE_HIGH/HOME_LOGIC_ACTIVE_LOW  */
    WORD wNHomeLogic,	  /* NHOME_LOGIC_ACTIVE_HIGH/NHOME_LOGIC_ACTIVE_LOW */
    WORD wIndexLogic,	  /* INDEX_LOGIC_ACTIVE_HIGH/INDEX_LOGIC_ACTIVE_LOW */
    WORD wHomeSteps,	  /* AUTO_HOME_STEP1_DISABLE, ... AUTO_HOME_STEP4_REVERSE */
	DWORD dwStep4Offset   /* the offset driving in Step4 */
    );

short i8094_home_start
    (
    BYTE bSlotNum,		/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,			/* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    DWORD dwStartSpeed,		/* Start Speed */
    DWORD dwAcceleration,	/* Acceleration */
    DWORD dwDeceleration,	/* Deceleration */
    DWORD dwNHomeSearchSpeed,	/* Driving Speed when Near-Home searching */
    DWORD dwHomeSearchSpeed,	/* Driving Speed after Near-Home sensor is active */
    WORD  wBlockMode		/* ENABLE_BLOCK_OPEARTION, DISABLE_BLOCK_OPEARTION */
    );

short i8094_velocity_move
    (
    BYTE bSlotNum,		/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,			/* can be combination of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    DWORD dwStartSpeed,		/* Start Speed */
    DWORD dwDriveSpeed,		/* Driving Speed */
    DWORD dwAcceleration,	/* Acceleration */
    BYTE  bDirection		/* MOVE_DIRECTION_FORWARD/MOVE_DIRECTION_REVERSE */
    );

short i8094_const_move
    (
    BYTE bSlotNum,		/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,			/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    DWORD dwDriveSpeed,		/* Driving Speed */
    long  FixedPulse		/* total driving pulse */
    );

short i8094_const_moveall
    (
    BYTE bSlotNum,		/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxes,			/* can be any combination of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    DWORD dwDriveSpeed[],	/* Driving Speed */
    long  FixedPulse[]		/* total driving pulse */
    );

short i8094_t_set_avtri
    (
    BYTE bSlotNum,		/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,			/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    WORD wAvTriCfg		/* Driving Speed */
    );

short i8094_t_change_v
    (
    BYTE bSlotNum,		/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,			/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    DWORD dwDriveSpeed,		/* Driving Speed */
    DWORD dwAcceleration,	/* Acceleration */
    DWORD dwDeceleration	/* Deceleration */
    );

short i8094_t_move
    (
    BYTE bSlotNum,		/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,			/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    DWORD dwStartSpeed,		/* Start Speed */
    DWORD dwDriveSpeed,		/* Driving Speed */
    DWORD dwAcceleration,	/* Acceleration */
    DWORD dwDeceleration,	/* Deceleration */
    long FixedPulse,		/* total driving pulse */
    short wAccCntOffset		/* Acceleration Counter Offset */
    );

short i8094_t_moveall
    (
    BYTE bSlotNum,		/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxes,			/* can be any combination of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    DWORD dwStartSpeed[],	/* Start Speed */
    DWORD dwDriveSpeed[],	/* Driving Speed */
    DWORD dwAcceleration[],	/* Acceleration */
    DWORD dwDeceleration[],	/* Deceleration */
    long FixedPulse[],	/* total driving pulse */
    short wAccCntOffset[]	/* Acceleration Counter Offset */
    );

short i8094_s_move
    (
    BYTE bSlotNum,		/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,			/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    DWORD dwStartSpeed,		/* Start Speed */
    DWORD dwDriveSpeed,		/* Driving Speed */
    DWORD dwAccelerationRate,	/* AccelerationRate, Jerk (K) */
    DWORD dwDecelerationRate,	/* Deceleration (L) */
    long FixedPulse,		/* total driving pulse */
    short wAccCntOffset		/* Acceleration Counter Offset */
    );

short i8094_s_moveall
    (
    BYTE bSlotNum,		/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxes,			/* can be any combination of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    DWORD dwStartSpeed[],	/* Start Speed */
    DWORD dwDriveSpeed[],	/* Driving Speed */
    DWORD dwAccelerationRate[],	/* Acceleration */
    DWORD dwDecelerationRate[],	/* Deceleration */
    long FixedPulse[],		/* total driving pulse */
    short wAccCntOffset[]	/* Acceleration Counter Offset */
    );

short i8094_t_line2_move
    (
    BYTE bSlotNum,		/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wMainAxis,		/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    WORD wSlaveAxis,		/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    DWORD dwStartSpeed,		/* Start Speed */
    DWORD dwDriveSpeed,		/* Driving Speed */
    DWORD dwAcceleration,	/* Acceleration */
    DWORD dwDeceleration,	/* Deceleration */
    long MainAxisFinishPoint,	/* Finish point of MainAxis */
    long SlaveAxisFinishPoint,	/* Finish point of SlaveAxis */
    short wAccCntOffset,	/* Acceleration Counter Offset, only valid for IntepStop = TRUE */
    WORD wBlockMode		/* ENABLE_BLOCK_OPEARTION/DISABLE_BLOCK_OPEARTION */
    );

short i8094_t_line3_move
    (
    BYTE bSlotNum,		/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wMainAxis,		/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    WORD wSecondAxis,		/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    WORD wThirdAxis,		/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    DWORD dwStartSpeed,		/* Start Speed */
    DWORD dwDriveSpeed,		/* Driving Speed */
    DWORD dwAcceleration,	/* Acceleration */
    DWORD dwDeceleration,	/* Deceleration */
    long MainAxisFinishPoint,	/* Finish point of MainAxis */
    long SecondAxisFinishPoint,	/* Finish point of 2nd Axis */
    long ThirdAxisFinishPoint,	/* Finish point of 3rd Axis */
    short wAccCntOffset,	/* Acceleration Counter Offset, only valid for IntepStop = TRUE */
    WORD wBlockMode		/* ENABLE_BLOCK_OPEARTION/DISABLE_BLOCK_OPEARTION */
    );

short i8094_s_line2_move
    (
    BYTE bSlotNum,		/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wMainAxis,		/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    WORD wSlaveAxis,		/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    DWORD dwStartSpeed,		/* Start Speed */
    DWORD dwDriveSpeed,		/* Driving Speed */
    DWORD dwAccelerationRate,	/* Acceleration */
    DWORD dwDecelerationRate,	/* Deceleration */
    long MainAxisFinishPoint,	/* Finish point of MainAxis */
    long SlaveAxisFinishPoint,	/* Finish point of SlaveAxis */
    short wAccCntOffset,	/* Acceleration Counter Offset, only valid for IntepStop = TRUE */
    WORD wBlockMode		/* ENABLE_BLOCK_OPEARTION/DISABLE_BLOCK_OPEARTION */
    );

short i8094_s_line3_move
    (
    BYTE bSlotNum,		/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wMainAxis,		/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    WORD wSecondAxis,		/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    WORD wThirdAxis,		/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    DWORD dwStartSpeed,		/* Start Speed */
    DWORD dwDriveSpeed,		/* Driving Speed */
    DWORD dwAccelerationRate,	/* Acceleration */
    DWORD dwDecelerationRate,	/* Deceleration */
    long MainAxisFinishPoint,	/* Finish point of MainAxis */
    long SecondAxisFinishPoint,	/* Finish point of 2nd Axis */
    long ThirdAxisFinishPoint,	/* Finish point of 3rd Axis */
    short wAccCntOffset,	/* Acceleration Counter Offset, only valid for IntepStop = TRUE */
    WORD wBlockMode		/* ENABLE_BLOCK_OPEARTION/DISABLE_BLOCK_OPEARTION */
    );

short i8094_t_arc2_move
    (
    BYTE bSlotNum,		/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wMainAxis,		/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    WORD wSlaveAxis,		/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    DWORD dwStartSpeed,		/* Start Speed */
    DWORD dwDriveSpeed,		/* Driving Speed */
    DWORD dwAcceleration,	/* Acceleration */
    WORD wArcDirection,		/* INTERP_ARC_DIRECTION_CLOCKWISE/INTERP_ARC_DIRECTION_COUNTER_CLOCKWISE */
    long MainAxisCenterPoint,	/* Center point of MainAxis */
    long SlaveAxisCenterPoint,	/* Center point of SlaveAxis */
    long MainAxisFinishPoint,	/* Finish point of MainAxis */
    long SlaveAxisFinishPoint,	/* Finish point of SlaveAxis */
    short wAccCntOffset,	/* Acceleration Counter Offset, only valid for IntepStop = TRUE */
    WORD wBlockMode		/* ENABLE_BLOCK_OPEARTION/DISABLE_BLOCK_OPEARTION */
    );

short i8094_conti_interp_begin
    (
    BYTE bSlotNum,		/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wMainAxis,		/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    WORD wSecondAxis,		/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    WORD wThirdAxis,		/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    DWORD dwConstSpeed		/* Constant Speed */
    );

short i8094_conti_interp_next_ready
    (
    BYTE bSlotNum,		/* the specific Slot-Number that is configured by onboard DIP-switch */
    BYTE *pReady		/* the pointer to indicate the Next-Interpolation is ready to set */ 
    );


short i8094_conti_line2_move
    (
    BYTE bSlotNum,		/* the specific Slot-Number that is configured by onboard DIP-switch */
    long MainAxisFinishPoint,	/* Finish point of MainAxis */
    long SlaveAxisFinishPoint,	/* Finish point of SlaveAxis */
    WORD wContiInterpMoveMode	/* INTERP_CONTINUE_START/INTERP_NEXT_CONTINUOUS_MOTION */		
    );

short i8094_conti_line3_move
    (
    BYTE bSlotNum,		/* the specific Slot-Number that is configured by onboard DIP-switch */
    long MainAxisFinishPoint,	/* Finish point of MainAxis */
    long SecondAxisFinishPoint,	/* Finish point of 2nd Axis */
    long ThirdAxisFinishPoint,	/* Finish point of 3rd Axis */
    WORD wContiInterpMoveMode	/* INTERP_CONTINUE_START/INTERP_NEXT_CONTINUOUS_MOTION */		
    );

short i8094_conti_arc2_move
    (
    BYTE bSlotNum,		/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wArcDirection,		/* INTERP_ARC_DIRECTION_CLOCKWISE/INTERP_ARC_DIRECTION_COUNTER_CLOCKWISE */
    long MainAxisCenterPoint,	/* Center point of MainAxis */
    long SlaveAxisCenterPoint,	/* Center point of SlaveAxis */
    long MainAxisFinishPoint,	/* Finish point of MainAxis */
    long SlaveAxisFinishPoint,	/* Finish point of SlaveAxis */
    WORD wContiInterpMoveMode	/* INTERP_CONTINUE_START/INTERP_NEXT_CONTINUOUS_MOTION */		
    );

short i8094_conti_interp_end
    (
    BYTE bSlotNum		/* the specific Slot-Number that is configured by onboard DIP-switch */
    ); 

short i8094_set_cmdcounter
    (
    BYTE bSlotNum,         	/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,           	/* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    long lData			/* the position count to be set into Logic Posistion Counter*/
    );

short i8094_set_enccounter
    (
    BYTE bSlotNum,         	/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,           	/* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    long lData			/* the position count to be set into Logic Posistion Counter*/
    );

short i8094_get_cmdcounter
    (
    BYTE bSlotNum,         	/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,           	/* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    long* pData			/* the pointer to the Logic Posistion Counter*/
    );

short i8094_get_enccounter
    (
    BYTE bSlotNum,         	/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,           	/* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    long* pData			/* the pointer to the Logic Posistion Counter*/
    );

short i8094_stop_move
    (
    BYTE bSlotNum,         	/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,           	/* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    WORD wStopMode		/* can be STOP_SLOWDOWN or STOP_SUDDEN */
    );

short i8094_drv_start
    (
    BYTE bSlotNum,         	/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxes            	/* can be any commbination of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    );

short i8094_drv_hold
    (
    BYTE bSlotNum,         	/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxes            	/* can be any commbination of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    );

short i8094_set_vring
    (
    BYTE   bSlotNum,         	/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD   wAxis,           	/* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    WORD   wVRINGEnable,    	/* VARIABLE_RING_ENABLE_FEATURE/VARIABLE_RING_DISABLE_FEATURE*/
    DWORD  dwRingValue		/* the maximum value of Ring-Counter (start from 0 and 0xFFFFFFFF is the max. value) */ 
    );

short i8094_set_mpg
    (
    BYTE   bSlotNum,           	/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD   wAxis,              	/* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    WORD   wEXPConfig,         	/* EXP_DISABLE_FEATURE/EXP_AB_PHASE_MPG//EXP_CW_CCW_FIXED_PULSE/EXP_CW_CCW_CONTI_MOVE*/
    DWORD  dwFixedPulse,       	/* the output pulse for MPG trigger for EXP_AB_PHASE_MPG/EXP_CW_CCW_FIXED_PULSE modes*/
    DWORD  dwSpeed,		/* the speed for constant pulse output */ 
    DWORD  dwMaxMPGFreq		/* the maximum frequency of Manual-Pulse-Generator */ 
    );

short i8094_set_synch
    (
    BYTE   bSlotNum,		/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD   wMainAxis,		/* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U */
    WORD   wSyncEnable,		/* SYNC_ENABLE_FEATURE/SYNC_DISABLE_FEATURE*/
    WORD   wSyncAxes,		/* can be combination of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U */
    WORD   wSyncCondition,	/* SYNC_CONDITION_EXCEED_CMP_POSITIVE ... SYNC_CONDITION_IN3_FALLING_EDGE */
    WORD   wSyncActionMainAxis,	/* the Sync. Action of own-Axis, SYNC_ACTION_FIXED_FORWARD_DRIVE ... SYNC_ACTION_WR6_TO_VELOCITY_REG */
    WORD   wSyncActionOtherAxes,/* the Sync. Action of other-Axes, SYNC_ACTION_FIXED_FORWARD_DRIVE ... SYNC_ACTION_WR6_TO_VELOCITY_REG */
    WORD   wCmpSource,		/* CMP_SRC_LOGIC_COMMAND/CMP_SRC_ENCODER_POSITION */
    DWORD  dwComparatorPositive,/* the value to be set to COMP+, only for SYNC_CONDITION_EXCEED_CMP_POSITIVE and SYNC_CONDITION_LESS_CMP_POSITIVE */
    DWORD  dwComparatorNegative	/* the value to be set to COMP-, only for SYNC_CONDITION_LESS_CMP_NEGATIVE and SYNC_CONDITION_EXCEED_CMP_NEGATIVE */
    );

short i8094_synch_t_move_cfg
    (
    BYTE  bSlotNum,		/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD  wAxis,		/* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U */
    DWORD dwStartSpeed,		/* Start Speed */
    DWORD dwDriveSpeed,		/* Driving Speed */
    DWORD dwAcceleration,	/* Acceleration */
    DWORD dwDeceleration,	/* Deceleration */
    long  FixedPulse		/* total driving pulse */
    );

short i8094_synch_s_move_cfg
    (
    BYTE  bSlotNum,		/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD  wAxis,		/* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U */
    DWORD dwStartSpeed,		/* Start Speed */
    DWORD dwDriveSpeed,		/* Driving Speed */
    DWORD dwAccelerationRate,	/* AccelerationRate, Jerk (K) */
    DWORD dwDecelerationRate,	/* Deceleration (L) */
    long FixedPulse		/* total driving pulse */    
    );

short i8094_set_int_factor
    (
    BYTE  bSlotNum,	/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD  wAxis,	/* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U */
    WORD  wIntFactor	/*INT_FACTOR_PULSE ... INT_FACTOR_SYNC_ACTION */
    );

#ifdef _WINCE_ 
short i8094_int_event_config
    (
    BYTE  bSlotNum,		/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD  wIntEventEnable,	/* INT_EVENT_ENABLE_FEATURE/INT_EVENT_DISABLE_FEATURE */
    HANDLE* pEventHandle	/* The HANDLE array that holds the Axis-relative Eevnt object */
    );
#endif // _WINCE_ 

short i8094_motion_done
    (
    BYTE bSlotNum,      /* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,         /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    BYTE* pDone,
    WORD* pStopStatus	/* the pointer to the Stop Status*/
    );

short i8094_get_speed
    (
    BYTE bSlotNum,      /* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,         /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U */
    DWORD* pSpeed	/* the pointer to the current speed */
    );

short i8094_get_acc
    (
    BYTE bSlotNum,      /* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,         /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U */
    DWORD* pAcc		/* the pointer to the current speed */
    );

short i8094_get_latch
    (
    BYTE bSlotNum,      /* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,         /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U */
    long* pLatchData	/* the pointer to the current speed */
    );

// Digital IO Status
short i8094_get_in3
    (
    BYTE bSlotNum,      /* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,         /* only one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    BYTE* pIN3Status	/* the pointer to the IN3 Status */
    );

short i8094_get_out1_status
    (
    BYTE bSlotNum,      /* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,         /* only one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    BYTE* pOut1Status	/* the pointer to the OU1 (Servo-On) Status */
    );

short i8094_get_mdi_status
    (
    BYTE bSlotNum,      /* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,         /* only one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    WORD* pDIStatus	/* the pointer to the DI Status (active status is based on polarity configuration) */
    );

short i8094_get_int_status
    (
    BYTE bSlotNum,      /* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,         /* only one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    WORD* pIntStatus	/* the pointer to the Interrupt Status */
    );

short i8094_get_error_status
    (
    BYTE bSlotNum,      /* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,         /* only one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    WORD* pErrorStatus	/* the pointer to the Error Status */
    );

short i8094_change_p
    (
    BYTE bSlotNum,	/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wAxis,		/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    DWORD dwP		/* total output pulse */
    );

short i8094_get_FRnet_DI
    (
    BYTE bSlotNum,	/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wSA,		/* Group Address FRNET_SA8 ~ FRNET_SA15 */
    WORD *pStatus,	/* the pointer to the FRnet DI status */
    WORD wEnableDirectAccess /* FRNET_ENABLE_DIRECT_ACCESS/FRNET_DISABLE_DIRECT_ACCESS, access the DI module directly, or read the stored status in driver */
    );

short i8094_set_FRnet_DO
    (
    BYTE bSlotNum,	/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD wRA,		/* Group Address FRNET_RA0 ~ FRNET_RA7 */
    WORD wDOData	/* the data to DO module */
    );
 
DWORD i8094_arc_manual_deceleration_point_calculate
    (
    BYTE bSlotNum,		/* the specific Slot-Number that is configured by onboard DIP-switch */
    WORD CW_Flag,		/* ARC_MOTION_CCW/ARC_MOTION_CW */
    WORD wMainAxis,		/* Main Axis of Circular Interpolation */
    WORD wSlaveAxis,		/* Slave Axis of Circular Interpolation */
    DWORD dwStartSpeed,		/* Start Speed */
    DWORD dwDriveSpeed,		/* Driving Speed */
    DWORD dwAcceleration,	/* Acceleration */
#ifdef SUPPORT_NON_SYMMETRY_ARC_DRIVING
    DWORD dwDeceleration,	/* Deceleration */	
#endif
    long CenterX,		/* X coordinate of Ceneter Point */
    long CenterY,		/* Y coordinate of Ceneter Point */ 
    long FinishX,		/* X coordinate of Finish Point */ 
    long FinishY,		/* Y coordinate of Finish Point */
    short wAccCntOffset		/* Acceleration Counter Offset (AO)*/		
    );

#ifdef __cplusplus
}
#endif

#endif // _I8094_DLL_H_

