Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/12/10 15:49
Read: times


 
#174999 - Still no luck
Responding to: ???'s previous message
Maarten Brock said:
Yaniv K. said:
Yeah, didnt really understand that one. you mean the pointer that saves the address should be an integer? if so then already tried:

char EEPROM_Read(unsigned int *address)
 


Yes, this fragment shows you didn't understand it:

char EEPROM_Read(unsigned int *address)
{
    unsigned char eeprom_data='5';
    ...
    eeprom_data=*address;  //write to eeprom_data the value stored at the needed memory

 

The value at address is an unsigned int and you copy it to unsigned char eeprom_data.
The EEPROM_Write function suffers the same issue.


ok, tried it... but unfortunately it still didnt work... also are you sure its suppose to be char? I need to address addresses that are bigger then the char limit.

David Prentice said:
I gave you functions with APIs:

void wreeprom(unsigned char xdata *ads, unsigned char c);

unsigned char rdeeprom(unsigned char xdata *ads);

    ...
    char result, i, *p;
    ...
    for (i = 0, p = "David"; *p != 0; p++, i++)
        wreeprom(&user_name[i], *p);

    result = rdeeprom(&user_name[0]);  // should be 'D'    
    result = rdeeprom(&user_name[1]);  // should be 'a'
    result = rdeeprom(&user_name[1]);  // should be 'v'
    result = rdeeprom(&user_name[1]);  // should be 'i'

 


ok, I did exactly the same but it didnt work :( still getting the black boxes on LCD when I read the value. heres the code:


void EEPROM_Write(unsigned char xdata *address, unsigned char eeprom_data)
{
eeprom_data=eeprom_data|0x100;
EECON=0x02;	//Enable EEPROM
*address=eeprom_data;	//Latch the data
EECON=0x52;	//Programming
EECON=0xA2;	//Sequence
Delay(5);		//Delay to give the EEBUSY time to rise
while(((EECON&0x01)==0x01));		//Wait till EEBUSY is off
EECON=0x00;				 
}

unsigned char EEPROM_Read(unsigned char xdata *address)
{
unsigned char eeprom_data='5';
EECON=0x02;	//Access EPROM
AUXR=0x2C;	//Extend the Read cycles to accomidate for slow memory
eeprom_data=*address;
EECON=0x00;	//Allow usage of EPROM
AUXR=0x0C;	//Restore normal R/W Cycles
return(eeprom_data);						  
}
...
unsigned char *p,a,b,namestring[]={'Y','a','n','i','v',' ','K','f','i','r',0,' ',' ',' ',' ',' '};			//global
...
for(a=0, p="Yaniv";*p !=0;p++,a++)
		EEPROM_Write(&user_name[a],*p);
...
for(a=0;a<16;a++)
	{
		b=EEPROM_Read(&user_level);
		{
		lcd_command=0xc0+a;
		Delay(200);
		lcd_data=b;
		}

 


David Prentice said:

well, I honestly dont care how to address it, my only concern at the moment is getting it working as fast as possible.

Well if that is your attitude, are you surprised if nothing works?

David.


yeah... thats the attitude of someone in dire need to get things done by Wednesday, and has been trying to understand this EEPROM for the last week...

I neither have the strength, or the time left to be picky.

sorry to disappoint.

List of 23 messages in thread
TopicAuthorDate
EEPROM Read/Write Issues            01/01/70 00:00      
   if it was an external EEPROM            01/01/70 00:00      
   if it was an external EEPROM            01/01/70 00:00      
   Special sequence.            01/01/70 00:00      
      Thanks, but can you please simplyfy it?            01/01/70 00:00      
         Hope this explains            01/01/70 00:00      
   Managed to fix lockups, but it doesnt read/write            01/01/70 00:00      
      You have to choose your API            01/01/70 00:00      
         Already did all that            01/01/70 00:00      
            char vs int            01/01/70 00:00      
            I gave you a function            01/01/70 00:00      
               Still no luck            01/01/70 00:00      
                  unsigned int is not the size of the unsigned int* pointer            01/01/70 00:00      
                  Why not use the function I gave you.            01/01/70 00:00      
                     I did use you function            01/01/70 00:00      
                        My apologies.            01/01/70 00:00      
                           Sorry to keep dragging you back here...            01/01/70 00:00      
                              FLIP is a pain            01/01/70 00:00      
                                 We have progress!            01/01/70 00:00      
                                    Terribly sorry to bump but I really need help            01/01/70 00:00      
                                       Found the solution!            01/01/70 00:00      
                                          Study your C textbooks            01/01/70 00:00      
                                          it cant distinguise the sign bit            01/01/70 00:00      

Back to Subject List