UVW 3 phases Brushless DC motor control
Dependencies: QEI mbed-rtos mbed
Fork of BLDCmotor by
UVWpwm.h@12:a4b17bb682eb, 2012-12-21 (annotated)
- Committer:
- kosaka
- Date:
- Fri Dec 21 22:06:56 2012 +0000
- Revision:
- 12:a4b17bb682eb
- Child:
- 13:791e20f1af43
121222a
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 | 12:a4b17bb682eb | 7 | #define U_UPPER_PORT LED1//p21 // port for U phase upper arm |
kosaka | 12:a4b17bb682eb | 8 | #define U_LOWER_PORT LED2//p22 // port for U phase lower arm |
kosaka | 12:a4b17bb682eb | 9 | #define V_UPPER_PORT LED3//p23 // port for V phase upper arm |
kosaka | 12:a4b17bb682eb | 10 | #define V_LOWER_PORT LED4//p24 // port for V phase lower arm |
kosaka | 12:a4b17bb682eb | 11 | #define W_UPPER_PORT p25 // port for W phase upper arm |
kosaka | 12:a4b17bb682eb | 12 | #define W_LOWER_PORT p26 // port for W phase lower arm |
kosaka | 12:a4b17bb682eb | 13 | #define PWM_WAVEFORM 0 // 0: saw tooth wave comparison, 1: triangler wave comparison |
kosaka | 12:a4b17bb682eb | 14 | //************* User setting parameters (end) ***************** |
kosaka | 12:a4b17bb682eb | 15 | |
kosaka | 12:a4b17bb682eb | 16 | typedef struct struct_pwm_parameters{ // parameters of UVW pwm |
kosaka | 12:a4b17bb682eb | 17 | float duty; // 0-1, duty of UVW |
kosaka | 12:a4b17bb682eb | 18 | unsigned char mode; // mode |
kosaka | 12:a4b17bb682eb | 19 | unsigned long upper_us; // [us], time |
kosaka | 12:a4b17bb682eb | 20 | unsigned long lower_us; // [us], time |
kosaka | 12:a4b17bb682eb | 21 | }pwm_parameters; |
kosaka | 12:a4b17bb682eb | 22 | extern pwm_parameters uvw[3]; // UVW pwm の定数、変数 |
kosaka | 12:a4b17bb682eb | 23 | |
kosaka | 12:a4b17bb682eb | 24 | extern void start_pwm(); |
kosaka | 12:a4b17bb682eb | 25 | extern void stop_pwm(); |
kosaka | 12:a4b17bb682eb | 26 | #endif |