PIC单片机控制继电器原理及实现 -
来源: 网络用户发布,如有版权联系网管删除 2018-09-06
[导读]#include
#define uchar unsigned char
#define uint unsigned int
__CONFIG(0x3B31);
void delay(uint x);
void main()
{
TRISE1=0;
TRISB=0x0f;
RE1=0;
while(1)
{
if(RB0==0)
{
delay(10);
if(RB0
#include
#define uchar unsigned char
#define uint unsigned int
__CONFIG(0x3B31);
void delay(uint x);
void main()
{
TRISE1=0;
TRISB=0x0f;
RE1=0;
while(1)
{
if(RB0==0)
{
delay(10);
if(RB0==0)
{
while(!RB0);
RE1=1;
}
}
if(RB1==0)
{
delay(10);
if(RB1==0)
{
while(!RB1);
RE1=0;
}
}
}
}
void delay(uint x)
{
uint a,b;
for(a=x;a>0;a--)
for(b=110;b>0;b--);
}
查看评论 回复