Trapezoid sin Vector

Dependencies:   mbed mbed-rtos

Committer:
oguro
Date:
Fri Jun 28 11:52:27 2019 +0000
Revision:
0:fa432f8ea1a6
Trapezoid sin Vector Control

Who changed what in which revision?

UserRevisionLine numberNew contents of line
oguro 0:fa432f8ea1a6 1
oguro 0:fa432f8ea1a6 2
oguro 0:fa432f8ea1a6 3 /********* 矩形反 Drive *******************/
oguro 0:fa432f8ea1a6 4 void PWM_U(){
oguro 0:fa432f8ea1a6 5 PWM_IN1_U.write(STOP*power);
oguro 0:fa432f8ea1a6 6 PWM_IN2_V.write(0);
oguro 0:fa432f8ea1a6 7 PWM_IN3_W.write(0);
oguro 0:fa432f8ea1a6 8 ut1=uT.read_us();
oguro 0:fa432f8ea1a6 9 }
oguro 0:fa432f8ea1a6 10 void EN_U(){
oguro 0:fa432f8ea1a6 11 PWM_IN1_U.write(STOP*power);
oguro 0:fa432f8ea1a6 12 PWM_IN2_V.write(0);
oguro 0:fa432f8ea1a6 13 PWM_IN3_W.write(0);
oguro 0:fa432f8ea1a6 14 }
oguro 0:fa432f8ea1a6 15 void PWM_V(){
oguro 0:fa432f8ea1a6 16 PWM_IN1_U.write(0);
oguro 0:fa432f8ea1a6 17 PWM_IN2_V.write(STOP*power);
oguro 0:fa432f8ea1a6 18 PWM_IN3_W.write(0);
oguro 0:fa432f8ea1a6 19 }
oguro 0:fa432f8ea1a6 20 void EN_V(){
oguro 0:fa432f8ea1a6 21 PWM_IN1_U.write(0);
oguro 0:fa432f8ea1a6 22 PWM_IN2_V.write(STOP*power);
oguro 0:fa432f8ea1a6 23 PWM_IN3_W.write(0);
oguro 0:fa432f8ea1a6 24 }
oguro 0:fa432f8ea1a6 25 void PWM_W(){
oguro 0:fa432f8ea1a6 26 PWM_IN1_U.write(0);
oguro 0:fa432f8ea1a6 27 PWM_IN2_V.write(0);
oguro 0:fa432f8ea1a6 28 PWM_IN3_W.write(STOP*power);
oguro 0:fa432f8ea1a6 29 }
oguro 0:fa432f8ea1a6 30 void EN_W(){
oguro 0:fa432f8ea1a6 31 PWM_IN1_U.write(0);
oguro 0:fa432f8ea1a6 32 PWM_IN2_V.write(0);
oguro 0:fa432f8ea1a6 33 PWM_IN3_W.write(STOP*power);
oguro 0:fa432f8ea1a6 34 }
oguro 0:fa432f8ea1a6 35 /*******************************************/
oguro 0:fa432f8ea1a6 36 /*********Forward 起動 FNC*******************/
oguro 0:fa432f8ea1a6 37 void start_F5(){
oguro 0:fa432f8ea1a6 38 PWM_IN1_U.write(0);
oguro 0:fa432f8ea1a6 39 PWM_IN2_V.write(0);
oguro 0:fa432f8ea1a6 40 PWM_IN3_W.write(kido); //kido
oguro 0:fa432f8ea1a6 41 wait_ms(START);
oguro 0:fa432f8ea1a6 42 }
oguro 0:fa432f8ea1a6 43 void start_F4(){
oguro 0:fa432f8ea1a6 44 PWM_IN1_U.write(0);
oguro 0:fa432f8ea1a6 45 PWM_IN2_V.write(0);
oguro 0:fa432f8ea1a6 46 PWM_IN3_W.write(kido);
oguro 0:fa432f8ea1a6 47 wait_ms(START);
oguro 0:fa432f8ea1a6 48 }
oguro 0:fa432f8ea1a6 49 void start_F6(){
oguro 0:fa432f8ea1a6 50 PWM_IN1_U.write(kido);
oguro 0:fa432f8ea1a6 51 PWM_IN2_V.write(0);
oguro 0:fa432f8ea1a6 52 PWM_IN3_W.write(0);
oguro 0:fa432f8ea1a6 53 wait_ms(START);
oguro 0:fa432f8ea1a6 54 }
oguro 0:fa432f8ea1a6 55 void start_F2(){
oguro 0:fa432f8ea1a6 56 PWM_IN1_U.write(kido);
oguro 0:fa432f8ea1a6 57 PWM_IN2_V.write(0);
oguro 0:fa432f8ea1a6 58 PWM_IN3_W.write(0);
oguro 0:fa432f8ea1a6 59 wait_ms(START);
oguro 0:fa432f8ea1a6 60 }
oguro 0:fa432f8ea1a6 61 void start_F3(){
oguro 0:fa432f8ea1a6 62 PWM_IN1_U.write(0);
oguro 0:fa432f8ea1a6 63 PWM_IN2_V.write(kido);
oguro 0:fa432f8ea1a6 64 PWM_IN3_W.write(0);
oguro 0:fa432f8ea1a6 65 wait_ms(START);
oguro 0:fa432f8ea1a6 66 }
oguro 0:fa432f8ea1a6 67 void start_F1(){
oguro 0:fa432f8ea1a6 68 PWM_IN1_U.write(0);
oguro 0:fa432f8ea1a6 69 PWM_IN2_V.write(kido);
oguro 0:fa432f8ea1a6 70 PWM_IN3_W.write(0);
oguro 0:fa432f8ea1a6 71 wait_ms(START);
oguro 0:fa432f8ea1a6 72 }
oguro 0:fa432f8ea1a6 73 /*********Reversal 起動 FNC*******************/
oguro 0:fa432f8ea1a6 74 void start_R5(){
oguro 0:fa432f8ea1a6 75 PWM_IN1_U.write(0);
oguro 0:fa432f8ea1a6 76 PWM_IN2_V.write(0);
oguro 0:fa432f8ea1a6 77 PWM_IN3_W.write(kido);
oguro 0:fa432f8ea1a6 78 wait_ms(START);
oguro 0:fa432f8ea1a6 79 }
oguro 0:fa432f8ea1a6 80 void start_R1(){
oguro 0:fa432f8ea1a6 81 PWM_IN1_U.write(0);
oguro 0:fa432f8ea1a6 82 PWM_IN2_V.write(0);
oguro 0:fa432f8ea1a6 83 PWM_IN3_W.write(kido);
oguro 0:fa432f8ea1a6 84 wait_ms(START);
oguro 0:fa432f8ea1a6 85 }
oguro 0:fa432f8ea1a6 86 void start_R3(){
oguro 0:fa432f8ea1a6 87 PWM_IN1_U.write(0);
oguro 0:fa432f8ea1a6 88 PWM_IN2_V.write(kido);
oguro 0:fa432f8ea1a6 89 PWM_IN3_W.write(0);
oguro 0:fa432f8ea1a6 90 wait_ms(START);
oguro 0:fa432f8ea1a6 91 }
oguro 0:fa432f8ea1a6 92 void start_R2(){
oguro 0:fa432f8ea1a6 93 PWM_IN1_U.write(0);
oguro 0:fa432f8ea1a6 94 PWM_IN2_V.write(kido);
oguro 0:fa432f8ea1a6 95 PWM_IN3_W.write(0);
oguro 0:fa432f8ea1a6 96 wait_ms(START);
oguro 0:fa432f8ea1a6 97 }
oguro 0:fa432f8ea1a6 98 void start_R6(){
oguro 0:fa432f8ea1a6 99 PWM_IN1_U.write(kido);
oguro 0:fa432f8ea1a6 100 PWM_IN2_V.write(0);
oguro 0:fa432f8ea1a6 101 PWM_IN3_W.write(0);
oguro 0:fa432f8ea1a6 102 wait_ms(START);
oguro 0:fa432f8ea1a6 103 }
oguro 0:fa432f8ea1a6 104 void start_R4(){
oguro 0:fa432f8ea1a6 105 PWM_IN1_U.write(kido);
oguro 0:fa432f8ea1a6 106 PWM_IN2_V.write(0);
oguro 0:fa432f8ea1a6 107 PWM_IN3_W.write(0);
oguro 0:fa432f8ea1a6 108 wait_ms(START);
oguro 0:fa432f8ea1a6 109 }
oguro 0:fa432f8ea1a6 110
oguro 0:fa432f8ea1a6 111 /**********************************************/