Jump to content
43oh

Serial monitor communication to LCD via I2C cuts out after about 3 seconds


Recommended Posts

I have a Spikenzie Labs LCD screen with an interface (screen utilizes the HD44780 chipset). I have it connected to an MSP-EXP432P401R (Rev 1.0). I have finally got code working that allows me to write to the LCD screen through the serial monitor, however I can only write to the screen for a short but varying amount of time. Sometimes I can print to the screen for 5 seconds, sometimes only for 1 second before communication cuts out. Here is the code I am using:

#include <Wire.h>
#include <LiquidCrystal.h>


#define addr 0x40 >> 1


void setup()
{
  Wire.begin();
  Serial.begin(9600);
}




void loop()
{
  Wire.beginTransmission(addr);
  Wire.write(Serial.read());
  Wire.endTransmission(); 
}

My connections are as follows:

LCD screen -> MSP432

VCC -> 5V

GND -> GND

SDA -> pin 10

SCL -> pin 9

 

I have also tried using a level shifting circuit on the data lines with no effect.

 

Does anyone know what's going on and what I can do to fix this? Thank you

Link to post
Share on other sites

@@chicken is right, you should check if there is a character available otherwise it will write -1 to the LCD screen at a very fast pace and hence it might appear that things are not working.

 

I would suggest the following:

#include <Wire.h>
#include <LiquidCrystal.h>


#define addr 0x40 >> 1


void setup()
{
  Wire.begin();
  Serial.begin(9600);
}




void loop()
{
  if(Serial.available()) {
    Wire.beginTransmission(addr);
    Wire.write(Serial.read());
    Wire.endTransmission(); 
  }
}

 

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...