Arduino infrared remote control set function button

To the infrared remote control set two function keys, text input and digital input, press and then go to press 1-9 keys can be displayed on the LCD1602 numbers or set a series of letters, infrared remote control module and LCD display module are no problem, but the judgment of the key after the execution of the statement can not be judged again, the function of the function keys can not be executed, I do not know what can be solved, the code is as follows.

#include <IRremote.h>
#include <IRremoteInt.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(11,10,9,8,7,6);
#define RECV_PIN 13
IRrecv irrecv(RECV_PIN);
decode_results results;
void words();
void number();
void setup() 
{
  Serial.begin(9600);
  lcd.begin(16,2);
  Serial.println("Enabling IRin");
  irrecv.enableIRIn();
  Serial.println("Enabled IRin");
  lcd.clear();
  lcd.setCursor(0,0);
 }
 
void words()
{
   if (irrecv.decode(&results))
    {
      Serial.println(results.value, HEX); 
      if(results.value==0xFF30CF)
      {lcd.setCursor(2,0);lcd.print("Hello World!");delay(2000);lcd.clear();}
      else if(results.value==0xFF18E7)
      {lcd.setCursor(3,0);lcd.print("Tian Ji");delay(2000);lcd.clear();}
      else if(results.value==0xFF7A85)
      {lcd.setCursor(3,0);lcd.print("Da Xue");delay(2000);lcd.clear();}
      else if(results.value==0xFF10EF)
      {lcd.setCursor(3,0);lcd.print("Ren Ai");delay(2000);lcd.clear();}
      else if(results.value==0xFF38C7)
      {lcd.setCursor(3,0);lcd.print("Xue Yuan");delay(2000);lcd.clear();}
      else if(results.value==0xFF5AA5)
      {lcd.setCursor(3,0);lcd.print("Welcome!");delay(2000);lcd.clear();}
      else if(results.value==0xFF42BD)
      {lcd.setCursor(3,0);lcd.print("Ni Hao!");delay(2000);lcd.clear();}
      else if(results.value==0xFF4AB5)
      {lcd.write("Nice to meet you");delay(2000);lcd.clear();}
      else if(results.value==0xFF52AD)
      {lcd.setCursor(4,0);lcd.print("Bye-bye");delay(2000);lcd.clear();}
    }
}
void number()
{
    lcd.leftToRight();
    if(irrecv.decode(&results))
  {
    Serial.println(results.value, HEX); 
    if(results.value==0xFF30CF)
      {lcd.print("1");delay(100);}
    else if(results.value==0xFF18E7)
      {lcd.print("2");delay(100);}
    else if(results.value==0xFF7A85)
      {lcd.print("3");delay(100);}
    else if(results.value==0xFF10EF)
      {lcd.print("4");delay(100);}
    else if(results.value==0xFF38C7)
      {lcd.print("5");delay(100);}
    else if(results.value==0xFF5AA5)
      {lcd.print("6");delay(100);}
    else if(results.value==0xFF42BD)
      {lcd.print("7");delay(100);}
    else if(results.value==0xFF4AB5)
      {lcd.print("8");delay(100);}
    else if(results.value==0xFF52AD)
      {lcd.print("9");delay(100);}
    else if ( results.value==0xFF6897)
      {lcd.print("0");delay(100);}
    }
}
void loop() 
{
   if (irrecv.decode(&results)) 
   {
     Serial.println(results.value, HEX); 
    if  (results.value==0xFFE21D)
       {delay(1000);lcd.clear();lcd.print("screen opening...");delay(1000);lcd.clear();}
  else if (results.value==0xFFA25D)
       {lcd.setCursor(3,0);lcd.print("screen off");delay(1000);lcd.clear();}
  else if (results.value==0xFF629D)
       {lcd.clear();}
  else if (results.value==0xFF22DD)
       {lcd.setCursor(3,0);lcd.print("Input words:");delay(1000);lcd.clear();words();}
  else if (results.value==0xFF02FD)
       {lcd.setCursor(3,0);lcd.print("Input number:");delay(1000);lcd.clear();number();}
        irrecv.resume();
   } 
    delay(1000);
}

Your post was MOVED to its current location as it is more suitable.

Could you also take a few moments to Learn How To Use The Forum.

Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

do you need to call irrecv.resume() after irrecv.decode()?

it looks like you call number() and words() before a call to irrecv.resume()

After your reminder I found that I should call irrecv.resume() after lcd.print("Input words:") and before delay() to make irrecv start receiving the next keystroke.

#include <IRremote.h>
#include <IRremoteInt.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(11, 10, 9, 8, 7, 6);
#define RECV_PIN 13
enum menu_states { 
  TOP_MENU, 
  INPUT_WORDS, 
  INPUT_NUMBER 
};
int stat;
IRrecv irrecv(RECV_PIN);
decode_results results;
void words();
void number();
void main_menu();
void setup() {
  Serial.begin(9600);
  lcd.begin(16, 2);
  Serial.println("Enabling IRin");
  irrecv.enableIRIn();
  Serial.println("Enabled IRin");
  lcd.clear();
  lcd.setCursor(0, 0);
  stat = TOP_MENU;
}
void words() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    // 每个decode配一个resume
    irrecv.resume();
    if (results.value == 0xFF30CF) {
      lcd.setCursor(2, 0);
      lcd.print("Hello World!");
      delay(2000);
      lcd.clear();
    } else if (results.value == 0xFF18E7) {
      lcd.setCursor(3, 0);
      lcd.print("Tian Ji");
      delay(2000);
      lcd.clear();
    } else if (results.value == 0xFF7A85) {
      lcd.setCursor(3, 0);
      lcd.print("Da Xue");
      delay(2000);
      lcd.clear();
    } else if (results.value == 0xFF10EF) {
      lcd.setCursor(3, 0);
      lcd.print("Ren Ai");
      delay(2000);
      lcd.clear();
    } else if (results.value == 0xFF38C7) {
      lcd.setCursor(3, 0);
      lcd.print("Xue Yuan");
      delay(2000);
      lcd.clear();
    } else if (results.value == 0xFF5AA5) {
      lcd.setCursor(3, 0);
      lcd.print("Welcome!");
      delay(2000);
      lcd.clear();
    } else if (results.value == 0xFF42BD) {
      lcd.setCursor(3, 0);
      lcd.print("Ni Hao!");
      delay(2000);
      lcd.clear();
    } else if (results.value == 0xFF4AB5) {
      lcd.write("Nice to meet you");
      delay(2000);
      lcd.clear();
    } else if (results.value == 0xFF52AD) {
      lcd.setCursor(4, 0);
      lcd.print("Bye-bye");
      delay(2000);
      lcd.clear();
    }
  }
  // 每个decode配一个delay
  delay(100);
  stat = TOP_MENU;
}
void number() {
  lcd.leftToRight();
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    // 每个decode配一个resume
    irrecv.resume();
    if (results.value == 0xFF30CF) {
      lcd.print("1");
      delay(100);
    } else if (results.value == 0xFF18E7) {
      lcd.print("2");
      delay(100);
    } else if (results.value == 0xFF7A85) {
      lcd.print("3");
      delay(100);
    } else if (results.value == 0xFF10EF) {
      lcd.print("4");
      delay(100);
    } else if (results.value == 0xFF38C7) {
      lcd.print("5");
      delay(100);
    } else if (results.value == 0xFF5AA5) {
      lcd.print("6");
      delay(100);
    } else if (results.value == 0xFF42BD) {
      lcd.print("7");
      delay(100);
    } else if (results.value == 0xFF4AB5) {
      lcd.print("8");
      delay(100);
    } else if (results.value == 0xFF52AD) {
      lcd.print("9");
      delay(100);
    } else if (results.value == 0xFF6897) {
      lcd.print("0");
      delay(100);
    }
  }
  // 每个decode配一个delay
  delay(100);
  stat = TOP_MENU;
}
void main_menu() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    irrecv.resume();
    if (results.value == 0xFFE21D) {
      delay(1000);
      lcd.clear();
      lcd.print("screen opening...");
      delay(1000);
      lcd.clear();
    } else if (results.value == 0xFFA25D) {
      lcd.setCursor(3, 0);
      lcd.print("screen off");
      delay(1000);
      lcd.clear();
    } else if (results.value == 0xFF629D) {
      lcd.clear();
    } else if (results.value == 0xFF22DD) {
      lcd.setCursor(3, 0);
      lcd.print("Input words:");
      delay(1000);
      lcd.clear();
      stat = INPUT_WORDS;
    } else if (results.value == 0xFF02FD) {
      lcd.setCursor(3, 0);
      lcd.print("Input number:");
      delay(1000);
      lcd.clear();
      stat = INPUT_NUMBER;
    }
  }
  delay(1000);
}
void loop() {
  if (TOP_MENU == stat) {
    main_menu();
  } else if (INPUT_NUMBER == stat) {
    number();
  } else if (INPUT_WORDS == stat) {
    words();
  }
}