AN10397
How to use the SC18IM700 to control any I
2
C-bus device
Rev. 01 — 5 December 2005
Application note
Document information
Info
Keywords
Abstract
Content
I2C, I2C controller, Master I2C, UART
This application note shows how the SC18IM700 can be used in a system
to control other I
2
C-bus slave devices.
Philips Semiconductors
AN10397
How to use the SC18IM700 to control any I
2
C-bus device
Revision history
Rev
01
Date
20051205
Description
Application note; initial version.
Contact information
For additional information, please visit:
http://www.semiconductors.philips.com
For sales office addresses, please send an email to:
sales.addresses@www.semiconductors.philips.com
AN10397_1
© Koninklijke Philips Electronics N.V. 2005. All rights reserved.
Application note
Rev. 01 — 5 December 2005
2 of 10
Philips Semiconductors
AN10397
How to use the SC18IM700 to control any I
2
C-bus device
1. Introduction
Philips Semiconductors recently introduced a whole new family of devices called
‘the Bridges’. These devices are intended to transform data from one serial bus to another
serial bus, and this transformation allows the host to control devices that have serial host
bus interfaces that are not native to the system.
One such scenario is the I
2
C-bus interface. There are wide ranges of devices that have an
I
2
C-bus interface to communicate with a host. Some of such devices are: EEPROMs,
temperature sensors, analog-to-digital or digital-to-analog converters, LED blinkers and
I/O expanders. To use these devices in the system, a host must have an integrated
I
2
C-bus controller on-board, or it must have an external, stand-alone I
2
C-bus controller.
Philips Semiconductors’ SC18IM700—an I
2
C-bus controller with a UART host interface—
is the perfect choice in the case where the host does not have an integrated I
2
C-bus
controller on-board, and the system designer wishes to use I
2
C-bus related devices in the
system. The SC18IM700 does not require any programming at all other than the code to
write and read from the host’s UART port. This non-programming is possible because
SC18IM700 communicates with the host through a series of messages that are based on
ASCII characters.
This application note shows how a host can control, setup, read and write to any I
2
C-bus
devices through this UART-to-I
2
C controller. The examples used in this application note
are built around an LED blinker from Philips Semiconductors, the PCA9531. Besides the
I
2
C-bus control function, the SC18IM700 also contains a general-purpose 8-bit
programmable I/O port. These eight general purpose I/O pins can be configured to the
following modes: input only, open-drain output, push-pull output or quasi-bidirectional
input/output.
2. PCA9531: LED blinker
The PCA9531 is an 8-bit I
2
C-bus and SMBus I/O expander optimized for dimming LEDs in
256 discrete steps for Red/Green/Blue (RGB) color mixing and backlight applications.
The initial setup sequence programs the two blink rates and duty cycles for each individual
PWM. From then on, only one command from the bus master is required to turn individual
LEDs ON, OFF, BLINK RATE 1 or BLINK RATE 2. Based on the programmed frequency
and duty cycle, BLINK RATE 1 and BLINK RATE 2 will cause the LEDs to appear at a
different brightness or blink at periods up to 1.69 second. The open-drain outputs directly
drive the LEDs with maximum output sink current of 25 mA per bit and 100 mA per
package.
Please refer to the PCA9531 data sheet for more detail about this device and its internal
registers’ usage. The following steps to program the part are extracted from the example
in the data sheet, page 11.
AN10397_1
© Koninklijke Philips Electronics N.V. 2005. All rights reserved.
Application note
Rev. 01 — 5 December 2005
3 of 10
Philips Semiconductors
AN10397
How to use the SC18IM700 to control any I
2
C-bus device
2.1 Programming example
The following example will show how to set LED0 to LED3 on. It will then set LED4 and
LED5 to blink at 1 Hz at a 50 % duty cycle. LED6 and LED7 will be set to be dimmed at
25 % of their maximum brightness (duty cycle = 25 %).
Table 1:
START
PCA9531 address with A0, A1, A2 = LOW
PSC0 subaddress + auto-increment
Set prescaler PSC0 to achieve a period of 1 second:
blink period =
1
= PSC0 +
1
----------------------
-
152
PSC0 = 151
Set PWM0 duty cycle to 50 %:
PWM0
----------------
=
0.5
-
256
PWM0 = 128
Set prescaler PCS1 to dim at maximum frequency:
blink period =
max
PSC1 = 0
Set PWM1 output duty cycle to 25 %:
PWM1 =
0.25
----------------
-
256
PWM1 = 64
Set LED0 to LED3 on
Set LED4, LED5 to PWM0, and LED6, LED7 to PWM1
STOP
[1]
PCA9531 programming example
I
2
C-bus data
[1]
S
C0h
11h
97h
Programming step
80h
00h
40h
55h
FAh
P
This column shows the steps needed to be performed by the host to set the LED to blink at a specified rate.
AN10397_1
© Koninklijke Philips Electronics N.V. 2005. All rights reserved.
Application note
Rev. 01 — 5 December 2005
4 of 10
Philips Semiconductors
AN10397
How to use the SC18IM700 to control any I
2
C-bus device
3. SC18IM700: UART to I
2
C-bus controller
The SC18IM700 is designed to serve as an interface between a standard UART of a
microcontroller/microprocessor and the serial I
2
C-bus. This allows the
microcontroller/microprocessor to communicate directly with other I
2
C-bus devices. The
SC18IM700 can operate as an I
2
C-bus master and can be a transmitter or a receiver. The
SC18IM700 controls all the I
2
C-bus specific sequences, protocol, arbitration and timing.
The host communicates with the SC18IM700 with ASCII messages protocol; this makes
the control sequences from host to SC18IM700 become very simple.
The host initiates I
2
C-bus data transfer, read from and write to SC18IM700 internal
registers through a series of ASCII commands. Table 2 lists the ASCII commands
supported by SC18IM700, and also their hex value representation. Unrecognized
commands are ignored by the device.
Table 2:
S
P
R
W
I
O
Z
ASCII commands supported by the SC18IM700
Hex value
0x53
0x50
0x52
0x57
0x49
0x4F
0x5A
Command function
I
2
C-bus START command
I
2
C-bus STOP command
read SC18IM700 internal register command
write to SC18IM700 internal register command
read GPIO port command
write to GPIO port command
power-down
ASCII command
Please refer to the SC18IM700 data sheet for more descriptive detail of the above
commands.
4. Using the SC18IM700 to control the PCA9531
HOST
TX
RX
SC18IM700
UART
I
2
C-BUS
MASTER
SDA
SCL
PCA9531
UART
002aab967
Fig 1. SC18IM700 controlling the PCA9531
The ‘S’ command can be used to setup the PCA9531’s internal registers to blink the LED
at specified frequency and rate. The format for the ‘S’ command is shown in
Figure 2.
S CHAR.
SLAVE ADR.
+W
NUMBER
OF BYTES
DATA 0
DATA N
P CHAR.
Fig 2. ‘S’ command format
AN10397_1
© Koninklijke Philips Electronics N.V. 2005. All rights reserved.
Application note
Rev. 01 — 5 December 2005
5 of 10