how to use and LCD display with ARDUINO DUE

Hello everyone,

I am new to Arduino and having a hard time understanding why I can't get my LCD display working with the SPI pins on the DUE here is what I have

#include <SPI.h>
#define PIN_SPI_MOSI
#define PIN_SPI_MISO
#include <LiquidCrystal.h>

void setup() {
LiquidCrystal lcd(PIN_SPI_MISO ,PIN_SPI_MOSI ,53,52,51,50);
Serial.begin(9600);
SPI.beginTransaction(SPISettings(14000000, MSBFIRST, SPI_MODE0));
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("hello, world!");
}

void loop() {

//Code for LCD
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print(millis() / 1000);
// set up the LCD's number of columns and rows:

}

Is the LCD 3.3V compatible?

That code doesn't compile.

Remove the #defines for PIN_SPI_MISO PIN_SPI_MOSI

You have pin collisions between two different libraries. LiquidCystal vs SPI
You are telling the LiquidCrystal library to use the MISO and MOSI pins for its 4 bit mode, but then you re-initalized those two pins for SPI mode with your call to SPI.beginTransaction().

The LiquidCrystal library communicates with the hd44780 LCD using in 4 bit or 8 bit parallel mode not SPI.
You can tell LiquidCrystal to use the SPI pins as two of the pins to talk to the LCD in 4 bit mode.
But when you do that, you can't use the SPI pins for SPI.

You also need to move the LiquidCrystal constructor up above setup() so that it is in global space, vs having it as a local int setup().
If it is a local in setup() then no other functions will be able to access the lcd object and it goes away when setup() returns.

--- bill

What kind of LCD are you using?
Link to the product you have bought and make a real picture of yours (front and back).

Why do you want to use SPI? There are good reasons to do that, but I doubt a beginner will need it. So please explain why and which tutorial you are following.

LiquidCrystal lcd(PIN_SPI_MISO ,PIN_SPI_MOSI ,53,52,51,50);
Serial.begin(9600);
SPI.beginTransaction(SPISettings(14000000, MSBFIRST, SPI_MODE0));

You have chosen to use Hardware SPI pins for bit-banging the LCD i.e. GPIO mode
The SPI.beginTransaction() call will configure the Hardware SPI pins for SPI instead of GPIO.

Remove the SPI.beginTransaction() statement.

Personally, I would not waste SPI pins for bit-banging. But they should work.

David.