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