UVW 3 phases Brushless DC motor control
Dependencies: QEI mbed-rtos mbed
Fork of DCmotor by
UVWpwm.h@14:7f83c4b96d34, 2013-06-07 (annotated)
- Committer:
- kosaka
- Date:
- Fri Jun 07 08:49:44 2013 +0000
- Revision:
- 14:7f83c4b96d34
- Parent:
- 13:791e20f1af43
mbed-rtos is updated
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kosaka | 12:a4b17bb682eb | 1 | #ifndef __UVWpwm_h |
kosaka | 12:a4b17bb682eb | 2 | #define __UVWpwm_h |
kosaka | 12:a4b17bb682eb | 3 | |
kosaka | 12:a4b17bb682eb | 4 | //************* User setting parameters (begin) ***************** |
kosaka | 12:a4b17bb682eb | 5 | //#define PWM_FREQ 0.5 //[Hz], pwm freq. |
kosaka | 12:a4b17bb682eb | 6 | //#define DEADTIME 0.2 // [s], deadtime to be set between plus volt. to/from minus |
kosaka | 13:791e20f1af43 | 7 | #define U_UPPER_PORT p21 // U相上アームUu用ポート |
kosaka | 13:791e20f1af43 | 8 | #define U_LOWER_PORT p22 // U相下アームUd用ポート |
kosaka | 13:791e20f1af43 | 9 | #define V_UPPER_PORT p23 // V相上アームVu用ポート |
kosaka | 13:791e20f1af43 | 10 | #define V_LOWER_PORT p24 // V相下アームVd用ポート |
kosaka | 13:791e20f1af43 | 11 | #define W_UPPER_PORT p25 // W相上アームWu用ポート |
kosaka | 13:791e20f1af43 | 12 | #define W_LOWER_PORT p26 // W相下アームWd用ポート |
kosaka | 13:791e20f1af43 | 13 | #define PWM_WAVEFORM 1 // 0: saw tooth wave comparison, 1: triangler wave comparison |
kosaka | 13:791e20f1af43 | 14 | #define TMIN 3 // [us], processing time of pwm_out() |
kosaka | 13:791e20f1af43 | 15 | |
kosaka | 13:791e20f1af43 | 16 | #define R_SHUNT_UP_PORT p16 // ポート:U相電流検出用抵抗の+側アナログ入力 |
kosaka | 13:791e20f1af43 | 17 | #define R_SHUNT_UM_PORT p17 // ポート:U相電流検出用抵抗の-側アナログ入力 |
kosaka | 13:791e20f1af43 | 18 | #define R_SHUNT_VP_PORT p19 // ポート:V相電流検出用抵抗の+側アナログ入力 |
kosaka | 13:791e20f1af43 | 19 | #define R_SHUNT_VM_PORT p20 // ポート:V相電流検出用抵抗の-側アナログ入力 |
kosaka | 13:791e20f1af43 | 20 | #define R_SHUNT 0.47 // [Ω], 電流検出用シャント抵抗の値 |
kosaka | 12:a4b17bb682eb | 21 | //************* User setting parameters (end) ***************** |
kosaka | 12:a4b17bb682eb | 22 | |
kosaka | 13:791e20f1af43 | 23 | typedef struct struct_pwm_parameters{ // UVW相pwm用の変数宣言 |
kosaka | 13:791e20f1af43 | 24 | float duty; // 0-1, PWMデューティ |
kosaka | 13:791e20f1af43 | 25 | unsigned char mode; // チョッピングのオンオフを決定するモード |
kosaka | 13:791e20f1af43 | 26 | long upper_us; // [us], 上アームをオンする時間幅 |
kosaka | 13:791e20f1af43 | 27 | long lower_us; // [us], 下アームをオンする時間幅 |
kosaka | 12:a4b17bb682eb | 28 | }pwm_parameters; |
kosaka | 13:791e20f1af43 | 29 | extern pwm_parameters uvw[]; // UVW pwm の定数、変数 |
kosaka | 12:a4b17bb682eb | 30 | |
kosaka | 12:a4b17bb682eb | 31 | extern void start_pwm(); |
kosaka | 12:a4b17bb682eb | 32 | extern void stop_pwm(); |
kosaka | 12:a4b17bb682eb | 33 | #endif |