how to allow working together slow and fast peripherals
The main issue of the program is to have a stable and flicker free display of the words. Because the scan must be refreshed every 1ms, a special care must be taken to avoid blocking among different tasks. Of course it requires a full interrupt driven program assigning the right priority to each task.
The needs is to communicate with the Real Time Clock in I2C in order to update the clock with the time values.
The I2C procedures are developed to be compatible with a full interrupt driven program with no polling or "wait until". It uses i2c.h standard header just for some definitions and the opening procedures. In fact, analyzing the I2C library source code it's clear that some of that uses waiting loops for the execution of some SSP operations, therefore they are not compatible with a real-time structure
The whole MPLABX C project
for the PIC18F4620
is available as an open source at
GitHub repository