AllServoDrv.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #ifndef _ALLSERVODRV_H_
  2. #define _ALLSERVODRV_H_
  3. extern axis_object_t *axis_x;
  4. extern axis_object_t *axis_y;
  5. extern axis_object_t *axis_z;
  6. extern axis_object_t *axis_u;
  7. extern float XGearRatio;
  8. extern float YGearRatio;
  9. extern float ZGearRatio;
  10. #define X_AXIS 0x0000
  11. #define Y_AXIS 0x0001
  12. #define Z_AXIS 0x0004
  13. #define U_AXIS 0x0008
  14. #define X_DRV AXIS_IS_RUNNING(axis_x)
  15. #define Y_DRV AXIS_IS_RUNNING(axis_y)
  16. #define Z_DRV AXIS_IS_RUNNING(axis_z)
  17. #define U_DRV AXIS_IS_RUNNING(axis_u)
  18. //运动当中改变速度
  19. extern void AxisChangeSpeed(unsigned short axis,unsigned short speed);
  20. //固定减速距离停止
  21. extern void AxisDecStopPos(unsigned short axis,unsigned long pos);
  22. //减速停
  23. extern void AxisDecStop(unsigned short axis);
  24. //立即停止
  25. extern void AxisEgmStop(unsigned short axis);
  26. //移动绝对位置
  27. extern void AxisMovePoint(unsigned short axis,unsigned short speed,long pos);
  28. //移动绝对位置带加减速
  29. extern void AxisMovePointAccDec(unsigned short axis,unsigned short speed,long pos,
  30. unsigned short start_speed,unsigned short stop_speed,
  31. unsigned short acc_pulse,unsigned short dec_pulse);
  32. //移动距离
  33. extern void AxisMovePos(unsigned short axis,unsigned short speed,long pos);
  34. //移动距离带加减速
  35. extern void AxisMovePosAccDec(unsigned short axis,unsigned short speed,long pos,
  36. unsigned short start_speed,unsigned short stop_speed,
  37. unsigned short acc_pulse,unsigned short dec_pulse,long slowpos);
  38. //移动距离不停止
  39. extern void AxisMovePosAccDecNotStop(unsigned short axis,unsigned short speed,long pos,
  40. unsigned short start_speed,unsigned short lastspeed,
  41. unsigned short acc_pulse,unsigned short dec_pulse,long slowpos);
  42. //AxisMovePosAccDecNotStop(unsigned short axis,unsigned short speed,long pos,unsigned short start_speed,unsigned short lastspeed,unsigned short acc_pulse,unsigned short dec_pulse);
  43. //移动距离带加减速不停止
  44. 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);
  45. //连续运动
  46. extern void AxisContinueMove(unsigned short axis,unsigned short speed,unsigned char dir);
  47. //连续运动带加减速参数--中途改变目标速度
  48. extern void AxisContinueMoveChangeSpeed(unsigned short axis,unsigned short speed,unsigned short stop_speed,
  49. unsigned short acc,unsigned short dec);
  50. //两段速度移动距离
  51. extern void AxisMoveTwoPos(unsigned short axis,unsigned short speed1,long pos1,
  52. unsigned short speed2,long pos2,int dir,
  53. unsigned short start_speed,unsigned short stop_speed,
  54. unsigned short acc_pulse,unsigned short dec_pulse);
  55. //三段速度移动距离
  56. extern void AxisMoveThreePos(unsigned short axis,unsigned short speed1,long pos1,unsigned short speed2,long pos2,unsigned short speed3,long pos3,int dir);
  57. //三段速度移动距离不停止
  58. extern void AxisMoveThreePosNoStop(unsigned short axis,unsigned short speed1,long pos1,unsigned short speed2,long pos2,unsigned short speed3,long pos3,int dir);
  59. //设置真实位置
  60. extern void SetPos(unsigned short axis, long pos);
  61. //读取真实位置
  62. extern long GetPos(unsigned short axis);
  63. //获取当前速度
  64. extern unsigned long GetCurSpeed(unsigned short axis);
  65. //获取设置速度
  66. extern unsigned long GetSetSpeed(unsigned short axis);
  67. //数控PP模式
  68. extern void SetStopSelect(unsigned short axis,unsigned short Select_Flag);
  69. extern unsigned long GetState(unsigned short axis);
  70. extern unsigned long GetRemainPulse(unsigned short axis);
  71. extern unsigned long SetPulse(unsigned short axis,unsigned long pulse);
  72. extern unsigned long SetState(unsigned short axis,unsigned short state);
  73. extern void SetStartSpeed(unsigned short axis,unsigned short speed);
  74. extern void SetMinSpeed(unsigned short axis,unsigned short speed);
  75. extern void SetAccTime(unsigned short axis,unsigned short acc_time);
  76. extern void SetDecTime(unsigned short axis,unsigned short dec_time);
  77. extern void SetDir(unsigned short axis, unsigned short dir);
  78. extern void SetEn(unsigned short axis, unsigned short enable);
  79. extern unsigned char GetEn(unsigned short axis);
  80. extern unsigned char GetDir(unsigned short axis);
  81. extern long PosToPulse(unsigned short axis, long pos);
  82. extern long PulseToPos(unsigned short axis, long pulse);
  83. extern void AxisContinueMoveAcc(unsigned short axis,unsigned short speed,unsigned char dir,
  84. unsigned short start_speed,unsigned short stop_speed,
  85. unsigned short acc,unsigned short dec);
  86. //数控到数不停止模式
  87. extern void MV_Pmove_CPU_Not_Stop(unsigned short cAxisNo, long dwPosi);
  88. extern void SetEnReverse(unsigned short axis, int value);
  89. extern void SetDirReverse(unsigned short axis, int value);
  90. extern void SetAlarmReverse(unsigned short axis, int value);
  91. extern void SetClr(unsigned short axis, unsigned short clr);
  92. extern unsigned char GetAlarm(unsigned short axis);
  93. extern void AxisChangeSpeedDirect(unsigned short axis,unsigned short speed);
  94. extern void AxisMoveTwoPosNoStop(unsigned short axis,unsigned short speed1,long pos1,
  95. unsigned short speed2,long pos2,int dir,
  96. unsigned short start_speed,unsigned short stop_speed,
  97. unsigned short acc_pulse,unsigned short dec_pulse);
  98. extern unsigned char axis_x_com_alarm,axis_y_com_alarm,axis_z_com_alarm;
  99. //设置伺服的运行模式
  100. extern void Set_Servo_Runmode(unsigned short axis, unsigned short mode);
  101. //切换控制模式切换,转矩+位置模式
  102. extern void Set_Ctrlmode_trans(unsigned short axis, unsigned short mode);
  103. //获取转矩到达状态
  104. extern unsigned char GetTarr(unsigned short axis);
  105. #endif