📄 motor.h
字号:
/************************************************************************
Project name: motorTest.pjt
File name: motor.h
Author: 胡天亮. 山东大学数控技术研究中心
Tianliang HU, CNC research center, Shandong University
Description: Header file of motor control
History: (1)
*************************************************************************/
#ifndef MOTOR_H
#define MOTOR_H
#define MOTORAB_CTRL (volatile unsigned int *)0x8000 //for motor AB control I/O signal
#define MOTORA_ID 0x00
#define MOTORB_ID 0x01
#define MOTORC_ID 0x02
#define MOTORD_ID 0x03
///////////////////////////////////////////////////////////////////////////////////////////
//Motor control value
//Note: motorc serve on signal is mapped to IOPB8, motord serve on signal is mapped to IOPF6
#define MOTORA_SERVEON 0x0002 //motorA serve on value, |=
#define MOTORB_SERVEON 0x0020 //motorB serve on value, |=
#define MOTORC_SERVEON 0xFF7F //motorC serve on value, &=
#define MOTORD_SERVEON 0xFFBF //motorD serve on value, &=
////////////////////////////////////////////////////////////////
//SPI channel select
//IOPE5: DLE, IOPE1~IOPE4: Channel A ~ Channel D Clock select, Highe effective
#define DA_DLE_EN 0x0020 //PCM56U DLE High |=
#define DA_CLKA_EN 0x0004 //&=
#define DA_CLKB_EN 0x0002
#define DA_CLKC_EN 0x0008
#define DA_CLKD_EN 0x0010
////////////////////////////////////////////////////////////////
//PCM56U Value when rpm of Motor is 0
#define DA_ZERO_OFFSETA (-60)
#define DA_ZERO_OFFSETB 71
#define DA_ZERO_OFFSETC (-11)
#define DA_ZERO_OFFSETD (-97)
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -