yep thats the first thing i just did then no point writeing them pic's each time i load it takes a far bit of time lol so yea i just made one to load all my pics then one to just load them from eeprom . now i can save so much space im so happy lol working on that last night was a bad idea really needed the sleep , thanks for all your help its been great understanding these little chips abit better.
now i have to move on to color displays i have a few 6610 lcd's i think " there the 10 pinout jobs" going to be fun xD
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
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
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
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
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;
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
// 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
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
// 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
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 }
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 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
thank you very much for your help so far kind sir!
ive use the arduino as an isp a few times and it works well , the only thing i had issues with was the port speed in avrdude -P changes it i think i used 19200 or 38400 ,oh and you can change your programer setting to arduino as isp and just upload via the arduino ide for a atmega48 i used this in my boards.txt
// 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
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 }
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 }
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
um good question its just a simple two pin sensor , around where its solderd on theres some text on the silkscreen that reads "S14434" and on the other side it says "HW050530118" if that helps . havent played with the sensor as i've moved on to a nother board from a heli that has a nrf240l chip built in with a atmega88 so as you can guess im haveing more fun with that
i got a alcohol breath tester from work the other day and pulled it apart to find a atmega48v as the brains and also the isp header still at the bottom so i hooked it up , programed my arduino to be a isp then read the datesheet for the 48v afterward made this hack to the boards.text file
now when i pick my board and compile code its readdy for my atmega48 ,now once your arduino has the isp code on it your readdy to hook up to the isp pins on the qm7298 and then you just go to Tools->programmer->arduino as ISP.
now you can load up your code and compile to the 48v through the arduino ide .. eazy same goes for any atmel chips you can make them work with arduino ide with little fuss.
the only thing i did out of arduino ide is setting fuse bits with avrdude witch i had to change as it was running at 1mhz instedd of 8mhz but still ran without that change
***** other jaycar products with atmega chips in them
GT3340 -atmega88 - D/E
most likely 50% of the meters behind the counter would have atmel chips "sometimes i wish i was a buyer id even be able to do firmware support ie jaycar logos and understand how the products work"
will add more as i see them but i dont get to just rip apart thing so let me know if you know of more