Pages: [1] 2   Go Down
Author Topic: 24LC256 bitmap storage for 33310 lcd | Solved.  (Read 1330 times)
0 Members and 1 Guest are viewing this topic.
AUS,Downunder
Offline Offline
Jr. Member
**
Karma: 0
Posts: 53
Arduino rocks!!!:)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hey there i seen a video from a few years back about pulling a bitmap from a 24lc256 eeprom to a 3310 lcd ,& im trying todo the same, i have my 24lc256 hooked up and i can write bytes and pages "i am alittle new to this" but when i try to put my image on the eeprom im not sure how to go about it. i tryed just putting 16 bytes of the image and try reading it back with this
Code:
"byte b = i2c_eeprom_read_byte(eeprom1, addr);
while (b!=0) {
lcd.drawBitmap(b, 84, 38);
addr++; //increase address
b = i2c_eeprom_read_byte(eeprom1, addr);
}

but it complanes about converting a byte into a char* :s
i not great with c codeing so any help would be great smiley

thanks for reading
« Last Edit: April 27, 2012, 10:09:53 pm by rotceh_dnih » Logged

Cod modder/mapper

West Des Moines, Iowa USA
Offline Offline
Sr. Member
****
Karma: 2
Posts: 428
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't see anything in your code that looks as if it might move anything to the EEPROM.

I'm not familiar with the device, but I'd be inclined to rummage around for something with a name like i2c_eeprom_write_byte()...
Logged

There's always a better way!

Offline Offline
Jr. Member
**
Karma: 0
Posts: 57
Nokia 6100 LCD Library
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Why not post your full code  vs. a snippet?

and which 3310 library are you using ? there are several.... and i don't think any of them are included with the Arduino standard distribution
Logged

Ardgrafix6100 - A fast, full-featured Arduino graphics driver for Nokia 6100 LCDs http://code.google.com/p/ardgrafix6100/

AUS,Downunder
Offline Offline
Jr. Member
**
Karma: 0
Posts: 53
Arduino rocks!!!:)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ar true soz guys the lib im useing is called PCD8544 so not much help there lol i'll post the bitmap function

full code
Code:
#include <Wire.h>
#include <PCD8544.h>
#include "logos.h"  //boot time logos
#include <string.h>         //Used for string manipulations
#define eeprom1 0x50
#define STRLEN 16

static const byte me2[] = {
0xC2, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80};

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() {
 
  // PCD8544-compatible displays may have a different resolution...
  lcd.begin(84, 48);
  Wire.begin();
  Serial.begin(9600);
  i2c_eeprom_write_page(eeprom1, 0x0040, (byte*)me, sizeof(me)); // write to EEPROM
delay(10); //add a small delay
  boot();
  delay(500);
 
  // 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
    delay(20); //add a small delay
byte b = i2c_eeprom_read_byte(eeprom1, addr); // access the first address from the memory
lcd.setCursor(0, 0);
delay(20); //add a small delay
while (b!=0) {
//Serial.print((char)b); //print content to serial port

lcd.drawBitmap(b, 84, 38);
addr++; //increase address
b = i2c_eeprom_read_byte(eeprom1, addr); //access an address from the memory
}


delay(3000);
 
 
 
  lcd.drawBitmap(me, 84, 38);
  delay(3000);
  lcd.drawBitmap(JaycarLogo, 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;
}

drawbitmap
Code:
void PCD8544::drawBitmap(const unsigned char *data, unsigned char columns, unsigned char lines)
{
    unsigned char scolumn = this->column;
    unsigned char sline = this->line;

    // The bitmap will be clipped at the right/bottom edge of the display...
    unsigned char mx = (scolumn + columns > this->width) ? (this->width - scolumn) : columns;
    unsigned char my = (sline + lines > this->height/8) ? (this->height/8 - sline) : lines;

    for (unsigned char y = 0; y < my; y++) {
        this->setCursor(scolumn, sline + y);

        for (unsigned char x = 0; x < mx; x++) {
            this->send(PCD8544_DATA, data[y * columns + x]);
        }
    }

    // Leave the cursor in a consistent position...
    this->setCursor(scolumn + columns, sline);
}

the full image would look like this
Code:
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,
};
Logged

Cod modder/mapper

Offline Offline
Jr. Member
**
Karma: 0
Posts: 57
Nokia 6100 LCD Library
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Okay... so you're using the library created by Carlos Rodrigues.

The issue you're facing is coming because the draw bitmap function is looking for an unsigned char array containing the bitmap. What you're doing in your code is reading & sending single bytes. So what you want to do is read the full bitmap into an array and then pass the array to the draw bitmap function. Since this is a 3310 LCD, memory shouldn't be a memory probelm since 84*38 bitmap with 1 bit per pixel is 84*38/8=399 bytes.

You can try something along these lines of logic...

Code:

unsigned char bitmap_array[399];

for(int j = 0; j < 399; j++)
{
bitmap_array[j]=i2c_eeprom_read_byte(eeprom1,addr);
addr++;
}

lcd.drawBitmap(bitmap_array, 84,38);

Logged

Ardgrafix6100 - A fast, full-featured Arduino graphics driver for Nokia 6100 LCDs http://code.google.com/p/ardgrafix6100/

AUS,Downunder
Offline Offline
Jr. Member
**
Karma: 0
Posts: 53
Arduino rocks!!!:)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

smiley thanks man thats what im looking for i think .
one question ithis line here
Code:
for(int j = 0; j < 399; j++)
going to read from address 0 through to address 399?

and as im writing this i just tested it and i think it worked smiley but what do you think would be the best way to write the whole image to the eeprom as atm im only writing 16 bytes of it and i think wire can only handle 32 and my eeprom is 64 per page :s its all rather confuseing for me atm lol but i'll get there.

so i guess my question how to write a 488 byte array to my eeprom ? im guessing i could then store about 65 images to one eeprom smiley

thank you very much for your help so far kind sir!
« Last Edit: April 25, 2012, 03:27:27 am by rotceh_dnih » Logged

Cod modder/mapper

AUS,Downunder
Offline Offline
Jr. Member
**
Karma: 0
Posts: 53
Arduino rocks!!!:)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

update

Video of how the image from eeprom looks
http://www.youtube.com/watch?v=ufpCZ6smzXw&feature=youtu.be

i tried to write the whole image but it failed so theres the 16 bytes as the first image the other two come from flash

heres the code as it is now
Code:
/*
 * 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 "logos.h"  //boot time logos
#include <string.h>         //Used for string manipulations
#define eeprom1 0x50
#define STRLEN 16

static const byte me2[] = {
0xC2, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80};

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() {
 
  // PCD8544-compatible displays may have a different resolution...
  lcd.begin(84, 48);
  Wire.begin();
  Serial.begin(9600);
  i2c_eeprom_write_page(eeprom1, 0x0040, (byte*)me2, sizeof(me2)); // write to EEPROM
delay(10); //add a small delay
  boot();
  delay(500);
  // 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
    delay(20); //add a small delay

lcd.setCursor(0, 0);
delay(20); //add a small delay

//Serial.print((char)b); //print content to serial port

unsigned char bitmap_array[16];

for(int j = 0; j < 16; j++)
{
bitmap_array[j]=i2c_eeprom_read_byte(eeprom1,addr);
addr++;
}

lcd.drawBitmap(bitmap_array, 54,28);


delay(3000);
lcd.clear();
  lcd.drawBitmap(me, 84, 38);
  delay(3000);
  lcd.clear();
  lcd.drawBitmap(JaycarLogo, 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;
}


but i need this in the eeprom
Code:

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,
};

Logged

Cod modder/mapper

AUS,Downunder
Offline Offline
Jr. Member
**
Karma: 0
Posts: 53
Arduino rocks!!!:)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

tried to wirite byte instedd of page but its not looking right "will post pics tommoro"

this time i tried the whole 488 or 489 byte that are in the bitmap but im to neeb to know what im doing  smiley-red

here's my code again
Code:
#include <Wire.h>
#include <PCD8544.h>
#include "logos.h"  //boot time logos
#include <string.h>         //Used for string manipulations
#define eeprom1 0x50
#define STRLEN 16

//static const byte me2[] = {
0xC2, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80};

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() {
 
  // PCD8544-compatible displays may have a different resolution...
  lcd.begin(84, 48);
  Wire.begin();
  Serial.begin(9600);
 
  for (int i=0; i < 489; i++){
    i2c_eeprom_write_byte(eeprom1,i,me[489]);
  }
  //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[489];

for(int j = 0; j < 489; 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();
  lcd.drawBitmap(me, 84, 38);
  delay(3000);
  lcd.clear();
  lcd.drawBitmap(JaycarLogo, 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;
}


Logged

Cod modder/mapper

Offline Offline
Jr. Member
**
Karma: 0
Posts: 57
Nokia 6100 LCD Library
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The error now seems to be in your bitmap write code... you're writing the last + 1 byte past the array over & over again to the eeprom in your for loop.
Code:
 for (int i=0; i < 489; i++){
    i2c_eeprom_write_byte(eeprom1,i,me[489]);
  }

Try something like this below (and possibly consider brushing up on for & while loops in C language from web tutorials)
Code:
int me_bitmap_start_address = 0;     //change this to wherever you want to store your bitmap on eeprom & keep track
int me_bitmap_length = 489;            //so that multiple bitmaps don't overlap

for(int j=0; j < me_bitmap_length; j++)
    i2c_eeprom_write_byte(eeprom1,(me_bitmap_start_address + j),me[j]);

i've added the me_bitmap_start_address bit just to emphasize that the location on eeprom that you store your bitmap in can start wherever in the address space (possibly not in the last few 489 bytes smiley) - the eeprom address & the array subscript are different things
« Last Edit: April 25, 2012, 11:13:31 am by srinathdevelopment » Logged

Ardgrafix6100 - A fast, full-featured Arduino graphics driver for Nokia 6100 LCDs http://code.google.com/p/ardgrafix6100/

AUS,Downunder
Offline Offline
Jr. Member
**
Karma: 0
Posts: 53
Arduino rocks!!!:)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks mate , that makes scence however ever it still behaves the same :/

here is code

Code:
#include <Wire.h>
#include <PCD8544.h>
#include "logos.h"  //boot time logos
#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 = 489;            //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]);
}
  //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[489];


for(int j = 0; j < 489; 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();
  lcd.drawBitmap(me, 84, 38);
  delay(3000);
  lcd.clear();
  lcd.drawBitmap(JaycarLogo, 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;
}


and a pic of what it looks like reading from eeprom



it looks like its shifted a small amount of the data over and over again :s
Logged

Cod modder/mapper

AUS,Downunder
Offline Offline
Jr. Member
**
Karma: 0
Posts: 53
Arduino rocks!!!:)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Bump , anyone know whats going on here , im willing to try anything smiley
Logged

Cod modder/mapper

Offline Offline
Jr. Member
**
Karma: 0
Posts: 57
Nokia 6100 LCD Library
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

2 suggestions -

1. Firstly, your bitmap_array "me" is 504 bytes = 84 px * 48 px /8 pixels per byte. All your logic in the boot() function is running at 84*38 and BTW - 84*38/8 is NOT even equal to 489 bytes which is the array you are reading in. You need to go through ur program carefully & clean up the logic consistency.

2. If the above doesn't sort out your issue - simplify the debugging  issue into a sketch that does only reading & writing of a long string to & from the eeprom & see if that works properly. You can output the read with serial & read it on your comp & see how the reading & writing is behaving. Once you've cleaned up the logic of writing & reading  a long string from eeprom, you've got a debugged approach to plug  back in here.
Logged

Ardgrafix6100 - A fast, full-featured Arduino graphics driver for Nokia 6100 LCDs http://code.google.com/p/ardgrafix6100/

AUS,Downunder
Offline Offline
Jr. Member
**
Karma: 0
Posts: 53
Arduino rocks!!!:)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

smiley thanks man i've found a issue i made a simple read wirght code and just sent the first 16 again for testing and found its gets converted somehow not sure whats going on there

heres the output

Code:
me2 from array
C2
41
0
0
0
0
0
0
0
0
0
0
0
0
0
80
 
me2 from eeprom
C2
65
63
74
6F
72
20
69
73
20
74
68
65
20
62
65

heres the code

Code:
#include <Wire.h> //Include the Arduino I2C Library</pre>
#include <string.h>         //Used for string manipulations

#define eeprom1 0x50
#define eeprom2 0x51

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,
};

static const byte me2[] = {
  0xC2, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80
};



void setup() {

Wire.begin(); //Start I2C connections
Serial.begin(9600);
 
int me_bitmap_start_address = 0;     //change this to wherever you want to store your bitmap on eeprom & keep track
int me_bitmap_length = 16;            //so that multiple bitmaps don't overla   

for(int j=0; j < me_bitmap_length; j++)

{

    i2c_eeprom_write_byte(eeprom1,(me_bitmap_start_address + j),me2[j]);
   
}

delay(2000);

Serial.println("Memory written");
}

void loop() {
 
int addr=0; //EEPROM Address 0
delay(20); //add a small delay
//Serial.print((char)b); //print content to serial port
Serial.println("me2 from eeprom");
unsigned char bitmap_array[16];
for(int h = 0; h < 16; h++)
{
bitmap_array[h]=i2c_eeprom_read_byte(eeprom1,addr);
    Serial.println(bitmap_array[h],HEX);
addr++;
         
}


delay(10000);
Serial.println("me2 from array");
for(int p = 0; p < 16; p++)
{
 Serial.println(me2[p],HEX);
}

Serial.println(" ");
delay(10000);

}


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;
}

thanks again for helping me with this its driveing me nuts
anyways must sleep it 2:30am atm xD
Logged

Cod modder/mapper

AUS,Downunder
Offline Offline
Jr. Member
**
Karma: 0
Posts: 53
Arduino rocks!!!:)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Solved smiley

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

Code:
/*
 * 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;
}




Logged

Cod modder/mapper

Offline Offline
Jr. Member
**
Karma: 0
Posts: 57
Nokia 6100 LCD Library
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

ah yup - the write delay.... nothing like a bright new day to surface issues :-)

btw - given this is now working. You can consider splitting your sketch into two  different sketches. A one  time sketch that dumps your bitmaps into the eeprom and another regular sketch that  shows your images in sequence on the lcd .
Logged

Ardgrafix6100 - A fast, full-featured Arduino graphics driver for Nokia 6100 LCDs http://code.google.com/p/ardgrafix6100/

Pages: [1] 2   Go Up
Jump to: