updated on 17-06-2012
I2C Software


The software for the display

With a whole PIC18F2620 available, a lot of things can be done autonomously. The display is seen as an I2C slave device by the Low Level Supervisor.
It writes an 8 bit number in the specific register for each one of the 5 indicators (2 seven-segment display, 2 LED bars, 1 buzzer). The low nibble is the number to be displayed by the numeric section (0 to F) or the number of LEDs to power on for the bars. The bars change color from red to orange to green to alert even more for the low battery status.

THe high nibble controls the display mode:
0 = Steady on
1 = Display off
2 = Slow blinking
3 = Fast blinking
4 = CW/forward animation
5 = CCW/backward animation

In this video an example of the display behavior for each mode.

The whole MPLAB X project
for this software
is available as an open source at
Google code repository

In the 0 mode the little arrows beside the numbers blink continuously as an heartbeat, to show the good health of the program. If the display was never be addressed before, it stays in an animation mode.

The PIC18F2620 is fully dedicated to the autonomous segments management, freeing up the LLS that is busy just to change the numbers when needed. All the multiplexing, blinking and communication tasks are executed in interrupt driven mode, using hardware timers for everything. The highest interrupt priority is for the I2C communication, in order to avoid delays that can slow down other devices on the same bus.

A 20ms multiplex refresh time (5ms for each display section) has been used, as the best compromise between MCU occupation and flickering effect