akiyoshi oguro
/
Nucleo_Hall_rect_sin
CCW CW Control BLDC
kukei.h@2:f23351f7af0b, 2020-11-17 (annotated)
- Committer:
- oguro
- Date:
- Tue Nov 17 01:31:35 2020 +0000
- Revision:
- 2:f23351f7af0b
- Parent:
- 0:faa58403944a
New forward Revers sine Wave 2020 11 17
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
oguro | 0:faa58403944a | 1 | |
oguro | 0:faa58403944a | 2 | |
oguro | 0:faa58403944a | 3 | /********* 矩形反 Drive *******************/ |
oguro | 0:faa58403944a | 4 | void PWM_U(){ |
oguro | 0:faa58403944a | 5 | PWM_IN1_U.write(STOP*power); |
oguro | 0:faa58403944a | 6 | PWM_IN2_V.write(0); |
oguro | 0:faa58403944a | 7 | PWM_IN3_W.write(0); |
oguro | 0:faa58403944a | 8 | ut1=uT.read_us(); |
oguro | 0:faa58403944a | 9 | } |
oguro | 0:faa58403944a | 10 | void EN_U(){ |
oguro | 0:faa58403944a | 11 | PWM_IN1_U.write(STOP*power); |
oguro | 0:faa58403944a | 12 | PWM_IN2_V.write(0); |
oguro | 0:faa58403944a | 13 | PWM_IN3_W.write(0); |
oguro | 0:faa58403944a | 14 | } |
oguro | 0:faa58403944a | 15 | void PWM_V(){ |
oguro | 0:faa58403944a | 16 | PWM_IN1_U.write(0); |
oguro | 0:faa58403944a | 17 | PWM_IN2_V.write(STOP*power); |
oguro | 0:faa58403944a | 18 | PWM_IN3_W.write(0); |
oguro | 0:faa58403944a | 19 | } |
oguro | 0:faa58403944a | 20 | void EN_V(){ |
oguro | 0:faa58403944a | 21 | PWM_IN1_U.write(0); |
oguro | 0:faa58403944a | 22 | PWM_IN2_V.write(STOP*power); |
oguro | 0:faa58403944a | 23 | PWM_IN3_W.write(0); |
oguro | 0:faa58403944a | 24 | } |
oguro | 0:faa58403944a | 25 | void PWM_W(){ |
oguro | 0:faa58403944a | 26 | PWM_IN1_U.write(0); |
oguro | 0:faa58403944a | 27 | PWM_IN2_V.write(0); |
oguro | 0:faa58403944a | 28 | PWM_IN3_W.write(STOP*power); |
oguro | 0:faa58403944a | 29 | } |
oguro | 0:faa58403944a | 30 | void EN_W(){ |
oguro | 0:faa58403944a | 31 | PWM_IN1_U.write(0); |
oguro | 0:faa58403944a | 32 | PWM_IN2_V.write(0); |
oguro | 0:faa58403944a | 33 | PWM_IN3_W.write(STOP*power); |
oguro | 0:faa58403944a | 34 | } |
oguro | 0:faa58403944a | 35 | /*******************************************/ |
oguro | 0:faa58403944a | 36 | /*********Forward 起動 FNC*******************/ |
oguro | 0:faa58403944a | 37 | void start_F5(){ |
oguro | 0:faa58403944a | 38 | PWM_IN1_U.write(0); |
oguro | 0:faa58403944a | 39 | PWM_IN2_V.write(0); |
oguro | 0:faa58403944a | 40 | PWM_IN3_W.write(kido); //kido |
oguro | 0:faa58403944a | 41 | wait_ms(START); |
oguro | 0:faa58403944a | 42 | } |
oguro | 0:faa58403944a | 43 | void start_F4(){ |
oguro | 0:faa58403944a | 44 | PWM_IN1_U.write(0); |
oguro | 0:faa58403944a | 45 | PWM_IN2_V.write(0); |
oguro | 0:faa58403944a | 46 | PWM_IN3_W.write(kido); |
oguro | 0:faa58403944a | 47 | wait_ms(START); |
oguro | 0:faa58403944a | 48 | } |
oguro | 0:faa58403944a | 49 | void start_F6(){ |
oguro | 0:faa58403944a | 50 | PWM_IN1_U.write(kido); |
oguro | 0:faa58403944a | 51 | PWM_IN2_V.write(0); |
oguro | 0:faa58403944a | 52 | PWM_IN3_W.write(0); |
oguro | 0:faa58403944a | 53 | wait_ms(START); |
oguro | 0:faa58403944a | 54 | } |
oguro | 0:faa58403944a | 55 | void start_F2(){ |
oguro | 0:faa58403944a | 56 | PWM_IN1_U.write(kido); |
oguro | 0:faa58403944a | 57 | PWM_IN2_V.write(0); |
oguro | 0:faa58403944a | 58 | PWM_IN3_W.write(0); |
oguro | 0:faa58403944a | 59 | wait_ms(START); |
oguro | 0:faa58403944a | 60 | } |
oguro | 0:faa58403944a | 61 | void start_F3(){ |
oguro | 0:faa58403944a | 62 | PWM_IN1_U.write(0); |
oguro | 0:faa58403944a | 63 | PWM_IN2_V.write(kido); |
oguro | 0:faa58403944a | 64 | PWM_IN3_W.write(0); |
oguro | 0:faa58403944a | 65 | wait_ms(START); |
oguro | 0:faa58403944a | 66 | } |
oguro | 0:faa58403944a | 67 | void start_F1(){ |
oguro | 0:faa58403944a | 68 | PWM_IN1_U.write(0); |
oguro | 0:faa58403944a | 69 | PWM_IN2_V.write(kido); |
oguro | 0:faa58403944a | 70 | PWM_IN3_W.write(0); |
oguro | 0:faa58403944a | 71 | wait_ms(START); |
oguro | 0:faa58403944a | 72 | } |
oguro | 0:faa58403944a | 73 | /*********Reversal 起動 FNC*******************/ |
oguro | 0:faa58403944a | 74 | void start_R5(){ |
oguro | 0:faa58403944a | 75 | PWM_IN1_U.write(0); |
oguro | 0:faa58403944a | 76 | PWM_IN2_V.write(0); |
oguro | 0:faa58403944a | 77 | PWM_IN3_W.write(kido); |
oguro | 0:faa58403944a | 78 | wait_ms(START); |
oguro | 0:faa58403944a | 79 | } |
oguro | 0:faa58403944a | 80 | void start_R1(){ |
oguro | 0:faa58403944a | 81 | PWM_IN1_U.write(0); |
oguro | 0:faa58403944a | 82 | PWM_IN2_V.write(0); |
oguro | 0:faa58403944a | 83 | PWM_IN3_W.write(kido); |
oguro | 0:faa58403944a | 84 | wait_ms(START); |
oguro | 0:faa58403944a | 85 | } |
oguro | 0:faa58403944a | 86 | void start_R3(){ |
oguro | 0:faa58403944a | 87 | PWM_IN1_U.write(0); |
oguro | 0:faa58403944a | 88 | PWM_IN2_V.write(kido); |
oguro | 0:faa58403944a | 89 | PWM_IN3_W.write(0); |
oguro | 0:faa58403944a | 90 | wait_ms(START); |
oguro | 0:faa58403944a | 91 | } |
oguro | 0:faa58403944a | 92 | void start_R2(){ |
oguro | 0:faa58403944a | 93 | PWM_IN1_U.write(0); |
oguro | 0:faa58403944a | 94 | PWM_IN2_V.write(kido); |
oguro | 0:faa58403944a | 95 | PWM_IN3_W.write(0); |
oguro | 0:faa58403944a | 96 | wait_ms(START); |
oguro | 0:faa58403944a | 97 | } |
oguro | 0:faa58403944a | 98 | void start_R6(){ |
oguro | 0:faa58403944a | 99 | PWM_IN1_U.write(kido); |
oguro | 0:faa58403944a | 100 | PWM_IN2_V.write(0); |
oguro | 0:faa58403944a | 101 | PWM_IN3_W.write(0); |
oguro | 0:faa58403944a | 102 | wait_ms(START); |
oguro | 0:faa58403944a | 103 | } |
oguro | 0:faa58403944a | 104 | void start_R4(){ |
oguro | 0:faa58403944a | 105 | PWM_IN1_U.write(kido); |
oguro | 0:faa58403944a | 106 | PWM_IN2_V.write(0); |
oguro | 0:faa58403944a | 107 | PWM_IN3_W.write(0); |
oguro | 0:faa58403944a | 108 | wait_ms(START); |
oguro | 0:faa58403944a | 109 | } |
oguro | 0:faa58403944a | 110 | |
oguro | 0:faa58403944a | 111 | /**********************************************/ |