I have been facing this issue for about a week, and after hours of trying to debug it, I was hoping I could find some help here. I have been trying to use an LCD 16x2 screen (unaware of the exact model but have been using this datasheet) and display some simple text on it with my MSP430FR2355 using MSP430 Assembly. Most of my code has come from me attempting to translate C libraries for displaying text into assembly. The LCD powers on and the Vss, Vdd, and Vo pins are all working fine. When it powers on it just displays the top line as a row of rectangle characters. My pin map is as follows:

RS - P2.0

RW - P2.1

E  - P2.2

D0 - P3.0

D1 - P3.1

D2 - P3.2

D3 - P1.3 (P3.3 is broken)

D4 - P3.4

D5 - P3.5

D6 - P3.6

D7 - P3.7

The wirings have been checked many times and I have used a logic analyzer on every single pin RS-D7. All of these tests have shown that the pins are going high and low correctly and the way they should. The full assembly file can be found here (do ignore my silly code comments). The result of the code is that none of the commands do anything, after all the commands the screen just stays as a single row of rectangles. Thank you for taking the time to help me and if this is the wrong forum for this please direct me to the right one! :D

I also did my best to make a schematic of my current setup but I'm very new to this so it might not be great.


simulate this circuit – Schematic created using CircuitLab

Also here are photos of my LCD screen https://imgur.com/a/SXDUFv0


I have ordered a new LCD because I'm pretty sure the problems are caused by the fact my current one has an I2C backpack soldered on it and that I'm not using it. I will update this post again when I receive the new LCD.

Update 2

I have received my new LCD screen without the I2C backpack but I am still experiencing issues. Running my program does nothing but sometimes randomly the first initializing command will work and will change the screen from 1 line to 2 lines. This is the only command I can get to work and even then it takes a few tries. I'm basically completely lost on where to go from here. I have updated the schematics to my current setup and my updated code is here. Any and all help is appreciated.

Photo of the screen on power up: https://imgur.com/a/LIbCDqi

Photo of the screen after the one command goes through: https://imgur.com/a/GjRXWIG

Update 3

It turns out that I had the ground wiring wrong and now the code is working great with the new LCD! Thank you @Justme, @6v6gt, and @Jens for their combined help!

  • 1
    \$\begingroup\$ The top row of rectangle characters may mean the Vo is not working fine. How have you determined that it works fine? Can you show the logic analyzer captures to verify the sequences are fine or not? \$\endgroup\$
    – Justme
    Mar 15 at 23:51
  • \$\begingroup\$ @Justme I have Vo hooked up to a potentiometer and turning the potentiometer changes the contrast. I assumed that the row of rectangle characters was an intended output for when the LCD was first given power, is that not the case? I did not use the logic analyzer on Vss, Vdd, and Vo but I can test them if you want the results. If so what should I be testing, just the change of voltage when turning the potentiometer? Thank you for the quick response! \$\endgroup\$
    – Pixeled
    Mar 15 at 23:56
  • \$\begingroup\$ No, the dark boxes of rectangle characters is not supposed to happen. The display should be clear when powered up and it means the contrast voltage is way off the limits of having a proper output from the display. Also do not use a logic analyzer on Vss, Vdd and Vo, why even mention it? Show the logic capture of the data and control bus. \$\endgroup\$
    – Justme
    Mar 16 at 0:04
  • 2
    \$\begingroup\$ I am not familiar with MSP430 assembly but do you ever set RS bit high to send data instead of commands? You also seem to specifically turn the display off and never turn it on. I bet the C code did work and you are not doing the exact same things in assembly. \$\endgroup\$
    – Justme
    Mar 16 at 0:27
  • 2
    \$\begingroup\$ @Pixeled I guess you are glad that had a good outcome in the end. Simple things can cause big problems. I suggest you add your assembler code into your original question instead of leaving it in Pastebin so it will live longer and someone else may benefit from your experience. \$\endgroup\$
    – 6v6gt
    Apr 3 at 2:17

2 Answers 2



There is an I2C backpack on the display that was never mentioned. There cannot be both the backpack and the MCU driving the LCD parallel bus at the same time.

The intention of the backpack is to allow connecting the LCD to host with 4 wires only, and the I2C IO expander is driving the LCD parallel bus. And it is driving it in 4-bit mode.

So either remove the backpack, or use another display that has the parallel interface not taken by a I2C backpack.

You never turn the display on in code, so it can't show any data you write to it.

And if you get black boxes on top row, it means that there is too much contrast (drive voltage) so even unlit segments turn on. It also means the display is not initialized to operate in 2-row mode.

And the last problem is, there is no ground wire between MCU and LCD. They cannot communicate at all so now the behaviour makes sense and the display really did not take any commands or data.

After connecting a ground wire, you should see that the display initializes to 2-line mode, even if you don't fix the code otherwise, and turning the contrast up way too high will darken two lines with black squares instead of just one line.

  • \$\begingroup\$ Here is a photo of the screen when just the Vss, Vdd, and Vo pins are plugged in: imgur.com/3zel1yN I don't know if I'm just mistaken but it looks like it is on to me. also here is the logic analyzer for the data pins: imgur.com/8QN0KI2 and here is the logic analyzer for the control pins (RS at the top, RW in the middle, and E at the bottom): imgur.com/bjtx0BX \$\endgroup\$
    – Pixeled
    Mar 16 at 0:49
  • \$\begingroup\$ @Pixeled That is how the display looks when it is "off", which simply means no segment is turned on, and you have too much contrast, and the second line not enabled. You can of course measure voltage on Vo pin and we can see if that is valid or not. \$\endgroup\$
    – Justme
    Mar 16 at 0:56
  • \$\begingroup\$ so then that is what it looks like when off? I tried switching the command to instead turn the screen on. When I ran that nothing changed, so I'm pretty sure the command is not being received. \$\endgroup\$
    – Pixeled
    Mar 16 at 0:57
  • 1
    \$\begingroup\$ @Pixeled Please draw a schematic diagram how thigs are connected. It is difficult to decipher your wiring if the wires go out of the photo. \$\endgroup\$
    – Justme
    Mar 16 at 17:00
  • 2
    \$\begingroup\$ @Pixeled Pen and paper will do. Or use the schematic diagram feature embedded on this website. \$\endgroup\$
    – Justme
    Mar 16 at 17:23

Your code seems to be sending 0x38 (function set instruction) one time. The LCD datasheet you linked shows it uses a ST7066 controller (or equivalent). Looking at the ST7066 datasheet 8-bit interface (page 19) you need to send the function set instruction (0x38) three times not just once.

  • 1
    \$\begingroup\$ That usually is not necessary. The display starts up into 8-bit mode when powered up propely, so there should be no need to send 0x38 multiple times. It is just a good thing to do so, but only becomes necessary if the MCU would ever set the display to 4-bit mode - the init sequence has to be robust to handle all cases. \$\endgroup\$
    – Justme
    Mar 17 at 17:44
  • \$\begingroup\$ In an ideal case sure. But he said "When it powers on it just displays the top line as a row of rectangle characters.". This is an indication that the power up initialization is not working. I would just stick with the flow diagram in the controller datasheet until he finds out what the problem is. Then he can experiment to see what works and what doesn't. \$\endgroup\$
    – Rodo
    Mar 18 at 16:52
  • \$\begingroup\$ No the problem was the same without even the MCU and LCD grounds being connected. And there was no rectangle characters because it is an artifact of too high contrast driving the LCD glass with too high voltage. The only thing working is the LCD power-up reset because the first line appears as it is driven off. Unless the 6V from batteries has fried it with overvoltage. \$\endgroup\$
    – Justme
    Mar 18 at 16:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.