123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- #ifndef _SERVOSTEP_H
- #define _SERVOSTEP_H
- typedef struct
- {
- unsigned short cAxisNo; //
- unsigned short cSetSpeed;
- unsigned short cCurSpeed;
- unsigned short cCalSpeed;
- unsigned short cSetAccVal;
- unsigned short cSetDecVal;
- unsigned short cCalAccPulse;
- unsigned short cCalDecPulse;
- unsigned short cSetStartSpeed;
- unsigned short cAccDecVal;
- unsigned short cMinSpeed;
- unsigned short cMaxSpeed;
- unsigned short cRstStep;
- unsigned short cZeroFilter;
- unsigned short State;
- unsigned short bAuto_Mov;
- unsigned short FirstLowSpeed;
- long FirstAccPulse;
- long LowSpeedPulse;
- long HighSpeedPulse;
- long PulseOffset;// 反向补偿脉冲数
- long cCurRealPosi;
- long cRealPosi;
- long cDestPosi;
- unsigned long cPmovPulse;
- long cMinPulse;
- long cMaxPulse;
- } StepperDataInfo;
- #define bLimitAlarmEn_X cAxisDriveState.bits.b4
- #define bLimitAlarmEn_Y cAxisDriveState.bits.b5
- #define bXDir_Old cAxisDriveState.bits.b8
- #define bYDir_Old cAxisDriveState.bits.b9
- #define bXDir_Flag cAxisDriveState.bits.b12
- #define bYDir_Flag cAxisDriveState.bits.b13
- #define bXDirction hw_pwm_get_dir(axis_x->axis_no)
- #define bYDirction hw_pwm_get_dir(axis_y->axis_no)
- #define MAX_FREQ 30000
- #define MIN_FREQ 4000
- #define MAX_SPEED 50
- #define FLEXIBLE 4//2~15数值越大中间越陡刚启动和越接近最高速越平滑
- #define ACC_DEC_TIME 150
- extern StepperDataInfo tXAxisStepper;
- extern StepperDataInfo tYAxisStepper;
- extern void XAxis_PWMProc(void);
- extern void YAxis_PWMProc(void);
- extern void CalRunPulse(StepperDataInfo *tCurSetStpper);
- extern void MV_Set_Startv_CPU(unsigned short cAxisNo, unsigned short cSpeed);
- extern void MV_Set_Speed_CPU(unsigned short cAxisNo, unsigned short cSpeed);
- extern long MV_Get_Command_Pos_CPU(unsigned short cAxisNo);
- extern void MV_Set_Command_Pos_CPU(unsigned short cAxisNo,long pos);
- extern void MV_Set_Command_SlMTP_CPU(unsigned short cAxisNo, unsigned long dwMaxLen);
- extern void MV_Set_Command_SlMTN_CPU(unsigned short cAxisNo, unsigned long dwMinLen);
- extern void StartPWM(unsigned short cAxisNo);
- extern void ReadAxisStatus(void);
- extern void MV_Sudden_Stop_CPU(unsigned short cAxisNo);
- extern void MV_Dec_Stop_CPU(unsigned short cAxisNo);
- extern void MV_Move_To_Position(unsigned short axis, long position);
- extern void MV_Pmove_CPU(unsigned short cAxisNo, long dwPosi);
- extern void MV_AccDec_Set_CPU(unsigned short cAxisNo, unsigned short cSetAcc, unsigned short cSetDec);
- extern void MV_Set_Acc_CPU(unsigned short cAxisNo, unsigned short cSetAcc);
- extern void MV_Set_Dec_CPU(unsigned short cAxisNo, unsigned short cSetAcc);
- extern void MoveAction_Pulse(unsigned short cAxisNo, long dwPosi, unsigned short cSpeed);
- extern void MV_Continue_Move_CPU(unsigned short cAxisNo, unsigned short dir);
- extern void MoveAction_Pulse2(unsigned short cAxisNo, long dwPosi,long lowpos,long back_lowpos,unsigned short cSpeed,unsigned short low_speed);
- extern void ReadAxisStatus_CPU(unsigned short cAxisNo);
- extern void ServoInit(void);
- extern void ResetServoDrv_CPU(unsigned short axis);
- extern void MoveAction_Const_Stop(unsigned short cAxisNo, unsigned short dir, unsigned short cSpeed);
- extern void MoveChangSpeed(unsigned short cAxisNo, unsigned short cSpeed);
- extern void MoveAction_Const(unsigned short cAxisNo, unsigned short dir, unsigned short cSpeed);
- extern void MoveAction_Pulse(unsigned short cAxisNo, long dwPosi, unsigned short cSpeed);
- extern void MoveAction_Dist(unsigned short cAxisNo, unsigned long dwPosi, unsigned short cSpeed);
- extern void MoveChangSpeedPos(unsigned short cAxisNo, unsigned short cSpeed,long pulse);
- extern void SetPulse_X(unsigned short startv, unsigned short cSpeed, long dwPosi);
- extern void SetPulse_Y(unsigned short startv, unsigned short cSpeed, long dwPosi);
- extern void MV_Suddent_Stop(unsigned short cAxisNo);
- extern unsigned long MV_Cal_Dec_pulse(unsigned short high_speed,unsigned short low_speed,unsigned short dec_time);
- extern void MoveAction_Const_Back(unsigned short cAxisNo, unsigned short dir, unsigned short cSpeed,unsigned short low_speed,unsigned long pulse);
- extern void CalculateSModelLine(unsigned short *fre,float len, float fre_max, float fre_min, float flexible);
- extern void SetRemainLength(unsigned short cAxisNo, long dwPosi,unsigned short set_speed);
- extern void MoveAction_Const_Stop_AccDec(unsigned short cAxisNo, unsigned short dir, unsigned short cSpeed,unsigned short cStartSpeed,unsigned short cAccPulse,unsigned short cDecPulse);
- extern void MoveAction_Const_Back_AccDec(unsigned short cAxisNo, unsigned short dir, unsigned short cSpeed,unsigned short low_speed,unsigned long pulse,unsigned short start_speed,unsigned short cAccPulse,unsigned short cDecPulse);
- extern void MoveAction_Pulse_AccDec(unsigned short cAxisNo, long dwPosi, unsigned short cSpeed,unsigned short cStartSpeed,unsigned short cAccPulse,unsigned short cDecPulse);
- extern void CalFreqTab_X_Free(unsigned char divide_var);
- extern void MoveAction_Pulse2_AccDec(unsigned short cAxisNo, long dwPosi,long lowpos,long back_lowpos, unsigned short cSpeed,unsigned short low_speed,unsigned short start_speed, unsigned short acc_pulse,unsigned short dec_pulse);
- extern void MoveAction_Const_AccDec(unsigned short cAxisNo, unsigned short dir, unsigned short cSpeed,unsigned short start_speed,unsigned short accpulse,unsigned short dec_pulse);
- extern unsigned short FreqTab_X[];
- extern const unsigned long FreqTab_XX[];
- extern void CalFreqTab_X_Free_JY(unsigned char divide_var);
- #endif
|