Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of DCmotor2 by
Hbridge.h
00001 #ifndef __Hbridge_h 00002 #define __Hbridge_h 00003 00004 //************* 使用するポートなどの設定 (ここから) ***************** 00005 #define PWM_FREQ 10000.0 // [Hz], PWMチョッピング周波数 pwm freq. (> 1/(DEAD_TIME*10)) 00006 #define DEADTIME 0.0001 // [s], デッドタイム(モータに加える電圧の正負が変わるときに上下アーム短絡を避けるために同時オフする時間) // [s], deadtime to be set between plus volt. to/from minus 00007 #define fwdIN_PORT p21 //LED1 // ポート:fwdIN port for U phase fwdIN arm 00008 #define rvsIN_PORT p22 // ポート:rvsIN port for U phase rvsIN arm 00009 #define PWM_WAVEFORM 0 // PWM変調方式 0: ノコギリ波比較, 1: 三角波比較 saw tooth wave comparison, 1: triangler wave comparison 00010 #define TMIN 5 // [us], pwm_out()の演算時間 processing time of pwm_out() 00011 #define R_SHUNT_P_PORT p19 // ポート:電流検出用シャント抵抗のプラス側アナログ入力 00012 #define R_SHUNT_M_PORT p20 // ポート:電流検出用シャント抵抗のマイナス側アナログ入力 00013 #define R_SHUNT 0.47 // [Ω], 電流検出用シャント抵抗値 shunt resistanse 00014 //************* 使用するポートなどの設定 (ここまで) ***************** 00015 00016 typedef struct struct_pwm_parameters{ // フルブリッジのパラメータ宣言 parameters of H bridge pwm 00017 float duty; // 0-1, PWMデューティ duty of H bridge 00018 unsigned char mode; // チョッピングのオンオフを決定するモード 00019 long fwdIN_us; // [us], fwdINをオンする時間幅 00020 long rvsIN_us; // [us], rvsINをオンする時間幅 00021 unsigned char fReverse; // モータ逆回転フラグ:回転方向が順方向のとき0、逆方向のとき1。[0]が現在の値、[1]はその前の値 reverse direction? 00022 unsigned char fDeadtime; // 正負切替時にデッドタイムを要求するフラグ set deadtime? (v is plus to/from minus?) 00023 }pwm_parameters; 00024 extern pwm_parameters IN; // フルブリッジのパラメータ宣言 00025 00026 extern void start_pwm(); // PWMスタートする関数を宣言 00027 extern void stop_pwm(); // PWMストップする関数を宣言 00028 #endif
Generated on Tue Jul 12 2022 18:10:06 by
1.7.2
