marcellus26
Joined: 21 Jun 2006 Posts: 2
|
2404.c not working |
Posted: Wed Jun 21, 2006 9:15 pm |
|
|
Dear ALL,
I'm using the Atmel AT24c04 ( 5V ), attached to a 16f876a and the following code:
#include <16f876a.h>
#fuses HS,NOWDT,NOPROTECT,PUT, NOBROWNOUT, NOLVP
#use delay(clock=6000000)
#define EEPROM_SDA PIN_A4
#define EEPROM_SCL PIN_B0
#include "lcdd.c"
#include <2404.c>
#ZERO_RAM
void main(void){
int i;
set_tris_c(0x80);
lcd_init();
port_b_pullups(TRUE);
lcd_putc("\fTest...\n");
delay_ms(1000);
lcd_putc("\f");
init_ext_eeprom();
for (i = 0; i < 255; i++){
write_ext_eeprom(i, i);
printf(lcd_putc,"\f%x -> %x",i, read_ext_eeprom(i));
delay_ms(500);
}
while(1){};
}
The lcd shows the address and the data, as following:
00 -> 00
01 -> 01
02 -> 02 and so on.
But, when i reaches 0x0e, the lcd shows:
0e -> ff
0f -> ff
10 -> 10
:O
Any ideas? |
|