Logo Banner
Decoration Picture

ELECTRONICS - [designs & projects] - [I²C board] - [page 6/8]

I²C expansion board

6. PRACTICAL APPLICATION: LIGHT COMPUTER
:: 6.1 Purpose of the light computer
We've been working out a complete light computer as a practical application. There are 2 I²C I/O boards needed: 1 board with 8 LED's and 1 board with 8 switches. These boards are connected with each other, with the switch board as master and the LED board as slave.

Light effects will be executed on the LED board. These effects depend on the switches on the switch board. The function of the switches is as follow:

There can be only 1 light effect active at the same time. If not, only LED 1 of the led board will flash. This is an error indication. This indication will also be active when none of the light effects are active.

:: 6.2 Configuration of the I/O boards
The LED board must have 8 LED's. Of course, also a PCF8574 IC must be placed in the IC socket. The I²C address of this IC must be "01110010", this means switch 4 of the DIP switch must be "on". Because this is a slave board, it's not necessary to provide a connector for a flat cable: the communication with the master is done via the SCL/SDA connectors.

The switch board will be used to set the light effects. This board must be connected to the 8051 evaluation board by a flatcable. The hardware address of this board is "01110000", all switches of the DIP switch must be set to "off".

The boards must be switched like shown in the picture below. Because the second board isn't connected with the flat cable, it must be powered separately and be provided with SCL and SDA lines. The I²C pull-up resistors of the second board can be left: the line already has pull-up resistors on the first I²C board.

connecting 2 boards together

:: 6.3 Necessary software
Of course there is special software needed which will control the LEDs and read the switches. This software is included in the source code page for this project. The software will run in a endless loop. During each loop, all the switches will be read and these settings will be applied. The state of the effect-switches will be compared with the read state from the previous cycle. Doing so, a change can be detected and a RESET of the light effects will be applied. This is necessary to prevent an error during the execution.

The effects are stored in 4 independent memory tables. The used table depends on the chosen light effect. During every cycle, the next effect will be fetched from the table. A special bit pattern will indicate the last item in the table, and initiates a jump to the beginning of the table.

previous - home - next

Copyright ©1998-2010 Vanderhaegen Bart - last update: June 01, 2009