Answer the question
In order to leave comments, you need to log in
How to stop code execution in pic16?
Hello! By pressing the button (1), the INTF interrupt ( RB0 ) is triggered, it is necessary to display the inscription and so it should be displayed until I press the (2) button and the RB7 interrupt is triggered, which prints another inscription.
It was decided to use delays, but while the delay is called, another interrupt does not work.
How can I display the inscription on the screen and so that it does not disappear until another interrupt is called?
void interrupt isr(){
if(INTF){
INTF = 0; // reset interrupt flag/
Lcd_Clear();
Lcd_Set_Cursor(1,1);
Lcd_Write_String("1.");
Lcd_Set_Cursor(1,3);
Lcd_Write_String("Hello");
__delay_ms(1000);
}
if(RBIF){
if(RB7){
activeItem++;
Lcd_Clear();
Lcd_Set_Cursor(1,1);
Lcd_Write_String("RB7");
__delay_ms(1000);
}
RBIF = 0;
}
}
Answer the question
In order to leave comments, you need to log in
In interrupts, you need to set the flags, and already in the main program, analyze them and delay them.
In the simplest case:
uint8_t FlagTextChanged;
void interrupt isr(){
if(INTF){
...
Lcd_Write_String("Hello");
FlagTextChanged = 1;
}
if(RBIF){
if(RB7){
...
Lcd_Write_String("RB7");
FlagTextChanged = 1;
}
RBIF = 0;
}
}
void main(){
FlagTextChanged = 0;
while (1){
...
if (FlagTextChanged){
FlagTextChanged = 0;
__delay_ms(1000);
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question