Forums

SRF08 sonar function libray for LPC2106

Started by xploredteam June 6, 2007
I would like to use my SRF08 sonar with the Embedded Artists LPC2106 RS-232 QuickStart
Board.

I have downlaoded, from the EA web site, the I2C polled example program.
Then, after some internet search, I have found what I need but unfortunately for the AVR
micros...so now I am trying to converte this to LPC2106.

I have some problem,

this is the AVR function for the SRF08 init:

-----------------------------------
void srf08_init(void)
{
unsigned int range=0;
i2c_init();
I2C_START_TX(address);
i2c_transmit(0);
i2c_transmit(0x51);

do{
i2c_start();
range=i2c_transmit(address);
i2c_stop();
} while(range != I2C_NO_ERROR);

return;
}
-----------------------------------

My i2c.h file has this relative I2C functions:

void i2cInit(tU32 i2cFrequency);
tS8 i2cWrite(tU8 addr, tU8 extraCmd, tU16 extra, tU8* pData, tU16 len);
tS8 i2cStart(void);
tS8 i2cStop(void);

and others that I think isn't usefull in this case.

I have to replace this functions:

I2C_START_TX(address);
i2c_transmit(0);
i2c_transmit(0x51);

with only the LPC2106 i2cWrite(tU8 addr, tU8 extraCmd, tU16 extra, tU8* pData, tU16
len); ?

Is it right ?

Thanks.

Luca

An Engineer's Guide to the LPC2100 Series