Sharp Memory display coding question

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
task
 
Posts: 18
Joined: Sun Nov 11, 2012 9:30 pm

Sharp Memory display coding question

Post by task »

I am trying to write code for the Sharp display using the SPI library and I don't understand why the lines are getting displayed all over the place

I tried adding delays in a couple of places and deleted them again, because I thought maybe the commands didn't register
It seems sending through line numbers 0, 1, 2 doesn't do anything. Then line number 3 is almost in the middle and the next line on the bottom and then things are all over the place. I also took a small video, the video should be available in about 15 min (http://youtu.be/UZvSrjDENm8)

Code: Select all

#include <SPI.h>
const int slaveSelectPin = 10;
#define MLCD_WR 0x80					// MLCD write line command
#define MLCD_CM 0x20					// MLCD clear memory command
#define MLCD_SM 0x00					// MLCD static mode command
#define MLCD_VCOM 0x40					// MLCD VCOM bit

byte currentVcomState = MLCD_VCOM;
byte currentLine = 0;
unsigned int sixteenZeros = 0;

void setup() {
  // set the slaveSelectPin as an output:
  pinMode (slaveSelectPin, OUTPUT);
  // initialize SPI:
  SPI.begin(); 
  Serial.begin(9600);
  
  clearDisplay();  
  delay(1000);  
  currentVcomState = currentVcomState ? 0x00 : MLCD_VCOM;
}

unsigned char lineNumber = 0;

void loop() {
  drawLine(lineNumber++);
  delay(1000);
}

void clearDisplay() {
  digitalWrite(slaveSelectPin,HIGH);
  SPI.transfer(MLCD_CM | currentVcomState);
  Serial.print("clear screen ");
  Serial.println(MLCD_CM | currentVcomState);
  SPI.transfer(0x00);
  digitalWrite(slaveSelectPin,LOW);
}

void drawLine(unsigned char lineNumber) {
  //http://www.embeddedartists.com/sites/default/files/support/datasheet/Memory_LCD_Programming.pdf
  
  currentVcomState = currentVcomState ? 0x00 : MLCD_VCOM;
  digitalWrite(slaveSelectPin,HIGH); //start SPI
  SPI.transfer(MLCD_WR | currentVcomState);  //send 10000000 | 1000000 = 11000000 and swap second bit from 1 to 0 constantly
  SPI.transfer(lineNumber); //line number from 0 upwards
  Serial.println(lineNumber);
  
  for (int i = 0; i < 12; i++) {
    SPI.transfer(0x00);//just populate 96 bits with 0's to fill one line
  }
  SPI.transfer(sixteenZeros); //send 16 bits
  //SPI.transfer(0x00); //send another 8 bits
  delay(100);
  digitalWrite(slaveSelectPin,LOW);
}


User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Sharp Memory display coding question

Post by adafruit_support_rick »

Are you using our library? Does the display work with our example sketch?

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Sharp Memory display coding question

Post by adafruit_support_bill »

Have you looked at our library? https://github.com/adafruit/Adafruit_SH ... ry_Display
We bypass the spi lib, but the timing and command sequences should be similar.

task
 
Posts: 18
Joined: Sun Nov 11, 2012 9:30 pm

Re: Sharp Memory display coding question

Post by task »

It didn't want to work on the Teensy 3 when I started. I tested it on my Arduino and it worked perfectly then I just tried it now on the Teensy 3 again. I probably had the pins wrong. Thank you

task
 
Posts: 18
Joined: Sun Nov 11, 2012 9:30 pm

Re: Sharp Memory display coding question

Post by task »

I see after testdrawchar() there is a refresh and then nothing for 2 seconds while the delay is waiting. Shouldn't the screen be refreshed at least every 1 second. What will happen if you let it go for longer as in the example code?

Code: Select all

  testdrawchar();
  display.refresh();
  delay(2000);

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Sharp Memory display coding question

Post by adafruit_support_bill »

The data sheet for the display says that the display should be refreshed at least every couple of hours.
) A still image should be displayed less than two hours, if it is necessary to display still image longer than two hour,
display image data must be refreshed in order to avoid sticking image on LCD panel.

jaw
 
Posts: 1
Joined: Tue Aug 13, 2013 12:47 pm

Re: Sharp Memory display coding question

Post by jaw »

adafruit_support_bill wrote:The data sheet for the display says that the display should be refreshed at least every couple of hours.
) A still image should be displayed less than two hours, if it is necessary to display still image longer than two hour,
display image data must be refreshed in order to avoid sticking image on LCD panel.


the data sheet is very poorly written by someone
who does not seem to be a native speaker of english.

sharp also has an appnote on this display:
http://www.sharpmemorylcd.com/resources ... n_Info.pdf


on page 10:
This polarity-inversion flag enables a periodic polarity inversion
on the panel to keep a latent charge from building up within the
Liquid Crystal cells.
on page 12:
as long as the panel has power and VCOM is toggled periodically.
Sharp recommends keeping maximum time between VCOM toggles to no more
than one second, and refreshing data every two hours, to prevent stuck
pixels.
and on page 13:
In either implementation, the positive and negative inversion
intervals should be kept as equal as possible, and intervals should
not exceed one second.

my interpretation is that the data (1152 bytes) should be resent
at least every few hours, but that the display polarity needs to
be inverted at least one per second.

User avatar
solardude
 
Posts: 145
Joined: Fri Oct 18, 2013 12:47 am

Re: Sharp Memory display coding question

Post by solardude »

jaw wrote:
adafruit_support_bill wrote:The data sheet for the display says that the display should be refreshed at least every couple of hours.
) A still image should be displayed less than two hours, if it is necessary to display still image longer than two hour,
display image data must be refreshed in order to avoid sticking image on LCD panel.


the data sheet is very poorly written by someone
who does not seem to be a native speaker of english.

sharp also has an appnote on this display:
http://www.sharpmemorylcd.com/resources ... n_Info.pdf


on page 10:
This polarity-inversion flag enables a periodic polarity inversion
on the panel to keep a latent charge from building up within the
Liquid Crystal cells.
on page 12:
as long as the panel has power and VCOM is toggled periodically.
Sharp recommends keeping maximum time between VCOM toggles to no more
than one second, and refreshing data every two hours, to prevent stuck
pixels.
and on page 13:
In either implementation, the positive and negative inversion
intervals should be kept as equal as possible, and intervals should
not exceed one second.

my interpretation is that the data (1152 bytes) should be resent
at least every few hours, but that the display polarity needs to
be inverted at least one per second.
Were you able to get the Sharp Memory LCD library working on the Teensy 3.1 board?

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”