Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 7 months ago.
Having I2C comm issues
Hi,
I am having communication issues. I can not seem to communicate with this display using the I2C command set.
I am using a Switch Science LPC824. I have Pin4 = Data = LCDPin2 and Pin5 = clock = LCDPin3 connected along with 3.3V and ground back to the LPC824.
Below is my simple test code. I do not see any indication of communications. Is there an initialization function I need to call first? I do not see any listed in your header library.
Do I need a pull-up on the I2C lines?
I am hoping you can help out.
Thanks Jamie
//////////////////////
- include "mbed.h"
- include "DigoleSerialDisp.h"
Serial usb(USBTX, USBRX); define USB connection pins
DigoleSerialDisp lcd(dp4, dp5, 0x27);DigoleSerialDisp(PinName sda, PinName scl, uint8_t address=0x27); igoleSerialDisp lcd(p9, p10);UART DigoleSerialDisp(PinName TX, PinName RX);
int main() { wait(5000); wait for LCD to power up
usb.baud(115200); define USB connection speed lcd.setLCDColRow(220,176); lcd.clearScreen(); lcd.baud(9600);
while(1) { lcd.setPrintPos(0,0); lcd.print("Hello World"); blink backlight
/ Turn on back light */ lcd.backLightOn(); wait(1000);
/ Turn off back light */ lcd.backLightOff(); wait(1000); } }
Question relating to:
1 Answer
9 years, 7 months ago.
Please use the << code>> << /code>> tags (no spaces, see "Editing tips") for your code blocks. I am not familiar with mbed and I2C, but usually a pull-up is required in both SDA and SCL pins, have you added them or are there already in the hardware?
Thanks. I had the wrong syntax for posting code snippets in HTML. Sorry. Code snippets still do not work.
AFIK the pull-ups are built into the controller board and direct connections are possible.
<< code>>
- include "mbed.h"
- include "DigoleSerialDisp.h"
Serial usb(USBTX, USBRX); define USB connection pins
DigoleSerialDisp lcd(dp4, dp5, 0x4e);DigoleSerialDisp(PinName sda, PinName scl, uint8_t address=0x27); igoleSerialDisp lcd(p9, p10);UART DigoleSerialDisp(PinName TX, PinName RX);
int main() { wait(5000); wait for LCD to power up
usb.baud(115200); define USB connection speed lcd.setLCDColRow(220,176); lcd.clearScreen(); lcd.baud(9600);
while(1) { lcd.setPrintPos(0,0); lcd.print("Hello World"); blink backlight
/ Turn on back light */ lcd.backLightOn(); wait(1000);
/ Turn off back light */ lcd.backLightOff(); wait(1000); } } << /code>>
posted by 14 May 2015