DC motor control program using TA7291P type H bridge driver and rotary encoder with A, B phase.
Fork of DCmotor2 by
Diff: controller.cpp
- Revision:
- 22:4fd506b1c68d
- Parent:
- 15:29797f995594
--- a/controller.cpp Wed Jul 02 04:25:28 2014 +0000 +++ b/controller.cpp Fri Jun 10 04:29:13 2016 +0000 @@ -4,7 +4,7 @@ #include "controller.h" // controller.cpp: モータ制御器(位置制御、電流制御) #include "Hbridge.h" // Hbridge.cpp: モータ駆動用ドライバのフルブリッジ(Hブリッジ)をPWM駆動する。 -Serial pc(USBTX, USBRX); // PCのモニタ上のtera termに文字を表示する宣言 +//Serial pc(USBTX, USBRX); // PCのモニタ上のtera termに文字を表示する宣言 motor_parameters p; // モータの定数、信号など current_loop_parameters il; // 電流制御マイナーループの定数、変数 @@ -285,7 +285,7 @@ } void display2PC(){ // PCのモニタ上のtera termに諸量を表示 display to tera term on PC - pc.printf("%8.1f[s]\t%8.2f[V]\t%8.2f [Hz]\t%8.2f\t%8.2f\r\n", + printf("%8.1f[s]\t%8.2f[V]\t%8.2f [Hz]\t%8.2f\t%8.2f\r\n", _time, il.v_ref, vl.w_lpf/(2*PI), vl.w_ref/(2*PI), debug[0]); // pc.printf("%8.1f[s]\t%8.5f[V]\t%4d [deg]\t%8.2f\r\n", _time, _u, (int)(_th/(2*PI)*360.0), _r);//debug[0]*3.3/R_SHUNT); // print to tera term }