working version

Dependencies:   FastPWM3 mbed

Fork of foc-ed_in_the_bot_compact by Bayley Wang

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers config.h Source File

config.h

00001 #ifndef __CONFIG_H
00002 #define __CONFIG_H
00003 
00004 #define POS_OFFSET 1.49f //1.73f
00005 #define POLE_PAIRS 3.0f
00006 #define RESOLVER_LOBES 3.0f
00007 #define CURRENT_U ib
00008 #define CURRENT_V ia
00009 #define CPR 4096
00010 
00011 #define PWMA PA_9
00012 #define PWMB PA_8
00013 #define PWMC PA_10
00014 #define EN PB_15
00015 
00016 #define IA PA_4
00017 #define IB PB_0
00018 
00019 #define I_SCALE_RAW 25.0f //mv/A
00020 #define R_UP 12000.0f //ohms
00021 #define R_DOWN 3600.0f //ohms
00022 #define R_BIAS 3600.0f //ohms
00023 #define AVDD 3300.0f //mV
00024 
00025 #define I_OFFSET (AVDD * R_DOWN * R_UP / (R_DOWN * R_UP + R_BIAS * (R_DOWN + R_UP)))
00026 #define I_SCALE (R_BIAS * R_DOWN * I_SCALE_RAW / (R_DOWN * R_UP + R_BIAS * (R_DOWN + R_UP)))
00027 
00028 #define BUS_VOLTAGE 20.0f
00029 #define K_LOOP 1.0f
00030 #define KI_BASE 0.01f
00031 
00032 #define KP (K_LOOP / BUS_VOLTAGE)
00033 #define KI (KI_BASE * K_LOOP / BUS_VOLTAGE)
00034 
00035 #define INTEGRAL_MAX 1.0f
00036 
00037 #define set_dtc(phase, value) *phase = (value)
00038 #define PI 3.141593f
00039 
00040 #define Q_MAX 50
00041 
00042 #endif