This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

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

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);
}