EmbeddedRelated.com
Forums

help :one wire master bridge ds2482 interface with lpc2148

Started by "san...@ymail.com" December 28, 2008
hi aim implementing i-button interface to lpc2148 using ds2482 1-wire
to i2c bridge.
my problem is i am using hardware i2c controller in lpc2148.i am
writing 3 routine
1 detect the i button
2 read i-button
3 write i-button
each routine using i2c interrupt.i seen some example in that all i2c
code are written in side the interrupt routine only.
im confused about how can i uses the interrupt routine for 3 main
routine. and can i enable the i2c and initiate start and send slave
addresses and receive the acknowledgment and come back from interrupt
routine and do some work in main routine and again enter to i2c
interrupt routine and continue the next i2c operation

An Engineer's Guide to the LPC2100 Series

--- In l..., "sanjeev.naik@..."
wrote:
>
> hi aim implementing i-button interface to lpc2148 using ds2482 1-wire
> to i2c bridge.
> my problem is i am using hardware i2c controller in lpc2148.i am
> writing 3 routine
> 1 detect the i button
> 2 read i-button
> 3 write i-button
> each routine using i2c interrupt.i seen some example in that all i2c
> code are written in side the interrupt routine only.
> im confused about how can i uses the interrupt routine for 3 main
> routine. and can i enable the i2c and initiate start and send slave
> addresses and receive the acknowledgment and come back from interrupt
> routine and do some work in main routine and again enter to i2c
> interrupt routine and continue the next i2c operation
>

To use interrupt driven I2C, you need to understand the I2C state
machine. The best way to do this is to use sample code that is known
to work. You can also read the I2C Specification by Philips - Google
for it.

You can also use a polled approach without interrupts but the state
concepts are the same.

Try http://www.jcwren.com/arm/ or look in the Files section here on
Yahoo to find Philips samples. They will need to be ported.

All of the info necessary to write the state machine is in section
11.9 of the User Manual. Grab some sample code and follow along in
the manual to see how it works.

Richard