MSP430F2131读写DS1991
时间:11-13
来源:互联网
点击:
interrupt enabled
P2IES |= 0x00;
tmflag=0;
//TM_pro();
///////////// 读取8位家族码48位唯一的序列号和8位CRC校验码
temp[0]=0x33;
wrbyte(temp,1);
pp=rbyte(0x8);
for(i=0;i<8;i++)
temp=*(pp+i);
if(temp[0]==0x02) //ds1991家族码为02
{
i=rest();
temp[0]=0xcc; //Skip ROM
wrbyte(temp,1);
temp[0]=0x96;temp[1]=0xc0;temp[2]=(0xff-temp[1]); //Write Scratchpad [96H]
wrbyte(temp,3);
temp[0]=0x34;
wrbyte(temp,1);
// pp=rbyte(0x8);
// for(i=0;i<8;i++)
// temp=*(pp+i);
// wrbyte(temp,8);
// wrbyte(id,8);
// wrbyte(pw,8);
i=rest();
////////////////////
i=rest();
temp[0]=0xcc;
wrbyte(temp,1);
temp[0]=0x69;temp[1]=0xc0;temp[2]=(0xff-temp[1]); // Read Scratchpad [69H]
wrbyte(temp,3);
pp=rbyte(0x2);
for(i=0;i<2;i++)
temp=*(pp+i);
i=rest();
i=9;
}
////////////
}
TM_DIR(0);
P2IE |= 0x10; // P2.4 interrupt enabled
P2IES |= 0x10; // P2.4 Hi/lo edge
P2IFG &= ~0x10;
_EINT();
}
}
P2IES |= 0x00;
tmflag=0;
//TM_pro();
///////////// 读取8位家族码48位唯一的序列号和8位CRC校验码
temp[0]=0x33;
wrbyte(temp,1);
pp=rbyte(0x8);
for(i=0;i<8;i++)
temp=*(pp+i);
if(temp[0]==0x02) //ds1991家族码为02
{
i=rest();
temp[0]=0xcc; //Skip ROM
wrbyte(temp,1);
temp[0]=0x96;temp[1]=0xc0;temp[2]=(0xff-temp[1]); //Write Scratchpad [96H]
wrbyte(temp,3);
temp[0]=0x34;
wrbyte(temp,1);
// pp=rbyte(0x8);
// for(i=0;i<8;i++)
// temp=*(pp+i);
// wrbyte(temp,8);
// wrbyte(id,8);
// wrbyte(pw,8);
i=rest();
////////////////////
i=rest();
temp[0]=0xcc;
wrbyte(temp,1);
temp[0]=0x69;temp[1]=0xc0;temp[2]=(0xff-temp[1]); // Read Scratchpad [69H]
wrbyte(temp,3);
pp=rbyte(0x2);
for(i=0;i<2;i++)
temp=*(pp+i);
i=rest();
i=9;
}
////////////
}
TM_DIR(0);
P2IE |= 0x10; // P2.4 interrupt enabled
P2IES |= 0x10; // P2.4 Hi/lo edge
P2IFG &= ~0x10;
_EINT();
}
}
MSP430F2131读写DS199 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)
