123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- #ifndef _ALLSERVODRV_H_
- #define _ALLSERVODRV_H_
- extern axis_object_t *axis_x;
- extern axis_object_t *axis_y;
- extern axis_object_t *axis_z;
- extern axis_object_t *axis_u;
- extern float XGearRatio;
- extern float YGearRatio;
- extern float ZGearRatio;
- #define X_AXIS 0x0000
- #define Y_AXIS 0x0001
- #define Z_AXIS 0x0004
- #define U_AXIS 0x0008
- //设置使能
- #define MOTOR_EN 0
- #define MOTOR_DISEN 1
- //
- #define X_DRV AXIS_IS_RUNNING(axis_x)
- #define Y_DRV AXIS_IS_RUNNING(axis_y)
- #define Z_DRV AXIS_IS_RUNNING(axis_z)
- #define U_DRV AXIS_IS_RUNNING(axis_u)
- //运动当中改变速度
- extern void AxisChangeSpeed(unsigned short axis,unsigned short speed);
- //固定减速距离停止
- extern void AxisDecStopPos(unsigned short axis,unsigned long pos);
- //减速停
- extern void AxisDecStop(unsigned short axis);
- //立即停止
- extern void AxisEgmStop(unsigned short axis);
- //移动绝对位置
- extern void AxisMovePoint(unsigned short axis,unsigned short speed,long pos);
- //移动绝对位置带加减速
- extern void AxisMovePointAccDec(unsigned short axis,unsigned short speed,long pos,
- unsigned short start_speed,unsigned short stop_speed,
- unsigned short acc_pulse,unsigned short dec_pulse);
- //移动距离
- extern void AxisMovePos(unsigned short axis,unsigned short speed,long pos);
- //移动距离带加减速
- extern void AxisMovePosAccDec(unsigned short axis,unsigned short speed,long pos,
- unsigned short start_speed,unsigned short stop_speed,
- unsigned short acc_pulse,unsigned short dec_pulse,long slowpos);
- //移动距离不停止
- extern void AxisMovePosAccDecNotStop(unsigned short axis,unsigned short speed,long pos,
- unsigned short start_speed,unsigned short lastspeed,
- unsigned short acc_pulse,unsigned short dec_pulse,long slowpos);
- //AxisMovePosAccDecNotStop(unsigned short axis,unsigned short speed,long pos,unsigned short start_speed,unsigned short lastspeed,unsigned short acc_pulse,unsigned short dec_pulse);
- //移动距离带加减速不停止
- extern void MoveAction_Pulse_AccDec_NotStop(unsigned short cAxisNo, long dwPosi, unsigned short cSpeed,unsigned short cStartSpeed,unsigned short cLastSpeed,unsigned short cAccPulse,unsigned short cDecPulse);
- //连续运动
- extern void AxisContinueMove(unsigned short axis,unsigned short speed,unsigned char dir);
- //连续运动带加减速参数--中途改变目标速度
- extern void AxisContinueMoveChangeSpeed(unsigned short axis,unsigned short speed,unsigned short stop_speed,
- unsigned short acc,unsigned short dec);
- //两段速度移动距离
- extern void AxisMoveTwoPos(unsigned short axis,unsigned short speed1,long pos1,
- unsigned short speed2,long pos2,int dir,
- unsigned short start_speed,unsigned short stop_speed,
- unsigned short acc_pulse,unsigned short dec_pulse);
- //三段速度移动距离
- extern void AxisMoveThreePos(unsigned short axis,unsigned short speed1,long pos1,unsigned short speed2,long pos2,unsigned short speed3,long pos3,int dir);
- //三段速度移动距离不停止
- extern void AxisMoveThreePosNoStop(unsigned short axis,unsigned short speed1,long pos1,unsigned short speed2,long pos2,unsigned short speed3,long pos3,int dir);
- //设置真实位置
- extern void SetPos(unsigned short axis, long pos);
- //读取真实位置
- extern long GetPos(unsigned short axis);
- //获取当前速度
- extern unsigned long GetCurSpeed(unsigned short axis);
- //获取设置速度
- extern unsigned long GetSetSpeed(unsigned short axis);
- //数控PP模式
- extern void SetStopSelect(unsigned short axis,unsigned short Select_Flag);
- extern unsigned long GetState(unsigned short axis);
- extern unsigned long GetRemainPulse(unsigned short axis);
- extern unsigned long SetPulse(unsigned short axis,unsigned long pulse);
- extern unsigned long SetState(unsigned short axis,unsigned short state);
- extern void SetStartSpeed(unsigned short axis,unsigned short speed);
- extern void SetMinSpeed(unsigned short axis,unsigned short speed);
- extern void SetAccTime(unsigned short axis,unsigned short acc_time);
- extern void SetDecTime(unsigned short axis,unsigned short dec_time);
- extern void SetDir(unsigned short axis, unsigned short dir);
- extern void SetEn(unsigned short axis, unsigned short enable);
- extern unsigned char GetEn(unsigned short axis);
- extern unsigned char GetDir(unsigned short axis);
- extern long PosToPulse(unsigned short axis, long pos);
- extern long PulseToPos(unsigned short axis, long pulse);
- extern void AxisContinueMoveAcc(unsigned short axis,unsigned short speed,unsigned char dir,
- unsigned short start_speed,unsigned short stop_speed,
- unsigned short acc,unsigned short dec);
- //数控到数不停止模式
- extern void MV_Pmove_CPU_Not_Stop(unsigned short cAxisNo, long dwPosi);
- extern void SetEnReverse(unsigned short axis, int value);
- extern void SetDirReverse(unsigned short axis, int value);
- extern void SetAlarmReverse(unsigned short axis, int value);
- extern void SetClr(unsigned short axis, unsigned short clr);
- extern unsigned char GetAlarm(unsigned short axis);
- extern void AxisChangeSpeedDirect(unsigned short axis,unsigned short speed);
- extern void AxisMoveTwoPosNoStop(unsigned short axis,unsigned short speed1,long pos1,
- unsigned short speed2,long pos2,int dir,
- unsigned short start_speed,unsigned short stop_speed,
- unsigned short acc_pulse,unsigned short dec_pulse);
- //软件限位
- extern void AxisEnableSoftwarelmt(unsigned short axis, int p_pos, int n_pos);
- extern void AxisDisableSoftwarelmt(unsigned short axis);
- extern unsigned char axis_x_com_alarm,axis_y_com_alarm,axis_z_com_alarm;
- //设置伺服的运行模式
- extern void Set_Servo_Runmode(unsigned short axis, unsigned short mode);
- //切换控制模式切换,转矩+位置模式
- extern void Set_Ctrlmode_trans(unsigned short axis, unsigned short mode);
- //获取转矩到达状态
- extern unsigned char GetTarr(unsigned short axis);
- #endif
|