ds18b20
所属分类:嵌入式/单片机/硬件编程
开发工具:Visual C++
文件大小:3KB
下载次数:6
上传日期:2009-05-20 12:13:37
上 传 者:
cumtnj
说明: 如何编写读/写一个字节的函数呢?
1. 读一个字节
uchar tmpread(void) //read a byte date 读一个字节
{
uchar i,j,dat
dat=0
for(i=1 i<=8 i++)
{
j=tmpreadbit()
dat=(j<<7)|(dat>>1) //读出的数据最低位在最前面,这样刚好一个字节在DAT里
}
return(dat) //将一个字节数据返回
}
(How to write read/write one byte of the function does? 1. Reading a byte uchar tmpread (void)// read a byte date read one byte (uchar i, j, dat dat = 0 for (i = 1 i < = 8 i++) (j = tmpreadbit () dat = (j < < 7) | (dat> > 1) // read out data at the top of the minimum, this is just one byte in the DAT-ri) return (dat) // will be a word section of data to return))
文件列表:
ds18b20.c (6667, 2008-12-24)
近期下载者:
相关文件:
收藏者: