Arduino uno GLCD ile PROGMEM = {} kullanmak
  • Merhaba Arkadaşlar.
    Arduino uno GLCD çalışması yapıyordum, resim dosyasını bu şelikde derleyince yetersiz memory hatası verdi,(const int8_t spongeBob[]={})
    Formları araştırdım ve ( const uint8_t spongeBob[] PROGMEM = {} ) bu şekilde verince hata vermedi ve baya yer açıldı fakat PROGMEM den logo adreslerini çağırmayı yapamadım. Bu konuda yardımcı olabilir misiniz?
    Normalde logoyu aşağıdaki kod ile çağırıyorum.

    void loop()
    {
    LCD_Bitmap(0,0,128,64);
    }

    void LCD_Bitmap(int left, int top, int width, int height)
    {
    int i,j;
    char value;
    int adres;
    for(i=0;i<8;i++)<br /> {
    LCD_GoTo(0,0+i);
    for(j=0;j<128;j++)<br /> {
    adres = i*128+j;
    value = spongeBob[adres]; // Bu satırı nasıl düzelteceğimi bulamadım.
    LCD_WriteData(value);
    }
    }
    }

    const uint8_t spongeBob[] PROGMEM = {
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xC0,0x40,0xC0,0x40,0x40,0x40,0x40,0x40,0x40, 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xC0,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x80,0xC0,0x60,0x20,0x30,0x10,0x18,0x08,0x0C,0x04,0xE6,0xF2,0x33,0x31,0x18,0x98,0xF0,0x01,0x0F,0x08,0x10,0x10,0xF0,0x80,0x00,0x00, 0x04,0x1F,0x31,0x21,0x21,0x23,0x22,0x32,0x1E,0x8E,0xC0,0xE0,0x20,0x3C,0x18,0x08,0x08,0x08,0x08,0x08,0x0C,0x0C,0x84,0xC4,0xCC,0xC8, 0xCC,0xCC,0x9C,0x90,0x30,0x20,0x40,0x80,0x00,0xC0,0x60,0x34,0x9C,0x8C,0xC4,0xC4,0xC4,0xC4,0x8C,0x8C,0x04,0x0C,0x08,0x08,0x18,0x18, 0x0C,0x38,0x20,0xC0,0x00,0x00,0x7C,0xC4,0xC6,0x64,0x3C,0x00,0x1C,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xC0,0x40,0x60,0xA0,0xE0,0xA0,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 0x02,0x06,0x1C,0x38,0x30,0xE0,0xC0,0x80,0x07,0x1C,0x30,0x20,0x30,0x1F,0xE0,0xF8,0x1C,0x88,0xF8,0x50,0x03,0x0F,0x38,0xE0,0x80,0x00, 0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x13,0x0F,0x0C,0x08,0x18,0x10,0xD0,0x90,0x90,0x18,0x10,0x30,0x33,0x23,0x27,0x27,0x2F,0x3F,0x17, 0x17,0x13,0x13,0x18,0x0C,0x0F,0x00,0x07,0x0C,0x3B,0x37,0x77,0xDF,0x9F,0x9F,0x8F,0x8F,0x8F,0x03,0x00,0x80,0x80,0xC0,0x60,0x60,0x20, 0x20,0x3F,0x30,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x78, 0xCC,0x86,0x02,0x02,0x82,0x96,0xBB,0x8B,0x8D,0x96,0xDF,0x6D,0x29,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x01,0x07,0x02,0x0E,0x1C,0x70,0xE0,0x83,0x0E,0x0F,0x89,0xF0,0x90,0x88,0x8C,0x8B,0xF8,0x07,0x3C,0x60,0xC0, 0x0F,0x09,0xC8,0x6D,0x27,0x20,0x20,0x20,0xE0,0x00,0x00,0x3F,0x7F,0xFF,0xBF,0xBF,0x3F,0x3F,0x3E,0x3E,0x7E,0x7E,0x7E,0x7E,0x70,0x70, 0x70,0x70,0x70,0xF8,0xFE,0xFE,0xFE,0xFE,0x1A,0x00,0x00,0x00,0x01,0x01,0x03,0x01,0x03,0x01,0x01,0x00,0xC0,0x60,0x38,0x04,0x06,0x02, 0xE2,0x32,0x16,0x1C,0x18,0xC0,0x60,0x3F,0x20,0x20,0x20,0xE0,0x20,0x60,0x60,0x60,0xE0,0xA0,0xB0,0xB0,0x98,0xCE,0x67,0x63,0x39,0x0D, 0x04,0x07,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,0x00,0x08,0x1E,0x13,0x71,0xE1,0xA1,0x23,0xE2,0xE7,0x4F,0xF8,0xC9,0x81,0x80,0x80,0x80,0x80,0x83,0xFE,0xF0, 0xF1,0x13,0x16,0x14,0x14,0x16,0x13,0x13,0x10,0x10,0x10,0x10,0x12,0x11,0x11,0x11,0x11,0x99,0x99,0x99,0x91,0x91,0x91,0x91,0x91,0x71, 0x35,0x15,0x15,0x71,0xD0,0x90,0x90,0x90,0x98,0x98,0x90,0x90,0x10,0x10,0x10,0x90,0x90,0x90,0x91,0x91,0x99,0x89,0x89,0x89,0x09,0x08, 0xF8,0x18,0x0C,0x0F,0x0C,0x06,0x02,0x02,0x02,0x03,0x02,0x03,0x01,0x01,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x88,0x07,0x80,0x00,0xC3,0xC4,0x04,0x9C,0xEC,0x08,0x08,0x09,0x39,0x68,0x48,0x49,0x49,0xC8, 0x48,0x49,0xC9,0xC9,0xC9,0xC9,0xC9,0x49,0x69,0x29,0x18,0x08,0x08,0x08,0x08,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x0E,0x1E,0x18, 0x0E,0x0A,0xEB,0x09,0x09,0xE9,0x09,0x09,0x09,0x08,0x08,0x08,0x18,0x09,0x09,0x09,0x09,0x09,0x09,0x08,0x08,0x08,0x08,0x08,0x07,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,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,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xE0,0xFF,0xC0,0xC0, 0xFF,0xC0,0xC0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xE0,0xF0, 0xFF,0xE0,0xEE,0xE3,0xE0,0xC0,0xC0,0xC0,0xC0,0x40,0xC0,0xC0,0xC0,0xC0,0x80,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,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,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,0x03,0x03,0x03,0x03,0x03,0x03, 0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
    };
  • Flash'a yazılmış olan veriyi ram'den okur gibi okuyamazsın. pgm_read_byte() fonksiyonunu kullanmalısın.

    Şurayı inceyebilirsin.
    https://www.nongnu.org/avr-libc/user-manual/group__avr__pgmspace.html
  • Diğer türlü memory alanı yetmiyor.
    Aşağıdaki iki şekillerde denedim ama olmadı karışık şeyler çıkıyor

    value = pgm_read_byte(spongeBob[adres]);
    value = pgm_read_byte(adres);
  • Sorunu hallettim teşekkür ederim.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Login with Facebook
Açık kaynak kültürü gereği, çözdüğünüz problemlerin çözümlerini paylaşmayı lütfen unutmayın.