这是部分程序,前面的程序没有任何问题,当执行# D7 X5 m) _. _& y case 1:{" ~" d* Y5 M3 L; W PWM0_0=1;& v g" G7 `* Q0 A% c: q% Q# ` TH0=-PWM_Value1[0]/256; # [* N" x3 }) l( v6 ?2 Z0 fTL0=-PWM_Value1[0]%256; 9 k5 T1 Q/ i) I) a `4 w7 Bbreak; ' o% \2 v5 y9 E# K时,break没有起作用,反而直接到了case 12中的这一步 / f5 ^( j0 j* P9 I) H* iTL0=-(3300-PWM_Value1[5])%256; ; Y7 h" j7 y( [9 M& g0 z* lorder1=0;) x0 B' C1 A4 @ TR1=0;- k/ i9 s" ^# O break;8 L# @& s: z- M9 M* G' _1 k }8 M, J3 |% O6 J- K6 @- ]& {. r3 _ order1++;2 [. N* ~/ U. I/ h7 w9 s- Z 在case12中结束循环的 ( ^( S! O! Q# d. C: v/*===================================================================================6 k: U, l- u7 Y' @6 a# B/ w 定时器T0的中断服务程序 & `7 `: y! _5 Y. d0 y$ N7 \8 [一个循环20MS ≈ 6*3.33ms / H8 b7 O2 o. A, l=====================================================================================*/$ W1 S! L; U* j, |3 O void timer0(void) interrupt 1 using 12 |5 g5 M* N4 ]& G! H" t6 Y { 2 @. b- w, \( h( f5 `switch(order1)4 G; I2 Y9 M+ a5 A { 6 ]5 j! j3 c( Z, W% D) A5 _- Mcase 1: ^$ `$ C+ g SPWM0_0=1; $ {% K! p1 ~& L, b" q0 CTH0=-PWM_Value1[0]/256;9 c! v& q/ N1 o0 l% Z/ _8 w. b% n TL0=-PWM_Value1[0]%256;, n/ j6 l1 d7 S3 h% u' N break; , [7 O/ v. [( I+ z3 r& R! Vcase 2:6 G7 Q! V3 g3 ~2 \6 i PWM0_0=0;" q- K' D! p. g, \2 E( F TH0=-(3300-PWM_Value1[0])/256; 7 g Z `% }6 a. P/ v& [% q1 qTL0=-(3300-PWM_Value1[0])%256;6 V) @2 J$ h$ w8 M% ?( N break; + W' `9 k( y& P. W/ b$ X! Vcase 3: ' }$ Q+ [' O! {# f: }PWM0_1=1; 9 ~2 ]* a; }7 I" Q" ]6 NTH0=-PWM_Value1[1]/256;h5 G0 r$ z2 m# z TL0=-PWM_Value1[1]%256; 6 v' U4 J9 D& i0 o! ?break;3 l# |' f/ M1 o. J8 C7 o! u( q case 4:?( y: W# L. i PWM0_1=0; ! Z8 t6 [9 R; N* N. t$ RTH0=-(3300-PWM_Value1[1])/256; 4 v$ ]' v$ F( v* I/ W& m+ f+ i1 |TL0=-(3300-PWM_Value1[1])%256; . [' l n, G2 g& A6 R% e h. {6 Zbreak; / u- y+ S. I$ q/ j1 z) {case 5:l* a3 ~9 s" ?# s, ?8 B6 e9 k PWM0_2=1; 7 K/ r A* h- l+ X( V3 m: ^0 c) \TH0=-PWM_Value1[2]/256; 3 x1 u0 t) N3 A. K/ C/ RTL0=-PWM_Value1[2]%256;/ [6 }* ]8 \5 h* Y9 F& M( e break; # ^ P( V& t; U1 Pcase 6: , p8 Y/ s' |8 B1 H( e; CPWM0_2=0 ; 7 L: U8 n* L7 ~0 _2 V2 j5 ~4 f( i' wTH0=-(3300-PWM_Value1[2])/256; 6 ~0 S- b$ a4 Y' e! Y0 k* W3 f+ ZTL0=-(3300-PWM_Value1[2])%256;# _8 M, k$ ~) N( H* R break; " i( H M! p- {case 7:: W7 V) d, h' H4 A PWM0_3=1; ; ~0 [: V. S# ] fTH0=-PWM_Value1[3]/256;- ~0 [& R/ H: v. } TL0=-PWM_Value1[3]%256; " I- d7 A7 N; `& i9 ?break; ) ?( x& x B3 x& dcase 8: + S" h" }* g6 S0 b% Y, DPWM0_3=0; / h) q! K4 A( P* X6 t4 E4 l% zTH0=-(3300-PWM_Value1[3])/256; / A1 ~7 L$ v# y3 j- |TL0=-(3300-PWM_Value1[3])%256;! c; Z7 ~! {7 ]5 p' W: o! \ break;; Z& m/ Z6 w! j0 ^2 X( b4 x8 g case 9: 0 L% U4 K: X$ M8 j ZPWM0_4=1; % [3 W4 f: k7 J. S2 g# ^TH0=-PWM_Value1[4]/256; 1 b0 y. l' K2 v" _ ?% o. X. _3 [TL0=-PWM_Value1[4]%256; % M' m9 W+ i8 N! u9 [6 r7 ubreak; 8 ?; C! Y, T4 \, n+ ~4 _case 10: ) T' v J0 s# p2 K. JPWM0_4=0;1 F) q" k+ P2 D TH0=-(3300-PWM_Value1[4])/256;9 W1 e9 _ S G: V TL0=-(3300-PWM_Value1[4])%256; ' f( v' B( f) Q0 }break;) k& p! Z* q- |! ?2 B# q/ X2 K case 11:" X- Q/ d7 t8 ?4 | PWM0_5=1;; C( s- l: J: s, @: P3 ?) `2 K; ] TH0=-PWM_Value1[5]/256; 0 t, K9 C; J9 F' I" K) F' y6 kTL0=-PWM_Value1[5]%256; 6 |- p ]1 m( B2 Abreak;8 B X6 K( U2 `$ a case 12: 2 B! o# Q3 P0 ~PWM0_5=0 ; 0 [; x, _& Q2 f) |/ {2 F8 }TH0=-(3300-PWM_Value1[5])/256;, m: p4 H& Y/ h& d6 f7 e TL0=-(3300-PWM_Value1[5])%256; . X# B0 C. O' o% T. M2 Vorder1=0; 8 }+ |) V# R/ c! vTR1=0; & @! ?2 S# K) f# xbreak;$ _2 F: [. U, s, A) x } ; N+ ?6 ^8 X% morder1++;O3 c' p, e) a! }% T1 B( F } |