微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI Zigbee设计交流 > cc2530光敏传感器采集光照,最大值超不过127,这是怎回事?

cc2530光敏传感器采集光照,最大值超不过127,这是怎回事?

时间:10-02 整理:3721RD 点击:

uint16 myApp_ReadLightLevel( void )
{
uint16 reading = 0;

/* Enable channel */
ADCCFG |= 0x40;

/* writing to this register starts the extra conversion */
ADCCON3 = 0x86;

/* Wait for the conversion to be done */
while (!(ADCCON1 & 0x80));

/* Disable channel after done conversion */
ADCCFG &= (0x40 ^ 0xFF);

/* Read the result */
reading = ADCH;
reading |= (int16) (ADCH << 8);

reading >>= 8;

return (reading);
}

传感器啥型号?集成的还是经过运放放大信号的?

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top