How can I get the serial input data inside the interrupt routine? e.g.
1, external interrupt trigger
2, wait until get the serial input data
3, quit the interrupt routine
Now, I can go inside the interrupt routine but cannot get any serial input data while in the interrupt routine.
Unless the interrupt is for the serial device, don’t.
Never wait in an interrupt service routine.
As far as i understand, that is not possible.
But what you can do is in the interrupt routine you set a flag (a global variable) to indicate some state, and then in the main loop you check the flag and wait for serial input if it is set.
maybe describe what you’re doing a bit more - why are you using an interrupt? What else does the program have to do?
Once you are inside a Interrupt routine all other interrupts are disabled. It is possible to re-enable interrupts inside a ISR but it’s really not how one should utilize ISR routines. As stated, they should be quick and short, in and out, set or reset global flags or variables values and return.
There should always be an easier way to structure your main Loop routine to perform what you need done. Perhaps if you could post your sketch or better explain your overall application, we can better help you.