EasyManua.ls Logo

STMicroelectronics STM8 - Page 60

STMicroelectronics STM8
126 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
In the main function, we are simply polling AWD flag. If an AWD (beyond boundary zone) event on
PB1 pin occurs the LED on PD0 starts flashing. If PB1 senses voltage between 200 and 600 ADC counts,
the LED is turned off, indicating guarded zone.
if(ADC1_GetFlagStatus(ADC1_FLAG_AWD))
{
GPIO_WriteReverse(GPIOD, GPIO_PIN_0);
ADC1_ClearFlag(ADC1_FLAG_AWD);
}
else
{
GPIO_WriteHigh(GPIOD, GPIO_PIN_0);
}

Related product manuals