Solved ![]()
all it needed was a delay of 20ms after each write ofcourse i feel silly now after reading that in the datasheet at least twice.
working code for anyone who comes across this
/*
* 3310 lcd - Interface for arduno .
*
* Copyright (c) 2012 rotceh_dnih <rotceh_dnih@hotmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <Wire.h>
#include <PCD8544.h>
#include <string.h>Â Â Â Â //Used for string manipulations
#define eeprom1 0x50
#define STRLEN 16
static const byte me[] = {
0xC2, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
0x80, 0xC0, 0xC0, 0xF0, 0xF8, 0x38, 0x3E, 0x1A, 0x1F, 0x5F, 0x6F, 0xFF, 0xFF, 0x7F, 0x7F, 0x7F,
0xDF, 0xEF, 0x9F, 0x1F, 0x3F, 0xFF, 0x7F, 0xFF, 0xFE, 0xFE, 0x9D, 0x0F, 0x0F, 0x0F, 0x0B, 0x0F,
0x1F, 0x1F, 0x3F, 0x3F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFC, 0xFC, 0xF8, 0xF0, 0xE0, 0xC0,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x20, 0xF0, 0xFE, 0xFD, 0xFE, 0xFF, 0xFF, 0xF5, 0x1F, 0x08, 0x48, 0x08, 0x08, 0x28, 0x20, 0x80,
0xE0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x05, 0x67, 0x0E, 0x26, 0x20, 0x28, 0x28, 0x08,
0x08, 0x0C, 0x1C, 0x1A, 0x07, 0x04, 0x00, 0x00, 0x01, 0x00, 0x01, 0xC7, 0xFB, 0xFF, 0x7F, 0x7F,
0x7F, 0xFF, 0xFF, 0x7F, 0xFF, 0xFC, 0xFC, 0xF8, 0xA0, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x01, 0x1B, 0x1F, 0x1F, 0x1F, 0x1F, 0x3F, 0x3F, 0xFC, 0xE0, 0xC0, 0x00,
0x00, 0x00, 0x00, 0x83, 0xC0, 0x80, 0x80, 0x80, 0x84, 0x84, 0x88, 0x88, 0x80, 0x80, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x0C, 0x0C, 0xC4, 0x04, 0x01, 0x00,
0x80, 0xE0, 0xE0, 0xF0, 0xD0, 0xF8, 0x3F, 0x1E, 0x1F, 0x1F, 0x1F, 0x1B, 0x17, 0x05, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x07, 0x0F, 0x1E, 0x3C, 0xDC, 0xF7, 0x83, 0x81, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x80, 0x80, 0xC0, 0x40, 0x40, 0x60, 0x20, 0x10, 0x10, 0x08, 0x0C, 0x04, 0x06, 0x03, 0x03,
0x01, 0x80, 0xC0, 0xF8, 0xFF, 0x7F, 0x3F, 0x3F, 0x13, 0x11, 0x10, 0x00, 0x00, 0x00, 0x30, 0x30,
0x30, 0x38, 0x38, 0x38, 0x3C, 0x3C, 0x3C, 0x3C, 0x3E, 0x3E, 0x3E, 0x3C, 0x7C, 0x7C, 0xFC, 0xF8,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x01, 0x03, 0x03, 0x07, 0x87,
0xCD, 0x2F, 0x3B, 0x34, 0x08, 0x18, 0x18, 0x1C, 0x1E, 0x0C, 0x08, 0x00, 0x40, 0x20, 0x20, 0x10,
0x08, 0x0C, 0x86, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x03, 0xC4, 0x84, 0x84, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00,
0x00, 0x00, 0x88, 0xE8, 0xE8, 0xF8, 0xF8, 0x78, 0xFF, 0x1F, 0x1F, 0x0F, 0x03, 0x01, 0x00, 0x00,
0x00, 0x5C, 0x84, 0x83, 0xE0, 0x50, 0x70, 0xF0, 0xF0, 0xCC, 0x04, 0x02, 0x02, 0x01, 0x00, 0x00,
0x00, 0x04, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x20, 0xF0, 0xF0, 0xFC, 0xF8, 0xE4, 0x24, 0x0C, 0x06, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x80, 0x80, 0x40, 0xE0, 0xF0, 0xF8, 0xFC,
};
char buffer[STRLEN];
int bufferIndex = 0;
static const byte LCD_WIDTH = 84;
static const byte LCD_HEIGHT = 48;
int scrollPosition = -13;
// A custom glyph (a smiley)...
static const byte glyph[] = { B00010000, B00110100, B00110000, B00110100, B00010000 };
static PCD8544 lcd;
void setup() {
Â
 int me_bitmap_start_address = 0;  //change this to wherever you want to store your bitmap on eeprom & keep track
int me_bitmap_length = 504;Â Â Â Â Â Â //so that multiple bitmaps don't overlap
Â
 // PCD8544-compatible displays may have a different resolution...
 lcd.begin(84, 48);
 Wire.begin();
 Serial.begin(9600);
Â
for(int j=0; j < me_bitmap_length; j++)
{
  i2c_eeprom_write_byte(eeprom1,(me_bitmap_start_address + j),me[j]);
  delay(20);
}
 //i2c_eeprom_write_page(eeprom1, 0x0040, (byte*)me2, sizeof(me2)); // write to EEPROM
delay(2000); //add a small delay
 boot();
 delay(1000);
 // Add the smiley to position "0" of the ASCII table...
 lcd.createChar(0, glyph);
}
void loop() {
 // Just to show the program is alive...
 static int counter = 0;
 // Write a piece of text on the first line...
 lcd.setCursor(0, 0);
 lcd.print(" Hello, World!");
 // Write the counter on the second line...
 lcd.setCursor(0, 1);
 lcd.print(counter, DEC);
 lcd.write(' ');
 lcd.write(0); // write the smiley
Â
 lcd.setCursor(0, 2);
lcd.print("CONSOLE:");
 lcd.setCursor(0, 3);
 if( Serial.available())
 {
  char ch = Serial.read();
  if( ch == '\r') // is this the terminating carriage return
  {
buffer[ bufferIndex ] = 0; // terminate the string with a 0
  bufferIndex = 0; // reset the index ready for another string
  //lcd.print("        ");
  lcd.clearLine();
  lcd.print(buffer);
  }
  else
  buffer[ bufferIndex++ ] = ch; // add the character into the buffer Â
}
 Â
 Scroll("testing shiz",0,4);
 delay(500);Â
 counter++;
}
void boot()
{Â
// int addr=0x0040; //EEPROM Address 0
 int addr=0; //EEPROM Address 0
  delay(20); //add a small delay
delay(20); //add a small delay
//Serial.print((char)b); //print content to serial port
unsigned char bitmap_array[504];
for(int j = 0; j < 504; j++)
{
bitmap_array[j]=i2c_eeprom_read_byte(eeprom1,addr);
addr++;
}
lcd.setCursor(0, 0);
lcd.drawBitmap(bitmap_array, 84,38);
delay(3000);
lcd.clear();
delay(500);
}
void Scroll(String message,unsigned char xy,unsigned char yx)
{
 lcd.setCursor(xy, yx);
Â
 for (int i = scrollPosition; i < scrollPosition + 14; i++)
 {
  if ((i >= message.length()) || (i < 0))
  {
   lcd.print(' ');
  }
  else
  {
   lcd.print(message.charAt(i));
  }
 }
 scrollPosition++;
 if ((scrollPosition >= message.length()) && (scrollPosition > 0))
 {
  scrollPosition = -13;
 }
}
void i2c_eeprom_write_byte( int deviceaddress, unsigned int eeaddress, byte data ) {
int rdata = data;
Wire.beginTransmission(deviceaddress);
Wire.write((int)(eeaddress >> 8)); // MSB
Wire.write((int)(eeaddress & 0xFF)); // LSB
Wire.write(rdata);
Wire.endTransmission();
}
void i2c_eeprom_write_page( int deviceaddress, unsigned int eeaddresspage, byte* data, byte length ) {
Wire.beginTransmission(deviceaddress);
Wire.write((int)(eeaddresspage >> 8)); // MSB
Wire.write((int)(eeaddresspage & 0xFF)); // LSB
byte c;
for ( c = 0; c < length; c++)
Wire.write(data[c]);
Wire.endTransmission();
}
byte i2c_eeprom_read_byte( int deviceaddress, unsigned int eeaddress ) {
byte rdata = 0xFF;
Wire.beginTransmission(deviceaddress);
Wire.write((int)(eeaddress >> 8)); // MSB
Wire.write((int)(eeaddress & 0xFF)); // LSB
Wire.endTransmission();
Wire.requestFrom(deviceaddress,1);
if (Wire.available()) rdata = Wire.read();
return rdata;
}