Hello everybody,
I am using the GenericApp with the chip cc2530 and the smartrf board. My goal is to write on the lcd something to highlight that the battery voltage is insufficient. In this current implementation theere is the method zmain_vdd_check() in the Zmain.c file:
/*********************************************************************
* @fn zmain_vdd_check
* @brief Check if the Vdd is OK to run the processor.
* @return Return if Vdd is ok; otherwise, flash LED, then reset
*********************************************************************/
static void zmain_vdd_check( void )
{
uint8 cnt = 16;
do {
while (!HalAdcCheckVdd(VDD_MIN_RUN));
} while (--cnt);
}
This method calls the method HalAdcCheckVdd() in the h_adc.c file:
/*********************************************************************
* @fn HalAdcCheckVdd
*
* @brief Check for minimum Vdd specified.
*
* @param vdd - The board-specific Vdd reading to check for.
*
* @return TRUE if the Vdd measured is greater than the 'vdd' minimum parameter;
* FALSE if not.
*
*********************************************************************/
bool HalAdcCheckVdd(uint8 vdd)
{
ADCCON3 = 0x0F;
while (!(ADCCON1 & 0x80));
return (ADCH > vdd);
}
Basically, if the voltage is lower than a threshold, then 3 leds start flashing. This is the point that I do not understand: what is the part of the code these leds start flashing? Even though debugging I cannot get it. I think it is important in order to achieve my goal and change this kind of alert (write "VDD insufficient" on the LCD).
Maybe it is a trivial question, but I am a beginner.
Thank you.