|
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
if(GPIO_ReadInputDataBit(GPIOC,GPIO_Pin_2)==Bit_RESET) //开关机按键
# o$ o: C5 D+ {2 `$ n r) ]! S6 f: O {" e9 K+ z( S6 l% @ `' t2 c
power_on = 1;
# \1 b. S4 S. R n# v, @6 y GPIO_SetBits(GPIOB, GPIO_Pin_14);, }# `7 ^! F& w. ?0 s4 w4 J- p8 p4 a9 l
GPIO_SetBits(GPIOC, GPIO_Pin_1);, P7 `& b( N5 p( H# E/ N; F
delay_ms(50);* }7 Q! j- w4 r1 \ D
GPIO_ResetBits(GPIOC,GPIO_Pin_1); : w V3 {; O; d. x2 ]- f( J Y
}
; O1 P N1 S8 w3 i if ((GPIO_ReadInputDataBit(GPIOC,GPIO_Pin_2)==Bit_SET) &(power_on == 1))& r; H3 ~; `& K9 S J. v' H' M
{5 T, m% U8 P+ @6 G8 j. Z1 `7 {
delay_ms(50);* f6 F6 n9 [9 {. [7 e+ ?
if(GPIO_ReadInputDataBit(GPIOC,GPIO_Pin_2)==Bit_RESET)
9 T& K+ ?8 U- @5 c3 _* p& m9 ` {0 `) W+ k# f! }% H8 M8 K
GPIO_ResetBits(GPIOB, GPIO_Pin_14);1 r7 d" \" o0 c% K. P
power_off = 1;
4 R6 R; h2 J; T0 }/ H2 X- |9 G" U }# k, D* ]) z$ r/ B' h1 X; f
}5 J' Y" ^% H$ S
单片机的单独按键控制,只能输出高电平,不能输出低电平0 h/ J( e4 w. \+ a. u
|
|