#define MOTOR_DRIVE_VERSION 6 ↓ #define MOTOR_DRIVE_VERSION 5 TIMEOUT_VALUE 1.0f ↓ TIMEOUT_VALUE 10.0f ↓
Dependencies: mbed can_network_definition_2022 bitCommunication_Ver2 motorDrive_LAP PID QEI_hw LPC1549QEI LPC1549_EEPROM motorDrive_SMB MedianFilter2020 buzzer USBDevice
definition.h@2:40528aee5ebe, 2020-04-08 (annotated)
- Committer:
- YutaTogashi
- Date:
- Wed Apr 08 07:50:27 2020 +0000
- Revision:
- 2:40528aee5ebe
- Parent:
- 0:4fe08f484460
- Child:
- 4:6e88615c830b
20200408 Add LAPcontrol & Ver4,5,6 Control
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
YutaTogashi | 0:4fe08f484460 | 1 | #ifndef PARAMETER_DEFINITION_H |
YutaTogashi | 0:4fe08f484460 | 2 | #define PARAMETER_DEFINITION_H |
YutaTogashi | 0:4fe08f484460 | 3 | /*********************************************************************************************** |
YutaTogashi | 0:4fe08f484460 | 4 | definition constant vaule |
YutaTogashi | 0:4fe08f484460 | 5 | ***********************************************************************************************/ |
YutaTogashi | 0:4fe08f484460 | 6 | enum can_pin_number { CAN_TD , CAN_RD , CAN_PIN_NUMNBER}; |
YutaTogashi | 0:4fe08f484460 | 7 | enum encoder_pin_number { ENCODER_A , ENCODER_B , ENCODER_PIN_NUMBER}; |
YutaTogashi | 0:4fe08f484460 | 8 | enum led_pin_number { CW , CCW, FREE , LED_PIN_NUMBER}; |
YutaTogashi | 0:4fe08f484460 | 9 | enum a3921_pin_number { PWMH , PHASE , A3921_PIN_NUMBER}; |
YutaTogashi | 0:4fe08f484460 | 10 | enum serial_pin_number { SERIAL_TX , SERIAL_RX , SERIAL_PIN_NUMBER}; |
YutaTogashi | 0:4fe08f484460 | 11 | enum id_switch_pin_number { SWITCH1 , SWITCH2 , SWITCH3 , SWITCH4 , SWITCH_PIN_NUMBER}; |
YutaTogashi | 0:4fe08f484460 | 12 | |
YutaTogashi | 0:4fe08f484460 | 13 | enum parameter_number { KP , KI , KD , ACCELERATION ,PARAMETER_NUMBER}; |
YutaTogashi | 0:4fe08f484460 | 14 | |
YutaTogashi | 0:4fe08f484460 | 15 | namespace communication_baud { |
YutaTogashi | 0:4fe08f484460 | 16 | const int CAN = 500000; //CAN通信の通信速度(Hz) |
YutaTogashi | 0:4fe08f484460 | 17 | const int PC = 460800; //Serial通信の通信速度(bps) |
YutaTogashi | 0:4fe08f484460 | 18 | }; |
YutaTogashi | 0:4fe08f484460 | 19 | |
YutaTogashi | 0:4fe08f484460 | 20 | const int ENCODER_PPR = 512; //ロータリーエンコーダのPPR |
YutaTogashi | 0:4fe08f484460 | 21 | |
YutaTogashi | 0:4fe08f484460 | 22 | namespace motor_option { |
YutaTogashi | 0:4fe08f484460 | 23 | const float FREQUENCY = 20000.0f; //Motorの動作周波数 |
YutaTogashi | 0:4fe08f484460 | 24 | const float UPPER_LIMIT = 1.0f; //Dutyの上限 |
YutaTogashi | 0:4fe08f484460 | 25 | const float LOWER_LIMIT = -1.0f; //Dutyの下限 |
YutaTogashi | 0:4fe08f484460 | 26 | }; |
YutaTogashi | 0:4fe08f484460 | 27 | |
YutaTogashi | 0:4fe08f484460 | 28 | namespace period { |
YutaTogashi | 0:4fe08f484460 | 29 | const float CONTROL_CYCLE = 0.01f; //制御周期 |
YutaTogashi | 0:4fe08f484460 | 30 | }; |
YutaTogashi | 0:4fe08f484460 | 31 | |
YutaTogashi | 0:4fe08f484460 | 32 | const float TIMEOUT_VALUE = 1.0f; //CAN通信のTIMEOUT時間 |
YutaTogashi | 0:4fe08f484460 | 33 | /************************************************************************************************ |
YutaTogashi | 0:4fe08f484460 | 34 | definition pin |
YutaTogashi | 0:4fe08f484460 | 35 | ************************************************************************************************/ |
YutaTogashi | 2:40528aee5ebe | 36 | #if MOTOR_DRIVER_VERSION == 4 |
YutaTogashi | 2:40528aee5ebe | 37 | //MD_ver 4.0 |
YutaTogashi | 2:40528aee5ebe | 38 | const PinName CAN_PIN[CAN_PIN_NUMNBER] = {P0_18,P0_13}; //{CAN_TD,CAN_RD} |
YutaTogashi | 2:40528aee5ebe | 39 | const PinName ENCODER_PIN[ENCODER_PIN_NUMBER] = {P0_6,P0_5}; //{Encoder_Apulse,Encoder_Bpulse} |
YutaTogashi | 2:40528aee5ebe | 40 | const PinName LED_PIN[LED_PIN_NUMBER] = {P0_25,P0_26,P0_27}; //{CW,CCW,Free} |
YutaTogashi | 2:40528aee5ebe | 41 | const PinName A3921_PIN[A3921_PIN_NUMBER] = {P0_12,P0_10}; //{PWMH,PHASE} |
YutaTogashi | 2:40528aee5ebe | 42 | const PinName SERIAL_PIN[SERIAL_PIN_NUMBER] = {P0_28,P0_29}; //{Serial TX,Serial RX} |
YutaTogashi | 2:40528aee5ebe | 43 | const PinName ID_PIN[SWITCH_PIN_NUMBER] = {P0_19,P0_20,P0_15,P0_17}; //{Switch pin} |
YutaTogashi | 2:40528aee5ebe | 44 | const PinName PWML_PIN = P0_11; //PWML pin |
YutaTogashi | 2:40528aee5ebe | 45 | #elif MOTOR_DRIVER_VERSION == 5 |
YutaTogashi | 2:40528aee5ebe | 46 | //MD_ver 5.0 |
YutaTogashi | 0:4fe08f484460 | 47 | const PinName CAN_PIN[CAN_PIN_NUMNBER] = {P0_18,P0_13}; //{CAN_TD,CAN_RD} |
YutaTogashi | 0:4fe08f484460 | 48 | const PinName ENCODER_PIN[ENCODER_PIN_NUMBER] = {P0_6,P0_5}; //{Encoder_Apulse,Encoder_Bpulse} |
YutaTogashi | 0:4fe08f484460 | 49 | const PinName LED_PIN[LED_PIN_NUMBER] = {P0_14,P0_12,P0_0}; //{CW,CCW,Free} |
YutaTogashi | 0:4fe08f484460 | 50 | const PinName A3921_PIN[A3921_PIN_NUMBER] = {P0_29,P0_28}; //{PWMH,PHASE} |
YutaTogashi | 0:4fe08f484460 | 51 | const PinName SERIAL_PIN[SERIAL_PIN_NUMBER] = {P0_2,P0_1}; //{Serial TX,Serial RX} |
YutaTogashi | 2:40528aee5ebe | 52 | const PinName ID_PIN[SWITCH_PIN_NUMBER] = {P0_25,P0_24,P0_26,P0_27}; //{Switch pin} |
YutaTogashi | 2:40528aee5ebe | 53 | #elif MOTOR_DRIVER_VERSION == 6 |
YutaTogashi | 2:40528aee5ebe | 54 | //MD_ver 6.0 |
YutaTogashi | 2:40528aee5ebe | 55 | const PinName CAN_PIN[CAN_PIN_NUMNBER] = {P0_18,P0_13}; //{CAN_TD,CAN_RD} |
YutaTogashi | 2:40528aee5ebe | 56 | const PinName ENCODER_PIN[ENCODER_PIN_NUMBER] = {P0_3,P0_2}; //{Encoder_Apulse,Encoder_Bpulse} |
YutaTogashi | 2:40528aee5ebe | 57 | const PinName LED_PIN[LED_PIN_NUMBER] = {P0_14,P0_12,P0_26}; //{CW,CCW,Free} |
YutaTogashi | 2:40528aee5ebe | 58 | const PinName A3921_PIN[A3921_PIN_NUMBER] = {P0_20,P0_29}; //{PWMH,PHASE} |
YutaTogashi | 2:40528aee5ebe | 59 | const PinName SERIAL_PIN[SERIAL_PIN_NUMBER] = {P0_12,P0_11}; //{Serial TX,Serial RX} |
YutaTogashi | 2:40528aee5ebe | 60 | const PinName ID_PIN[SWITCH_PIN_NUMBER] = {P0_5,P0_8,P0_7,P0_6}; //{Switch pin} |
YutaTogashi | 2:40528aee5ebe | 61 | #endif |
YutaTogashi | 0:4fe08f484460 | 62 | /*********************************************************************************************** |
YutaTogashi | 0:4fe08f484460 | 63 | definition struct union |
YutaTogashi | 0:4fe08f484460 | 64 | ***********************************************************************************************/ |
YutaTogashi | 0:4fe08f484460 | 65 | union can_flame{float f; int i; char c[4];}; |
YutaTogashi | 0:4fe08f484460 | 66 | |
YutaTogashi | 0:4fe08f484460 | 67 | #endif |