Blairo 1 Posted August 31, 2015 Share Posted August 31, 2015 Hello, I'm trying to get a standard 1602 LCD (16x2 from Raystar) connected to MSP432 with the I2C interface. Are there any existing libraries which could help me out? I've found some I2C libraries for Arduino but naturally they're not compatible, and the only existing Energia examples deal with CogLCD which uses a SPI interface (emerging question: is there a way to make SPI and I2C compatible?) or standard 16 pin connection. MSP432 is still a relatively fresh chip, so I can't find any examples whatsoever. Thanks! Quote Link to post Share on other sites
B@tto 51 Posted August 31, 2015 Share Posted August 31, 2015 Hi, Generaly if you use an Arduino library which only use high level functions (such as Wire.write() ) it would be directly compatible. Quote Link to post Share on other sites
Blairo 1 Posted August 31, 2015 Author Share Posted August 31, 2015 I tried the examples using Arduino's Liquid Crystal I2C library (LiquidCrystal_i2C.h) but that doesn't seem to work in energia, will not compile at all. Quote Link to post Share on other sites
Fmilburn 446 Posted August 31, 2015 Share Posted August 31, 2015 Hello @@Blairo A while back I made a 43oh post with Energia examples here: http://forum.43oh.com/topic/8766-sensor-code-examples/ Follow the github link to find them. The one named I2C_LCD has been tested on the MSP432 and should work for you. However, you will need to do the following: Make sure you do level conversion - the LCDs are usually 5V devices The example is for the F5529. For the MSP432 you need to connect SCL and SDA to pins 9 and 10 respectively. There is a footnote to this effect in the code The example is for a 4x20 LCD. If you are using a 2x16 you need to change the variables rows and columns to 2 and 16 respectively. Make sure I2C address is correct for your LCD. Let me know if it works.... PNY90 and Blairo 2 Quote Link to post Share on other sites
Blairo 1 Posted August 31, 2015 Author Share Posted August 31, 2015 Thanks a lot, I'll try it out tomorrow morning. Will update of course Quote Link to post Share on other sites
Blairo 1 Posted September 1, 2015 Author Share Posted September 1, 2015 It works! I did a level conversion for SDA and SCL while using 5 volts for power. Thanks a lot, now I only need to make this work in my CCS project. Seeing this uses some energia libraries, would I do this just by including the appropriate Energia headers in my CCS project? Update: Okay, so I naively tried to include the necessary header files (like print.h, wire.h, ...) into my CCS project in order to try and make the LCD code compile, but it doesn't seem to work that way since I get all kinds of errors. Any ideas? Thanks. Quote Link to post Share on other sites
Fmilburn 446 Posted September 1, 2015 Share Posted September 1, 2015 @@Blairo Glad it worked... There is a tutorial on importing an Energia sketch into CCS here: http://43oh.com/2014/07/import-energia-sketches-into-ccs6-for-line-by-line-debugging/ I have tried it but do not routinely use it. Edit: also do a search in Energia Quote Link to post Share on other sites
Blairo 1 Posted September 1, 2015 Author Share Posted September 1, 2015 Thanks, will take a look at it. What I noticed though was that CSS doesn't yet support importing MSP432 Energia sketches. I tried importing a blink example, but there's no MSP432 on the available device list and choosing anything else gives me an error when uploading ("No USB FET was found"). For clarification: I don't just want to import Energia sketch into CCS, because then I'm just changing IDE's. What I want to do is to find a way to make a main.c file which includes LiquidCrystal_I2C.h and can make an LCD work, since my project, which needs the LCD functionality, is already written in CCS. Quote Link to post Share on other sites
Fmilburn 446 Posted September 2, 2015 Share Posted September 2, 2015 Sorry @@Blairo, I have not mixed Energia and CCS with the MSP432 and have only used the method in the tutorial. Perhaps someone else can help. Blairo 1 Quote Link to post Share on other sites
Blairo 1 Posted September 2, 2015 Author Share Posted September 2, 2015 Okay, thanks for all the help regardless Quote Link to post Share on other sites
Maggie 0 Posted March 28, 2016 Share Posted March 28, 2016 Hello, I am having trouble getting my LCD with interface to work with my MSP432 microcontroller. I have followed all the instructions you have here and the code compiled and uploaded just fine. But nothing shows up on the display. I'm not sure why you suggest the first step to level up the voltage as there is a 5V pin on the MSP432 which I am using. Do you have any ideas on how I can troubleshoot the problem? Here is the code I am using: #include <Wire.h> #include "LiquidCrystal_I2C.h" byte address = 0x64; // LCD I2C address int columns = 16; // number of columns on LCD int rows = 2; // number of rows on LCD LiquidCrystal_I2C lcd(address, columns, rows); // make custom characters: byte rocket[8] = { 0b00000, 0b00000, 0b00100, 0b01110, 0b01110, 0b01110, 0b11111, 0b11111 }; byte liftOff[8] = { 0b00100, 0b01110, 0b01110, 0b01110, 0b11111, 0b11111, 0b01010, 0b00100 }; void setup() { lcd.init(); // initialize the lcd lcd.backlight(); lcd.createChar(0, rocket); // Create Character 0 lcd.createChar(1, liftOff); // Create Character 1 } void loop() { // Clear everything lcd.clear(); // Place Energia in first column, first row lcd.setCursor(0,0); lcd.print("Energia"); // Place rocket ready for launch at right, bottom lcd.setCursor(14, (rows-1)); lcd.write(0); // Countdown for (int i = 10; i > -1; i--) { lcd.setCursor(8,0); lcd.print(i); delay(1000); lcd.setCursor(8,0); lcd.print(" "); } // Liftoff for (int i = (rows-1); i > -1; i--) { lcd.setCursor(14, i); lcd.write(1); delay(1000); lcd.setCursor(14, i); lcd.print(" "); } delay(2000); } Thank you for any help you can provide!!! Quote Link to post Share on other sites
dubnet 238 Posted March 28, 2016 Share Posted March 28, 2016 When connecting devices together that use different supply voltages you will often need to level shift on the data lines. The lauchpad and the display have different thresholds for what consitutes a high or low signal. You may want to google 'voltage level shifting' for some more information on the subject. I believe that sparkfun.com has a variety of breadboard friendly level shifters. Quote Link to post Share on other sites
Rei Vilo 695 Posted March 28, 2016 Share Posted March 28, 2016 Please find a reference I've compiled about different options for logic level converters. Quote Link to post Share on other sites
kpetrinak 0 Posted March 28, 2016 Share Posted March 28, 2016 Also having trouble making an MSP432 communicate with an LCD screen, have tried many things to no avail. Here's some info: Launchpad MSP432P401R Rev 1.0 Using Energia 0101E0017 on Windows 7 64-bit LCD Screen is a SpikenzieLabs w/ interface (LCD, INTERFACE) (uses the common HD44780 chipset) I'm trying to implement simple code to reduce the complexity of troubleshooting, here's the code I'm using: #include <Wire.h> #include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x20,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display void setup() { lcd.init(); // initialize the lcd // Print a message to the LCD. lcd.backlight(); lcd.print("Hello, world!"); } void loop() { } I've provided a picture of my set up and results after uploading the code one time: http://imgur.com/HbwLOt0 My thoughts: After every iteration of uploading the code, the screen outputs one iteration of: 040040040 $ $ I've tried many different I2C addresses that I have seen suggested throughout the forums, and tried running an I2CScan program to find the actual address (couldn't make I2CScan work on the 432). The only result I get, as seen above, is with an address of 0x20. My interpretation of the resulting output to the LCD screen is this: I2C addresses are 7-bit, plus an 8th bit to indicate read or write status. The 8th bit is added as the LSB of the address. After a 0 (for write) is added to the address 0x20, the result is 0x40. Is this why the screen is displaying 040? Or am I wrong in thinking this? Can someone tell me what is wrong, or if I am doing something wrong here? Any help is appreciated greatly! (Does this come down to stepping up the voltage of the data pins as stated above?) Quote Link to post Share on other sites
kpetrinak 0 Posted March 30, 2016 Share Posted March 30, 2016 Update: I took the advice of level shifting the SDA and SCL data lines. I constructed the MOSFET circuit that was recommended by Rei Vilo's link above, the output to my LCD screen remained the same. I've double and triple checked my mosfet circuit and it seems correct. Still stuck. Unfortunately this is a time sensitive issue, and any help is greatly appreciated. Thanks Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.