karelv
/
i2c_io_lpc4088
IO-based I2C functions with PCF8574 to proof my HW is correctly wired. Working on my LPC4088
Diff: main.cpp
- Revision:
- 0:b0247e85bf0e
diff -r 000000000000 -r b0247e85bf0e main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Dec 07 13:56:12 2014 +0000 @@ -0,0 +1,30 @@ +#include "mbed.h" +#include "my_i2c.h" + +DigitalOut myled(LED1); + +// Connections made: +// SDA to pin9 of LPC4088 QSB +// SCL to pin10 of LPC4088 QSB +// on I2C bus is PCF8574 connected at sub-address 0 (0x40). +// all supplied at 3.3V +// no external pullup (5K internal pullup used by my_i2c functions) +// +// note in the my_i2c functions a delay of 1us is added after each transition of the pin. +// so this means an absolute maximum frequency of 500kHz. + +int main() { + + while(1) { + myled = 1; + my_i2cStart(0x40); + my_i2cWrite (0x55); + my_i2cStop(); + wait(0.5); + myled = 0; + my_i2cStart(0x40); + my_i2cWrite (0xAA); + my_i2cStop(); + wait(0.5); + } +}