74hc165级连读程序,74hc165是很好用的并入串出片子于74hc164的功能正好相反
//--------------3片74hc165级连读程序---------
void read74hc165m(void)
{
uchar basic,basic1,basic2,HC165Count;
uint gewei,shiwei,baiwei,qianwei;
WDI =~WDI;
PL="0";
nop();
PL="1";
basic="0";
if(SETBSC) basic|=0x80;
for(HC165Count=0;HC165Count<7;HC165Count++)
{
CLOCK="0";
nop();
CLOCK="1";
basic="basic">>1;
if(SETBSC) basic|=0x80;
}
basic1=basic;
WDI =~WDI;
basic="0";
for(HC165Count=0;HC165Count<8;HC165Count++)
{
CLOCK="0";
nop();
CLOCK="1";
basic="basic">>1;
if(SETBSC) basic|=0x80;
}
basic2=basic;
WDI =~WDI;
gewei=(basic1>>4)^0x0f;
shiwei=(basic2 & 0x0f)^0x0f;
baiwei=(basic2>>4)^0x0f;
SetTime="baiwei"*100+shiwei*10+gewei;
WDI =~WDI;
basic="0";
for(HC165Count=0;HC165Count<8;HC165Count++)
{
CLOCK="0";
nop();
CLOCK="1";
basic="basic">>1;
if(SETBSC) basic|=0x80;
}
basic1=basic;
WDI =~WDI;
basic="0";
for(HC165Count=0;HC165Count<8;HC165Count++)
{
CLOCK="0";
nop();
CLOCK="1";
basic="basic">>1;
if(SETBSC) basic|=0x80;
}
basic1=basic;
WDI =~WDI;
gewei=(basic1 & 0x0f)^0x0f;
shiwei=(basic1>>4)^0x0f;
baiwei=(basic2 & 0x0f)^0x0f;
qianwei=(basic2>>4)^0x0f;
SetObject="qianwei"*1000+baiwei*100+shiwei*10+gewei;
WDI =~WDI;
}
文章评论(0条评论)
登录后参与讨论