WIFI拍照小车程序
时间:11-17 11:21 阅读:1149次
*温馨提示:点击图片可以放大观看高清大图
简介:分享个人设计的Wifi拍照小车的程序,供大家学习指正。
https://h5.qzone.qq.com/ugc/share?uw=450870035&subtype=0&blog_photo=0&appid=2&ciphertext=BC59B32B020FBBAEC74515751C5806A6&g_f=2000000393&_wv=1
#include<STC12.H>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
#define zuo 0xeb
#define you 0xf7
#define zhong 0xf1
#define shang 0xeb
#define xia 0xf7
sbit youqian1=P0^0;
sbit youqian2=P0^1;
sbit zuoqian1=P0^2;
sbit zuoqian2=P0^3;
sbit youhou1=P0^4;
sbit youhou2=P0^5;
sbit zuohou1=P0^6;
sbit zuohou2=P0^7;
uchar a,zuoyou,shangxia,cout;
void delayms(uint x)
{
uchar i;
while(x--)
for(i=0;i<100;i++);
}
void main()
{
TMOD=0x22;
SCON=0x50;
CMOD=0X04;
TH1=0xfd;
TL1=0xfd;
TH0=0xa4;
TL0=0xa4;
TF0=0;
TR0=1;
CL=0X37;
CH=0X37;
CCON=0X00;
CCAP0L=0xf1;
CCAP0H=0xf1;
CCAP1L=0xf1;
CCAP1H=0xf1;
CCAPM0=0X42;
CCAPM1=0X42;
PCA_PWM0=0X00;
PCA_PWM1=0X00;
CR=1;
EA=1;
ES=1;
TR1=1;
P0=0x00;
while(1)
{
switch(a)
{
case 'a':zuoqian1=1;zuoqian2=0;
zuohou1=1;zuohou2=0;
youqian1=1;youqian2=0;
youhou1=1;youhou2=0;
break;
case 'b':zuoqian1=0;zuoqian2=1;
zuohou1=0;zuohou2=1;
youqian1=0;youqian2=1;
youhou1=0;youhou2=1;
break;
case 'd':zuoqian1=0;zuoqian2=1;
zuohou1=0;zuohou2=1;
youqian1=1;youqian2=0;
youhou1=1;youhou2=0;
break;
case 'c':zuoqian1=1;zuoqian2=0;
zuohou1=1;zuohou2=0;
youqian1=0;youqian2=1;
youhou1=0;youhou2=1;
break;
default:P0=0x00;
break;
}
}
}
void con()interrupt 4
{
ES=0;
RI=0;
zuoyou=CCAP0H;
shangxia=CCAP1H;
a=SBUF;
if(a=='2')
{
cout=~cout;
delayms(4000);
}
if(a=='1')
{
if(cout==0)
{
if(zuoyou==zhong)
{
CCAP0H=zuo;
delayms(4000);
}
if(zuoyou==zuo)
{
CCAP0H=zuo;
delayms(4000);
}
if(zuoyou==you)
{
CCAP0H=zhong;
delayms(4000);
}
}
if(cout!=0)
{
if(shangxia==zhong)
{
CCAP1H=shang;
delayms(4000);
}
if(shangxia==shang)
{
CCAP1H=shang;
delayms(4000);
}
if(shangxia==xia)
{
CCAP1H=zhong;
delayms(4000);
}
}
}
if(a=='3')
{
if(cout==0)
{
if(zuoyou==zuo)
{
CCAP0H=zhong;
delayms(4000);
}
if(zuoyou==zhong)
{
CCAP0H=you;
delayms(4000);
}
if(zuoyou==you)
{
CCAP0H=you;
delayms(4000);
}
}
if(cout!=0)
{
if(shangxia==shang)
{
CCAP1H=zhong;
delayms(4000);
}
if(shangxia==zhong)
{
CCAP1H=xia;
delayms(4000);
}
if(shangxia==xia)
{
CCAP1H=xia;
delayms(4000);
}
}
}
ES=1;
}
注:https://h5.qzone.qq.com/ugc/share?uw=450870035&subtype=0&blog_photo=0&appid=2&ciphertext=BC59B32B020FBBAEC74515751C5806A6&g_f=2000000393&_wv=1