If you need to convert multicharacter numbers to integer you need to use buffer. There example of cycle buffer uses:
#define BUF_LEN 128
#define BUF_MSK (BUF_LEN-1)
uint8_t buf[BUF_LEN], b_in = 0, b_out = 0;
void usart_irq_handler(void)
{
buf[b_in&BUF_MSK] = USART_DATA_REG;
b_in++;
}
int main(void)
{
uint8_t tmp;
while (b_in!=b_out) {
tmp = buf[b_out&BUF_MSK];
b_out++;
// parse here
}
}
If you need to convert single character numbers you may not use buffer (but if USART frequency not much less than CPU frequency it's not recommended). For ASCII encoded received characters each number will have values 0x30..0x39. If received characters encoded with another charset you need refer to their tables.
uint8_t num = USART_DATA_REG - 0x30;
if (num >= 0 && num <= 9) {
// is number
}
EDIT 1 [due to new information from OP] For convert decimal number from string to integer I use this function:
uint32_t parse_num(uint8_t * ptr)
{
uint32_t res = (uint32_t)0x0;
uint8_t chr = 0x0, pchr = 0xA;
while (*ptr != (uint8_t)0x0) {
chr = (uint8_t)(*ptr - (uint8_t)0x30);
if (chr < 0xA) {
res *= (uint32_t) 0xA;
res += (uint32_t) chr;
} else {
if (pchr < 0xA) break;
}
pchr = chr;
ptr++;
}
return res;
}
It skip non-numbers chars and convert first founded number, but doesn't return final position of parse buffer. You can modify it as you need.
EDIT 2 [due to chat with OP] about good approach to processor time management:
Pictures below (from this answer) illustrate normal processor timing in program:


So, the smaller the interrupt handler time - the more likely success of the other handlers, and more time to perform main process.
By increasing of MCU clock is reduced run time code and increases idle time.
By decreasing of periferal clock is reduced frequency of interrupts by perifery and increases idle time.
In conclusion idle time must be used for power save.