... and for the curious:

The application is existing PIC-based hardware used for environmental monitoring in grain storage silos.
Because of the potentially explosive atmosphere, there are strict requirements on the hardware used. Thus the opto-isolation on all ports to the "outside world".
The hardware is already in use in several places around the world, including places where it would be very expensive to go to do a firmware update on site. But because of new items of associated hardware, changes to the code in the controller MCU are occasionally needed.