型号: SD20MT
公司:温岭宇海
最小控制只需要21,15,8,3,6,7,18,19 几根线而已。SON,ALM , PULS,SIGN;
#define SON PORTDbits.RD0
#define ALM PORTDbits.RD1
#define SIGN PORTCbits.RC6
#define PLUS PORTCbits.RC7
#define SON_ON SON = 1;
#define SON_OFF SON = 0;
void Init_SD20MT(void)
{
SON_OFF;
PULS = 0;
SIGN = 0;
}
unsigned char SD20MT(unsigned char sign_n,unsigned int plus_number)
{
unsigned int i;
if (ALM) return(1);
SON_ON;
Delay1KTCYx(250);
SIGN = sign_n;
i= plus_number;
ClrWdt();
do{
PLUS = 1;
Delay10TCYx(5);
PLUS = 0;
Delay10TCYx(5);
i--;
ClrWdt();
}while(i!= 0);
ClrWdt();
Nop();
return(0);
}
//**********************************测试 (外部晶振16MHZ)
// 测试sd20mt
Nop();
ClrWdt();
while(StartKey == 0)
{
Delay10TCYx(50);
while(StartKey == 0)
{
Nop();
ClrWdt();
}
Nop();
SD20MT(1,10000);
}
Nop();
ClrWdt();
文章评论(0条评论)
登录后参与讨论