2018.07.26

Dependencies:   QEI mbed-rtos mbed

Committer:
sayzyas
Date:
Thu Jul 26 00:21:04 2018 +0000
Revision:
3:85eb7e954bfa
Parent:
2:c62dc496b79a
2018.07.26

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sayzyas 0:b1136bf48c38 1 /*
sayzyas 0:b1136bf48c38 2 * mbed LPC824-Max header
sayzyas 0:b1136bf48c38 3 *
sayzyas 0:b1136bf48c38 4 */
sayzyas 0:b1136bf48c38 5
sayzyas 3:85eb7e954bfa 6 // If you use moving type winch , then should comment out followings !!
sayzyas 3:85eb7e954bfa 7 // #define FFWinchPhaseSetting // Valid if Fix falling winch system is using.
sayzyas 3:85eb7e954bfa 8
sayzyas 0:b1136bf48c38 9 #define __DEBUG__
sayzyas 0:b1136bf48c38 10 #ifdef __DEBUG__
sayzyas 0:b1136bf48c38 11 #define DEBUG_PRINT(...) pc.printf(__VA_ARGS__)
sayzyas 0:b1136bf48c38 12 #else
sayzyas 0:b1136bf48c38 13 #define DEBUG_PRINT(...) ;
sayzyas 0:b1136bf48c38 14 //#define DEBUG_PRINT(...) 1 ? (void)0 : pc.printf(__VA_ARGS__)
sayzyas 0:b1136bf48c38 15 #endif
sayzyas 0:b1136bf48c38 16 /* Information */
sayzyas 3:85eb7e954bfa 17 #define LatestUpDate "2016.09.27"
sayzyas 3:85eb7e954bfa 18 #define ProgramRevision "Rev 2.30"
sayzyas 3:85eb7e954bfa 19 #define Author "Y.Saito(zinsor)"
sayzyas 0:b1136bf48c38 20 #define Company "Revast Co.,Ltd"
sayzyas 0:b1136bf48c38 21
sayzyas 0:b1136bf48c38 22
sayzyas 0:b1136bf48c38 23 /* Debug macro */
sayzyas 0:b1136bf48c38 24 #define __DEBUG_L0__
sayzyas 0:b1136bf48c38 25 #define __DEBUG_L1__
sayzyas 0:b1136bf48c38 26 #define __DEBUG_L2__
sayzyas 0:b1136bf48c38 27 #define __DEBUG_L3__
sayzyas 0:b1136bf48c38 28 #define __DEBUG_L4__
sayzyas 0:b1136bf48c38 29
sayzyas 0:b1136bf48c38 30 #ifdef __DEBUG_L0__
sayzyas 0:b1136bf48c38 31 #define DEBUG_PRINT_L0(...) pc.printf(__VA_ARGS__)
sayzyas 0:b1136bf48c38 32 #else
sayzyas 0:b1136bf48c38 33 #define DEBUG_PRINT_L0(...)
sayzyas 0:b1136bf48c38 34 #endif
sayzyas 0:b1136bf48c38 35 #ifdef __DEBUG_L1__
sayzyas 0:b1136bf48c38 36 #define DEBUG_PRINT_L1(...) pc.printf(__VA_ARGS__)
sayzyas 0:b1136bf48c38 37 #else
sayzyas 0:b1136bf48c38 38 #define DEBUG_PRINT_L1(...)
sayzyas 0:b1136bf48c38 39 #endif
sayzyas 0:b1136bf48c38 40 #ifdef __DEBUG_L2__
sayzyas 0:b1136bf48c38 41 #define DEBUG_PRINT_L2(...) pc.printf(__VA_ARGS__)
sayzyas 0:b1136bf48c38 42 #else
sayzyas 0:b1136bf48c38 43 #define DEBUG_PRINT_L2(...)
sayzyas 0:b1136bf48c38 44 #endif
sayzyas 0:b1136bf48c38 45 #ifdef __DEBUG_L3__
sayzyas 0:b1136bf48c38 46 #define DEBUG_PRINT_L3(...) pc.printf(__VA_ARGS__)
sayzyas 0:b1136bf48c38 47 #else
sayzyas 0:b1136bf48c38 48 #define DEBUG_PRINT_L3(...)
sayzyas 0:b1136bf48c38 49 #endif
sayzyas 0:b1136bf48c38 50 #ifdef __DEBUG_L4__
sayzyas 0:b1136bf48c38 51 #define DEBUG_PRINT_L4(...) pc.printf(__VA_ARGS__)
sayzyas 0:b1136bf48c38 52 #else
sayzyas 0:b1136bf48c38 53 #define DEBUG_PRINT_L4(...)
sayzyas 0:b1136bf48c38 54 #endif
sayzyas 0:b1136bf48c38 55
sayzyas 2:c62dc496b79a 56 #define NumberOfI2CCommand 14
sayzyas 2:c62dc496b79a 57
sayzyas 2:c62dc496b79a 58 /* For resolver reader controller */
sayzyas 2:c62dc496b79a 59 enum{
sayzyas 2:c62dc496b79a 60 I2C_CP_PREAMBLE_R, // Preamble of command packet
sayzyas 2:c62dc496b79a 61 I2C_CP_COMMAND_R, // instruction command
sayzyas 2:c62dc496b79a 62 I2C_CP_WDRAM_DIA_UPPER, // motor1 rotation direction
sayzyas 2:c62dc496b79a 63 I2C_CP_WDRAM_DIA_LOWER, // motor1 rotation speed
sayzyas 2:c62dc496b79a 64 I2C_CP_CCABLE_DIA_UPPER, // motor1 current limit detection threshold upper byte
sayzyas 2:c62dc496b79a 65 I2C_CP_CCABLE_DIA_LOWER, // motor1 current limit detection threshold lower byte
sayzyas 2:c62dc496b79a 66 I2C_CP_RESOLVER_RESO, // motor1 current limit detection threshold upper byte
sayzyas 3:85eb7e954bfa 67 I2C_CP_PRESET_CPOS_UPPER, // reserved
sayzyas 3:85eb7e954bfa 68 I2C_CP_PRESET_CPOS_LOWER, // reserved
sayzyas 2:c62dc496b79a 69 I2C_CP_RES3, // reserved
sayzyas 2:c62dc496b79a 70 I2C_CP_RES4, // reserved
sayzyas 2:c62dc496b79a 71 I2C_CP_RES5, // reserved
sayzyas 2:c62dc496b79a 72 I2C_CP_RES6, // reserved
sayzyas 2:c62dc496b79a 73 I2C_CP_RES7, // reserved
sayzyas 2:c62dc496b79a 74 };
sayzyas 0:b1136bf48c38 75
sayzyas 0:b1136bf48c38 76 #define ROTATE_PER_RESOLUTION 24
sayzyas 0:b1136bf48c38 77 #define REAL_THREAD_DIAMETER 63 // 60+3
sayzyas 0:b1136bf48c38 78 //#define ROTATION_DISTANCE 197.82f // (60+3)*3.14
sayzyas 0:b1136bf48c38 79 #define ROTATION_PULSE_PER_1ROUND 16384 // 2^12(bit) * 4
sayzyas 0:b1136bf48c38 80 #define PAI 3.1415
sayzyas 0:b1136bf48c38 81
sayzyas 0:b1136bf48c38 82 /* ***************** */
sayzyas 0:b1136bf48c38 83 /* Target definition */
sayzyas 0:b1136bf48c38 84 /* ***************** */
sayzyas 1:86705c6e0ab7 85 #define I2C_ADDRESS_RESOLVER 0x02
sayzyas 1:86705c6e0ab7 86 #define Target_IIC_ADDR 0x02 // For Resolver count controller
sayzyas 0:b1136bf48c38 87
sayzyas 0:b1136bf48c38 88
sayzyas 0:b1136bf48c38 89 /* Command Packet */
sayzyas 0:b1136bf48c38 90 #define CLEAR_RESOLVER_POSITION 'X'
sayzyas 0:b1136bf48c38 91 #define HELLO_PACKET 'A'
sayzyas 0:b1136bf48c38 92
sayzyas 0:b1136bf48c38 93 #define LED_ON 0
sayzyas 0:b1136bf48c38 94 #define LED_OFF 1