完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
|
这个程序是按下K0,led灯亮 再按下灯灭
#include unsigned char status=0xff; ***it Ledce=P1^2; ***it Keyce=P1^3; ***it Digce=P1^1; void delayms(unsigned int ); void Keycan(); void main() { P0=0x00; P1=0x0c; while(1) { Keycan(); Ledce=0; P0=status; delayms(10); Ledce=1; } } void delayms(unsigned int x) { int j=0; for(x;x>0;x--) for(j=123;j>0;j--); } void Keycan() { unsigned char temp; P0=0x00; Ledce=1; Digce=1; P0=0xfe; Digce=0; P0=0xff; Keyce=0; temp=P0; temp=temp&0x01; while(temp!=0x01) { delayms(10); temp=P0; temp=temp&0x01; while(temp==0x00) { status=~status; } while(temp==0x00) { temp=P0; temp=temp&0x01; } } Keyce=1; }
|
|
相关推荐
4个回答
|
|
|
学习板电路图,这个按键与74ls44相连又该如何检测呐
|
|
|
|
|
|
|
|
|
|
|
|
哈哈支持一下吧
|
|
|
|
|
|
学习版和我们的好像
|
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
435 浏览 0 评论
464 浏览 0 评论
450 浏览 0 评论
806 浏览 0 评论
RT-Thread与英飞凌(infineon)合作得板子PSOC 6 板子学习
748 浏览 0 评论
【youyeetoo X1 windows 开发板体验】少儿AI智能STEAM积木平台
17012 浏览 31 评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-12 08:36 , Processed in 1.095080 second(s), Total 83, Slave 63 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
497