Please help with strange Error in 128x64 GLCD

Status
Not open for further replies.

aakashjsr

Newbie level 3
Joined
Apr 16, 2014
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
38
Hi,
I have interfaced 128x84 GLCD with Atmega16 and written a function that displays an image on the glcd.Basically the image is defined by an array of size 1024(128x64) which has pixel wise definition for an image. This function is working perfectly fine for one image but when I try to display 2 images one after other with a delay , the second image is completely distorted . Consider that image 1 is defined in pic1.c and image 2 is defined in pic2.c

if I import pic1.c before pic2.c then image 1 is good and image 2 is distorted and if I import pic2.c before pic1.c then image 2 is good and image 1 is distorted. I mean for
#include "pic1.c"
#include "pic2.c"
..
show_img() -----> pic1 is working but not pic2

where as for

#include "pic2.c"
#include "pic1.c"
..
show_img() -----> pic2 is working but not pic1
 

Attachments

  • attach.zip
    1.6 KB · Views: 72

hello,


Check if you have enough RAM memory to store both Pictures..
and also if the start adresse of second image don't overwrite a part of first picture..
 

hello,


Check if you have enough RAM memory to store both Pictures..
and also if the start adresse of second image don't overwrite a part of first picture..


Hi,
I have yet not done hardware implementation , I am testing this on Proteus . also I tried to clear the screen before displaying the 2nd image but its still not working...
 

which compiler are you using?

I think older compilers like the one in WINAVR, requires some mumbojumbo to have data arrays exclusively in the FLASH MEMORY...

please read this document: https://www.nongnu.org/avr-libc/user-manual/pgmspace.html

in simple words, replace your definition for pic1 and pic2 like:

Code:
static const unsigned char pic1[1024] = {

to

Code:
#include <avr/pgmspace.h>
const unsigned char PROGMEM pic1[1024]  = {

and in your show_ing function...
change the access line
Code:
value(pic1[(i*128)+j]);

to

Code:
value(pgm_read_byte(&pic1[(i*128)+j]));

(the same for pic2)

test and tell us the result
 



Really Really a big Thanks to you...Its now working
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…