After a full page is written, you need to end the bus, restart the bus, write SLA, write Suba on the next page, and write data ....
A delay must be added between the end bus and the start bus. It takes a long time !!
Extern unsigned char enumer; bit isendstr (unsigned char SLA, unsigned int Suba, unsigned char * s, unsigned char no) {unsigned char I; unsigned int K; // start_i2c (); /* Start bus */sendbyte (SLA);/* Send device address */If (ACK = 0) Return (0 ); //////////////////////////////////////// /// if (AT24C256 = AT24C256) {sendbyte (unsigned char) (Suba> 8); // convert integer data to bytes-type data: discard height to low, take only eight digits below.
// If the capacity is greater than 32 K bits, use 16-bit address addressing, write the high eight-bit address if (ACK = 0) Return (0);} sendbyte (unsigned char) suba);/* Send device sub-address */If (ACK = 0) Return (0); for (I = 0; I <no; I ++) **************** * ******** // If (Suba % 64 = 0) {stop_i2c (); For (k = 0; k <10000; k ++); start_i2c ();/* Start bus */sendbyte (SLA ); /* Send device address */If (ACK = 0) Return (0); // If (AT24C256 = AT24C256) {sendbyte (unsigned char) (Suba> 8); // converts integer data to bytes-type data: discard the height to a lower value, and only take the lower 8 bits.
// If the capacity is greater than 32 K bits, use 16-bit address addressing, write the high eight-bit address if (ACK = 0) Return (0);} sendbyte (unsigned char) suba);/* Send device sub-address */If (ACK = 0) Return (0);} Suba ++; *************** * ************ // * send data */sendbyte (* s ++ ); if (ACK = 1) continue; // return (0 ); /// // senddd ('x '); // This Is Not found. · // return (0); //} stop_i2c ();/* End bus */Return (1 );}