Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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
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: 64

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
 

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

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top