完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
|
|
相关推荐
1个回答
|
|
main.c
#include《reg51.h》 #include《function.h》 #include《keyscan.h》 #define speed 1***it PH1 = P1^0; //定义管脚 ***it PH2 = P1^1; ***it I01 = P1^2; ***it I11 = P1^3; ***it I02 = P1^4; ***it I12 = P1^5; void delay(int time) { int i,j; for(j=0; j 《= time; j++) for(i =0 ; i 《= 120; i++); } void init() { PH1 = 0; I01 = 0; I11 = 0; PH2 = 1; I02 = 1; I12 = 1; delay(speed); PH1 = 0; I01 = 0; I11 = 0; PH2 = 1; I02 = 1; I12 = 1; delay(speed); } void Go1() // !a=》!b=》a=》b=》!a { PH1 = 0; I01 = 0; I11 = 0; PH2 = 0; I02 = 1; I12 = 1; delay(speed);//okay; PH1 = 1; I01 = 1; I11 = 1; PH2 = 0; I02 = 0; I12 = 0; delay(speed); PH1 = 1; I01 = 0; I11 = 0; PH2 = 1; I02 = 1; I12 = 1; delay(speed); PH1 = 0; I01 = 1; I11 = 1; PH2 = 1; I02 = 0; I12 = 0; delay(speed); PH1 = 0; I01 = 0; I11 = 0; PH2 = 0; I02 = 1; I12 = 1; delay(speed); } void Go2() { PH1 = 0; I01 = 0; I11 = 0; PH2 = 1; I02 = 1; I12 = 1; delay(speed); PH1 = 1; I01 = 1; I11 = 1; PH2 = 1; I02 = 0; I12 = 0; delay(speed); PH1 = 1; I01 = 0; I11 = 0; PH2 = 0; I02 = 1; I12 = 1; delay(speed); PH1 = 0; I01 = 1; I11 = 1; PH2 = 0; I02 = 0; I12 = 0; delay(speed); PH1 = 0; I01 = 0; I11 = 0; PH2 = 1; I02 = 1; I12 = 1; delay(speed); } void main() { uchar key; initialKeyScan(); init(); while(1) { key = keyScan(); switch(key) { case 0x00:{Go1(); break; } case 0x01:{Go2(); break; } } key = 0x10; } } |
|
|
|
只有小组成员才能发言,加入小组>>
2371 浏览 0 评论
8683 浏览 4 评论
36409 浏览 18 评论
4967 浏览 0 评论
24179 浏览 34 评论
1336浏览 2评论
1585浏览 1评论
1953浏览 1评论
1399浏览 0评论
1834浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-10 15:47 , Processed in 0.999855 second(s), Total 44, Slave 39 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号