標(biāo)題: 紅外報(bào)警門鈴,求助啊?看看有沒(méi)有問(wèn)題 [打印本頁(yè)]

作者: sun14569    時(shí)間: 2012-4-14 21:08
標(biāo)題: 紅外報(bào)警門鈴,求助啊?看看有沒(méi)有問(wèn)題
#include #define uchar unsigned char #define uint unsigned int sbit kz=P0^1; //控制 sbit red=P2^7; sbit greed=P2^4; //綠燈 sbit ml=P2^0; //門鈴 sbit bj=P2^1; //報(bào)警 sbit hw=P0^0; //紅外 uchar num; uchar code table[]={0xc1,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e}; void delayms(uint); void baojin() { red=1; num++; bj=1; greed=0; ml=0; } void menling() { greed=1; ml=1; red=0; bj=0; } void shuma() { P1=table[num]; delayms(500); } void delayms(uint xms) { uint i,j; for(i=xms;i>0;i--) for(j=110;j>0;j--); } void main() { P1=0x00; P2=0x00; delayms(60000); while(1) { P2=0x00; if(hw==1) { if(kz==0) menling(); if(kz==1) baojin(); shuma(); } if(hw==0) P2=0x00; delayms(1000); } }[upload=c,畢業(yè)設(shè)計(jì).c]viewFile.asp?ID=1041[/upload]
[此貼子已經(jīng)被作者于2012-4-15 0:06:24編輯過(guò)]

作者: 1532775432    時(shí)間: 2020-5-4 21:15
能不能找到你啊
作者: zhengdianyuanzi    時(shí)間: 2020-5-13 12:14
這咋看?
作者: 清風(fēng)皓月?lián)嵝睦@    時(shí)間: 2023-5-29 09:16
放源程序,這樣看不了




歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1