Please tell me how to interface NXP LPC1114 with Arduino board using I2C protocol.
I want to send some data through Arduno board on SCL and SDA using I2C protocol and Attaching this SCL and SDA cable to NXP board want to glow dimmer LED(PCA9532).
Please give me some idea and code.
I know nothing of the LPC1114 but as it and the arduino are both microcontrollers which will be master/slave. The arduino wire library allows configuration as master or slave though I have never used slave mode myself.
ranjeetray:
Please tell me how to interface NXP LPC1114 with Arduino board using I2C protocol.
I want to send some data through Arduno board on SCL and SDA using I2C protocol and Attaching this SCL and SDA cable to NXP board want to glow dimmer LED(PCA9532).
Please give me some idea and code.
Thanks
It's incredibly unlikely that anyone here will simply write your code for you. Implementing I2C on the Arduino is easy, and you'll have to read the documentation for your LPC1114 to understand how it implements I2C.
[code][code][code][quote author=Verdris link=topic=115098.msg866399#msg866399 date=1342794960]
[quote author=ranjeetray link=topic=115098.msg866270#msg866270 date=1342785498]
Please tell me how to interface NXP LPC1114 with Arduino board using I2C protocol.
I want to send some data through Arduno board on SCL and SDA using I2C protocol and Attaching this SCL and SDA cable to NXP board want to glow dimmer LED(PCA9532).
Please give me some idea and code.
Thanks
[/quote]
It's incredibly unlikely that anyone here will simply write your code for you. Implementing I2C on the Arduino is easy, and you'll have to read the documentation for your LPC1114 to understand how it implements I2C.
Start here: http://www.nxp.com/documents/data_sheet/LPC111X.pdf
And happy reading!
[/quote]
Thanks for your kind reply.
[b]Following is the code for NXP PCA9532 dimmer LED which is working fine.[/b]
[code]
#include "driver_config.h"
#include "target_config.h"
#include "type.h"
#include "i2c.h"
extern volatile uint32_t I2CCount;
extern volatile uint8_t I2CMasterBuffer[BUFSIZE];
extern volatile uint8_t I2CSlaveBuffer[BUFSIZE];
extern volatile uint32_t I2CMasterState;
extern volatile uint32_t I2CReadLength, I2CWriteLength;
/*******************************************************************************
** Main Function main()
*******************************************************************************/
int main (void)
{
uint32_t i;
int mm;
if ( I2CInit( (uint32_t)I2CMASTER ) == FALSE ) /* initialize I2c */
{
while ( 1 ); /* Fatal error */
}
I2CMasterBuffer[0] = PCF8594_ADDR;
I2CMasterBuffer[1] = 0x12; /* address */
I2CMasterBuffer[2] = 0x97; /* Data0 */
I2CMasterBuffer[3] = 0x80; /* Data1 */
I2CMasterBuffer[4] = 0x00;
I2CMasterBuffer[5] = 0x40;
I2CMasterBuffer[6] = 0x55;
I2CMasterBuffer[7] = 0xFA;
I2CMasterBuffer[8] = 0x00;
I2CMasterBuffer[9] = 0x00;
// I2CMasterBuffer[11] = 0x12;
//I2CMasterBuffer[11] = 'P';
I2CEngine();
}
for ( i = 0; i < 0x200000; i++ ); /* Delay after write */
for ( i = 0; i < BUFSIZE; i++ )
{
I2CSlaveBuffer[i] = 0x00;
}
/* Write SLA(W), address, SLA(R), and read one byte back. */
I2CWriteLength = 2;
I2CReadLength = 4;
I2CMasterBuffer[0] = PCF8594_ADDR;
I2CMasterBuffer[1] = 0x00; /* address */
I2CMasterBuffer[2] = PCF8594_ADDR | RD_BIT;
I2CEngine();
return 0;
}
So, I want to run the above Arduino code on the Arduino board and want to connect SCL , SDA and GND cable to the NXP board's pin respectively and after powering the NXP board I expect that dimmer light will glow on NXP board.
Thanks a lot for your kind reply and suggestions.
I tried code is running on Arduino board but PCA9532 dimmer LED is not glowing on NXP board.
What could be gone wrong with it.
That won't work. For every Wire.endTransmission you need a corresponding Wire.beginTransmission.
Why do you think it would work? You have lots of ends but only one begin. Better read this:
http://www.gammon.com.au/i2c
Thanks a lot for your reply.
I tried without so many Wire.endTransmission(); but still it is not working .
Please suggest me something on this.
Thanks....
[/quote]
Hi...!!!
I tried like this also but on NXP LPC1114 with baseboard but PCA9532 is not glowing (LED Dimmer Light).
Even I checked it with 4.7Kohm pull up registers but still it is not working
Please suggest me something.
Code for Arduino:-
#include <Wire.h>
void setup()
{
Wire.begin(); // join i2c bus (address optional for master)
}
void loop()
{
Wire.beginTransmission(192); // transmit to device (0xc0)
// device address is specified in datasheet
Wire.write(byte(0x00)); // sends instruction byte
Wire.write(151);
Wire.write(128);
Wire.write(0);
Wire.write(64);
Wire.write(85);
Wire.write(250);
Wire.write(0);
Wire.write(0);
Wire.endTransmission(); // stop transmitting
}
In my Arduino board it is compiling as well as loading also, even data is available on oscilloscope which I am not able to understand but my NXP PCA9532 is not glowing at all.