我想知道是否可以在不使用MCU复位引脚上的外部复位按钮的情况下中断while循环并从特定位置重新启动代码.
下面是我希望在"if"语句为真时打破的while循环,我正在使用LCD并希望返回到我的代码中显示文本的特定部分(模仿主页).
实际上,当"if"语句为真时,while循环被破坏并且代码结束.
int main(void)
{
/***************************************** BUTTON CONFIGURATION ********************************/
DDRA &= ~((1<<PINA0) | (1<<PINA1) | (1<<PINA2) | (1<<PINA3)); // Config pins as inputs (ADC3 - Matching with ADMUX assignment below in ADC configuration)
DDRC = 0xFF; // Output pins for LEDs
PORTA |= (1<< PINA0) | (1<<PINA1) | (1<<PINA2); // Three pins for three push buttons
/****************************************** ADC CONFIGURATION **********************************/
ADMUX |= (1<<MUX0) | (1<<MUX1) | (1<<REFS0); // ADC3 and Internal voltage as reference voltage
MCUCR &= ~((1<<ADTS2) | …Run Code Online (Sandbox Code Playgroud)