Just ask ChatGPT to write the code. If you have multiple digits, use a shift register to latch the data from each digit of the display, shift it into the MCU and decode it there. 3 IO lines for almost unlimited digit inputs.