Display from Nokia 3310 is cheap graphical LCD, and it's usually easier to buy it than other LCDs. Nokia 3310, 3315, 3330, 3350, 3410 phones have the same display. It's based on pcd8544 controller. LCD is monochrome, without backlight, with resolution 84x48. SerialDisplayLib has a description of Nokia 3310 display. a.lp-mp3 player uses Nokia 3310 LCD.
Unlike characted LCD, Nokia 3310 LCD has SPI (Serial Peripheral Interface). Only writing data to LCD is possible, so MOSI (Master Out - Slave In) and SCK wires are used, display has no MISO. Of course, MCU is master and LCD is slave. D/C, CS and RESET pins are connected to any available port lines. Capasitor C1 (from Vout to GND) can be from 0.1 μF to 2.2 μF.
Note that supply voltage is 3.3 V (2.7-3.3 V), not 5 V.
Schematic of board with Nokia 3310 LCD
Download schematic of board with Nokia 3310 LCD in TinyCad format (.dsn)
import mcujavasource.mcu.*;
import mcujavasource.mcu.external.lcd.Nokia3310Lcd;
/** Tutorial 10: Nokia 3310 LCD.
* Shows "chess board" on LCD, cell size 4x4 pixels.
*/
public class Main extends Microcontroller
{
public static final String MESSAGE = "Hello, LCD!";
private Nokia3310Lcd lcd;
private Port lcdControlPort = getHardware().getPort("B");
private Pin csPin = lcdControlPort.getPin(1);
private Pin dcPin = lcdControlPort.getPin(0);
private Pin resetPin = lcdControlPort.getPin(2);
public void init()
{ getHardware().setAllPortsDirection(Pin.IN);
getHardware().setAllPortsPullUp(true);
lcd = new Nokia3310Lcd(csPin, dcPin, resetPin);
}
public void start()
{ lcd.init();
lcd.setPosition(0, 0);
for(int row = 0; row < 6; row ++)
{ for(int col = 0; col < 84; col++)
{ byte data = 0x0F;
if((col & 4)==0) data = (byte)0xF0;
lcd.sendData(data);
}
}
getHardware().setInterruptsEnabled(true);
}
}