void save_byte (int xaddr, unsigned char xchar) // this function works fine // this fuction writes xchar to eeprom at xaddr void save_integer(unsigned int xintnum) { unsigned int msblsb; unsigned char msb,lsb; msblsb = xintnum & 0xff00; msblsb = msblsb >> 8; msb = msblsb & 0x00ff; lsb = xintnum & 0x00ff; save_byte (0x0000,msb); save_byte (0x0001,msb); } // this function does not write to eeprom // i put the same way in reading integer number, but it does'nt work either. // please some one correct my code // thank you in advance // kurnia brahmana
save_byte (0x0000,msb); save_byte (0x0001,msb);
Sorry, it's just mistyped, it should written be save_byte(0x0000,msb); save_byte(0x0001,lsb); thank you
Does that fix it, then? If not, you need to provide more detail about exactly what happens. But do some debugging of your own first - do some tests & observations & see what you can deduce from the results... Have you tried it in the simulator?
A wild guess, try this
void save_integer(unsigned int xintnum) { unsigned int msblsb; unsigned char msb,lsb; msblsb = xintnum & 0xff00; msblsb = msblsb >> 8; msb = (unsigned char)msblsb & 0x00ff; lsb = (unsigned char)xintnum & 0x00ff; save_byte (0x0000,msb); delay 10ms implement this some way save_byte (0x0001,msb); }
just curious, why are you using this 25 year old chip? one more comment: using 82xx chips often require: a) that you use a 12 clocker b) that the clock is 8MHz or less Erik
Yes, Erik " just curious, why are you using this 25 year old chip?" Please suggest me for a replacement, I need eeprom in the chip in my application to same some values and parameters. Thank you very much. Kurnia Brahmana
Yes, Andy Neil, it fixes the problem, Any way, Erik says the chip may also too old, so some time may could'nt save any, So if what do you suggest for replacement, AVR chip perhaps? Thank you very much
Please suggest me for a replacement, I need eeprom in the chip in my application 24Cxx available in many brands e.g. Atmel AT24cxx (xx is a number that gives the size) othere possibilities are Ramtron, Microchip .... Erik