Hi
I am using CC2531 USB Dongle , and the software is SampleRemote project.
The goal is like the following :
1. I want to read the voltage of power on CC2531 by using ADC.
2. I give the extra voltage on P0_2 by power supply unit , and the extra voltage on P0_2 is change from 1V to 2.5V.
I have add the code like the following in the zll_sampleremote-CC2531EMK.c and in the end of zllSampleRemote_Init:
uint16 adc_ain2=0;
uint16 adc_battery = 0;
/*********************************************************************
* @fn zllSampleRemote_Init
...
APCFG |= 0x04;
HalAdcSetReference(HAL_ADC_REF_125V);
adc_ain2=HalAdcRead(HAL_ADC_CHN_AIN2,HAL_ADC_RESOLUTION_10);
adc_battery = HalAdcRead(HAL_ADC_CHN_VDD3, HAL_ADC_RESOLUTION_10);
} //zllSampleRemote_Init End
The input voltage on P0_2 and the power supply of CC2531 is 1.2V and 3V. And the value of adc_ain2 and adc_battery is 511 and 447 respectively.
Q1 : I am not sure it only read once or real time , because the code is in zllSampleRemote_Init.
Where should I put the code and then I can read the value of adc_battery and adc_ain2 in real time when I change the input voltage of P0_2 ?
Q2 : If the code can read the voltage in real time , where can I see the value of adc_ain2 and adc_battery in real time ? (Does "Debug without Downloading" can monitor the value in real time ??)
Thanks