GLCD with EEPROM 24LC512 interface with PIC Problem

Status
Not open for further replies.

Designer_Electronics

Newbie level 5
Joined
Sep 16, 2010
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,341
Dear sir,

Iam designing with MikroC Program a simple project, i want to write the image to eeprom, i do it successfully , then to load many images from eeprom 24lc512 to pic18f4620 then display it to the graphical lcd.

i display an image to GLCD successfully , but when i write the program to load from eeprom to display on GLCD , it gives me a warning of
"Implicit conversion of int to ptr glcd.c ".

Any advise ,


program
======
// Global Variables
unsigned char image1[1024];
unsigned char image2[1024];
unsigned char image3[1024];
unsigned char x;
unsigned int ii;

void main(){
// Configure AN pins as digital I/O
ADCON1 = 0x00;
// Disable comparators
// CMCON =0x07;
// Graphical LCD initialization
Glcd_Init(); // Initialize GLCD
Glcd_Fill(0x00); // Clear GLCD

I2C1_Init(100000); // initialize I2C communication

// Read Function
for(ii = 0; ii < 1024; ii++) { // Read 1024 bytes block from address 0x00
x = EEPROM_get(ii); // store image // my i2c function
image1[ii]=x;
Delay_ms(50);
}

while(1){
Glcd_Image(image1[1024]); // Draw image1
}

}
 

Hello!

Implicit conversion is when you use a pointer instead of something else.
But if you could point the line where it happens, it would be easier to debug.
I'm not going to read ad try to understand the whole code for an obvious error.

While saying this, I think that the line Glcd_Image(image1[1024]) is wrong.
Probably the prototype of your function is:
void Glcd_Image(uchar * data, uint16 length) or something like that.

What you are doing is that instead of passing a character array to the function, you
give it the 1024th character of the buffer image1, which by the way does not exist.
(image1 has 1024 characters, so the indexing starts at 0 and finishes at 1023, so
image1[1024] points to a memory space outside of your image, which can be anything.

By the way, why are you using an EEPROM? Do you change your images frequently?
If not, you may consider a serial flash which, for a similar price, has about 100 times
the capacity. I am using SPI flash of 128 Mbits (16 MBytes), which costs about 4~5 USD.
But there are smaller devices, for example Atmel AT45 series.

Dora.
 
Last edited:

Thanks for your reply,

it gives that warning to the line
Glcd_Image(image1[1024]);
as u expect,
but when i remove the length of image1, it gives me an error of :
Illegal pointer conversion eeprom_read.c at the same line


Glcd_Image() function description
===========================

Prototype void Glcd_Image(code const unsigned short *image);

Parameters :

image: image to be displayed. Bitmap array must be located in code memory.

Use the mikroC PRO for PIC integrated Glcd Bitmap Editor to convert image to a constant array suitable for displaying on Glcd.

Requires Glcd needs to be initialized,

Example // Draw image my_image on Glcd
Glcd_Image(my_image);


I guess the problem appears as i can't use a constant array to be displayed on GLCD , it can't located in program memory (if code = program memory);
but when i use a syntex of
unsigned char image1[1024];
i think it is located in data memory , so the problem appear..

i don't know if my analysis is true, or may i don't understand your message clearly ,

could you kindly advise me agian , how to fix this problem.

Thanks in advance.
 

Hello!

When you write:
void Glcd_Image(code const unsigned short *image);
what does "code" mean? (I don't know anything about mikro C, I just know C)

Now Let's suppose it was a typo and your prototype is void Glcd_Image(const unsigned short *image);

You have a function supposed to take a const unsigned short * and you feed it with an unsigned char.

Try to cast your buffer and I guess it will work better.

Dora.

PS: could you please try to write in plain english (I mean, "you" instead of "u", etc). And if
you begin sentences with a capital letter and end with a period, that would also be great.
 

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…