1602A 16x2 LCD with Mega displaying only blocks on top row

When you have blocks only on the top row of a two row display it means that the display has not been properly initialized. This can be due to improper wiring and/or a bad program.

When troubleshooting an LCD problem like this you should remove as much code as possible, especially any code that causes changes to the display. Generally this means that all the code should be in setup() and there should be nothing between the brackets in loop().

#include <LiquidCrystal.h>

//LiquidCrystal lcd(RS, E, D4, D5, D6, D7);
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);      // put your pin numbers here

void setup()
  {
  lcd.begin(16, 2);                          // put your LCD parameters here
  lcd.print("hello, world!");
  lcd.setCursor(0,1);
  lcd.print("it works!");
  }

void loop()
  {
  }

Don