Jump to content
Sign in to follow this  
kpetrinak

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

Share this post


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(); 
  }
}

 

 

Share this post


Link to post
Share on other sites

Thanks for the replies! I used the code suggested by @@energia, it seems to work a little longer but still cuts out after a variable amount of time! Every time I upload the code it works for about 5 seconds.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×