Rading SPI data sent to a NJU6623 LCD controller

HI All,

As part of a project I’m working on I need to read data being sent to a 15-CHARACTER 1-LINE DOT MATRIX LCD CONTROLLER DRIVER with OUTPUT PORT - NJU6623 Data Sheet

The aim will be to use a MEGA2560 as a slave. Read the code its being sent and when it picks up a certain character being sent to the DDRAM address 0x80 start sending different data to the screen.

I have the below code for writing to the screen. This works when directly hooked up to the screen.

#include <SPI.h>
#include <Time.h>
#include <Wire.h>
#include "RTClib.h"

RTC_DS3231 rtc;

#define DATAOUT 51 // MOSI
#define SPICLOCK  52 //sck
#define ssPin 53 // PB0

#define mode0 49
#define mode1 48

// User configurable
String welcome = "TEST"; // populate something into the text display - 12 Char max anything else is truncated.

void setup() {

  // Control pins for the display SPI
  pinMode(mode0, OUTPUT);
  pinMode(mode1, OUTPUT);
  pinMode(ssPin, OUTPUT);

  // Real time clock
 rtc.adjust(DateTime(2020, 4, 01, 13, 54, 0)); //a fixed time

  SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE3)); //I couldn't see a defined max speed in the NJU6623 datasheet, 10Meg is quite an increase on the original 9600, so need to monitor incase this is not stable.
  Serial2.begin (4800, SERIAL_8E1);


void loop()


  // LCD Display

void populateFixedLcdDisplay(String _lcdInput)

  if (_lcdInput.length() < 12)
    for (byte i = _lcdInput.length() + 1; i <= 12; i++)
      _lcdInput.concat(' ');

  byte _start = 0x80;

  PORTB &= ~(1 << PB0);
  PORTB |= (1 << PB0);

  for (byte i = 0; i < _lcdInput.length(); i++)
    PORTL |= (1 << PL0);
    PORTB &= ~(1 << PB0);
    PORTB |= (1 << PB0);
    PORTL &= ~(1 << PL0);

As I don’t have a spare Radio ( the device that currently populates the display) I’ve set up an Uno to act as a slave and read what the above code is sending out so I can test its all working before fitting.

Currently my slave code below kind of reads from the above code but only if i sent certain text that ends in :

#include <SPI.h>
char buff [50];
volatile byte indx;
volatile boolean process;

void setup (void) {
   Serial.begin (9600);
   pinMode(MISO, OUTPUT); // have to send on master in so it set as output
   SPCR |= _BV(SPE); // turn on SPI in slave mode
   indx = 0; // buffer empty
   process = false;
   SPI.attachInterrupt(); // turn on interrupt
ISR (SPI_STC_vect) // SPI interrupt routine 
   byte c = SPDR; // read byte from SPI Data Register
   if (indx < sizeof buff) {
      buff [indx++] = c; // save data in the next index in the array buff
      if (c == ':') //check for the end of the word
      process = true;
void loop (void) {
   if (process) {
      process = false; //reset the process
      Serial.println (buff); //print the array on serial monitor
      indx= 0; //reset button to zero


How do I modify the slave to read a single CGRAM character being sent to 0x80 of the DDRAM?