Hi, look at the comment inserted below. I hope it will help you. Imre On Thu, 24 Jun 1999, Simon Redwood wrote: > Pleeease HELP ! > > I am unable to read the information in an 24C02 eeprom, I can successfully > write to any address, but all reads return a 'FF', irrelevant of the > information held in them, which I know to be valid data. > > How can I set the port up to read instead of write on the data lines esp. > DATA_0(pin 2) > > > Regards, > Simon > > unsigned char in_byte(void) > /* fetch byte, most significant bit first */ > { > unsigned char i_byte=0x00; > int n; > > SetPortReadmode(); <------------ set bit 5 of control > port to 1 > high_SDA(); > > for (n=0; n<8; n++) { > high_SCL(); // changing the following line > i_byte=(i_byte << 1) | (inportb(DATA) & 0x01); // actually, you should (and want) to read a single bit instead of // the whole port... > low_SCL(); > } > > SetPortWritemode(); <------------ set bit 5 of control > port to 0 > > return(i_byte); > } > >