BH1750数字光照(国外英文资料).doc

  1. 1、本文档共19页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
BH1750数字光照(国外英文资料)

BH1750数字光照(国外英文资料) * * * * * * * * * # include reg5.h Include math.h / / Keil library Include stdio. H / / Keil library # include INTRINS. H # define uchar unsigned char Pound sign define uint unsigned int # define SlaveAddress 0x46 / / define the device in the IIC bus from the ADDRESS, which is modified according to the ALT ADDRESS ADDRESS / / ALT ADDRESS the ADDRESS is 0x46 when the base is ground, and the ADDRESS is 0xB8 when the power is plugged Sbit SCL P1 = ^ 0; / / IIC clock is defined Sbit SDA P1 = ^ 1; / / IIC data pins definition Typedef unsigned char BYTE; Typedef unsigned short WORD; BYTE BUF, [8]; / / receive the data cache area Uchar ge, shi, bai, qian, wan; / / display variable Int dis_data; / / variable Void delay_nms (unsigned int k); Void Init_BH1750 (void); Void conversion (uint temp_data); Void Single_Write_BH1750 (uchar REG_Address); / / a single write data Uchar Single_Read_BH1750 (uchar REG_Address); / / a single reading of internal register data Void Multiple_Read_BH1750 (); / / continuously read internal register data I dont know what Im going to do Void Delay5us (); Void Delay5ms (); Void BH1750_Start (); / / initial signal Void BH1750_Stop (); / / stop sign Void BH1750_SendACK (bit ack); / / response ACK Bit BH1750_RecvACK (); / / read an ack Void BH1750_SendByte (BYTE dat); / / IIC single byte writes BYTE BH1750_RecvByte (); / / IIC reads per byte I dont want to know / / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Void conversion (uint temp_data) / / data transformation, 10, 100, 1000, 000 { Wan = temp_data / 10000 + 0x30; Temp_data = temp_data % 10000; / / fetch Qian = temp_data / 1000 + 0x30; Temp_data = temp_data % 1000; / / fetch Bai = temp_data / 100 + 0x30; Temp_data = temp_data % 100; / / fetch Shi = temp_data / 10 + 0x30; Temp_data = temp_data % 10; / / fetch Ge = temp_data + 0 x30; } It is the second time of the year Void delay_nms (unsigned int k) { Un

文档评论(0)

f8r9t5c + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:8000054077000003

1亿VIP精品文档

相关文档