We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
About that 24LC16B, I have contacted with MicroChip technical staff. my code: for(;;) { START_MEMO(); SHIFT_MEMO( 0xa0 ); SCL_MEMO = 0; MEMO_WAIT; SDA_MEMO = 1; SCL_MEMO = 1; MEMO_WAIT; if ( (~SDA_MEMO) ){ SCL_MEMO = 0; STOP_MEMO(); break; } } return(1); } their answer is the following :" Eric, Something that concerns me with your code is the fact that you are driving the clock and data lines with the master. Instead, you should set the clock and data output registers to 0, then drive the tristate (TRIS) registers. In this way, your master will drive the bus to ground, and pull-up resistors will pull the clock and data line high. This also allows the slave to respond with an appropriate acknowledge bit. If the bus is being driven high by the master, then the slave may not be able to over-drive the master to ground. Give this a shot, and if you have more questions, please feel free to post them. By the way, a good starting point for pull-up resistors is around 2.7k-ohms. " But I really do not know how to realize their way in 8051. Please let me know? Best Regards.
This also allows the slave to respond with an appropriate acknowledge bit. If the bus is being driven high by the master, then the slave may not be able to over-drive the master to ground. This is an essential part of the IIC standard (can be found at the Philips website). I have seen, I do not know how many, IIC implementations that did not take into account things like the ability of the slave to stretch a pulse (by holding the line low). The Philips website has a plethora of IIC code and since Philips is the owner of the standard, why not refer there. Get the standared and have at least a glance. Erik