Thanks for the advice. Ill look over it more carefully tomorrow, but it
seems a little bit over my head.
What Id like is the simplest code possible to send data over the I2C bus.
Ive found some examples and written the code below, Im not sure its
entirely correct though, would it be enough to call "I2CTransferbyte" with
the adress of the display driver and the command I want to send?
#include
unsigned I2CAddress;
unsigned I2CData;
void I2CISR (void)
{
switch (I2C0STAT)
{
case (0x08):
I2C0CONCLR=0x20;
I2C0DAT=I2CAddress;
break;
case (0x18):
I2C0DAT = I2CData;
break;
case (0x20):
I2C0DAT = I2CAddress;
break;
case (0x28):
I2C0CONSET = 0x10;
break;
default:
break;
}
I2C0CONCLR = 0x08;
VICVectAddr = 0x00000000;
}
void I2CTransferbyte (unsigned Addr, unsigned Data)
{
I2CAddress = Addr;
I2CData = Data;
I2C0CONCLR = 0x000000FF;
I2C0CONSET = 0x00000040;
I2C0CONSET = 0x00000020;
}
int main (void) {
VICVectCntl1 = 0x00000029;
VICVectAddr1 = (unsigned)I2CISR;
VICIntEnable = 0x00000200;
PINSEL0 = 0x50;
I2C0SCLH = 0x08;
I2C0SCLL = 0x08;
}
> Take a look at the WIZnet demo in the FreeRTOS.org
download. This has an
> I2C link to a TCP/IP co-processor. LPC2106 rather than LPC2148, and GCC
> rather than Keil, but its just C code so not that dependent on the
> compiler.
>
> Regards,
> Richard.
>
> http://www.FreeRTOS.org
> for Cortex-M3, ARM7, ARM9, HCS12, H8S, MSP430
> Microblaze, Coldfire, AVR, x86, 8051 & PIC18 * * * *