• I have determined what needs to be done to make the PCD8544 display actually work, and not cut off the first two bytes: every line needs the extra two bytes on the end, otherwise the display gets confused (I have no idea why - It doesn't look like it should be necessary from the datasheet...). The extra two bytes on the last line overwrite the first two bytes of the first line. Hence, the last two bytes need to be set to the first two bytes of line one.

    This sounds easy enough, but my code isn't working:

      LCD.flip = function () {
        for (var i=0;i<6;i++) {
          digitalWrite(dc,0); // cmd
          spi.send(0x40|i, ce); // Y addr
          spi.send(0x80, ce); // X addr
          digitalWrite(dc,1); // data
          if (i==5) {
          	var last=new Uint8Array(this.buffer,i*84,84+2);
            console.log(this.buffer[0]);
            console.log(this.buffer[1]);
          	last[84]=this.buffer[0];
            console.log(last[84]);
          	last[85]=this.buffer[1];
            console.log(last[85]);
            console.log(last);
          	spi.send(last, ce);	
          } else {
          	spi.send(new Uint8Array(this.buffer,i*84,84+2), ce);
          }
        }
      };
    
    12
    130
    0
    0
    new Uint8Array([0,0,0,0,62,42,20,0,0,0,0,0,0­,0,28,34,20,0,0,0,0,0,0,0,0,62,24,62,0,0­,0,0,0,0,0,14,56,14,0,0,0,0,0,0,62,18,12­,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0­,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])­
    

    What the heck is going on there? Why aren't those values in the array being set?

    If I manually define the array I want it to be sending for the last line and send that, the screen renders correctly, with the first two bytes displayed.

    var magic=Uint8Array([0,0,0,0,62,42,20,0,0,0­,0,0,0,0,28,34,20,0,0,0,0,0,0,0,0,62,24,­62,0,0,0,0,0,0,0,14,56,14,0,0,0,0,0,0,62­,18,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0­,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0­,12,130]);
    
      LCD.flip = function () {
        for (var i=0;i<6;i++) {
          digitalWrite(dc,0); // cmd
          spi.send(0x40|i, ce); // Y addr
          spi.send(0x80, ce); // X addr
          digitalWrite(dc,1); // data
          if (i==5) {
          	spi.send(magic, ce);	
          } else {
          	spi.send(new Uint8Array(this.buffer,i*84,84+2), ce);
          }
        }
      };
    

    But yeah - I don't know why I can't set those values in the array....

    Using v59.

About

Avatar for DrAzzy @DrAzzy started