last working

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 CPR 4096
00005 #define POS_OFFSET 1.73f
00006 #define POLE_PAIRS 3.0f
00007 #define RESOLVER_LOBES 3.0f
00008 
00009 #define PWMA PA_8
00010 #define PWMB PA_9
00011 #define PWMC PA_10
00012 #define EN PB_15
00013 
00014 #define IA PA_4
00015 #define IB PB_0
00016 
00017 #define I_SCALE_RAW 25.0f //mv/A
00018 #define R_UP 12000.0f //ohms
00019 #define R_DOWN 3600.0f //ohms
00020 #define R_BIAS 3600.0f //ohms
00021 #define AVDD 3300.0f //mV
00022 
00023 #define I_OFFSET (AVDD * R_DOWN * R_UP / (R_DOWN * R_UP + R_BIAS * (R_DOWN + R_UP)))
00024 #define I_SCALE (R_BIAS * R_DOWN * I_SCALE_RAW / (R_DOWN * R_UP + R_BIAS * (R_DOWN + R_UP)))
00025 
00026 #define BUS_VOLTAGE 20.0f
00027 #define K_LOOP 1.0f
00028 #define KI_BASE 0.01f
00029 
00030 #define KP (K_LOOP / BUS_VOLTAGE)
00031 #define KI (KI_BASE * K_LOOP / BUS_VOLTAGE)
00032 
00033 #define INTEGRAL_MAX 1.0f
00034 
00035 #define set_dtc(phase, value) *phase = (value)
00036 #define PI 3.141593f
00037 
00038 #endif