Please refer to the procedure below, taken from the flowchart on page 9 and 16 of the DS2502 datasheet:
1. Send the reset pulse and detect the presence pulse from DS2502.
2. Send SKIP ROM command or another ROM command.
3. Send the Write Memory command (0x0F).
4. Send the address of the memory to be written: low byte followed by high byte.
5. Send the single data byte to be written to the address.
6. The master reads CRC to verify whether or not the written data is correct. If it is not correct, return to step 1. The CRC is the 8-bit CRC of command, address, and data for the first pass and CRC of address and data for subsequent passes.
7. The master issues a programming pulse (12 volts on the 1-Wire bus for a minimum of 480us and maximum of 5000us) for the data to be written to the memory.
8. Change 1-Wire bus to 5V, and turn off the 12V pullup.
9. Send 8 read time slots to read the written data byte; data correctness should be verified. If incorrect, return to step 1.
10. If it is correct, go to step 5 to write to the next address. DS2502 will automatically increment its address counter to select the next byte in the 1024-bit EPROM data field if the programming was successful. Repeat step 5~10 as necessary.
1. Send the reset pulse and detect the presence pulse from DS2502.
2. Send SKIP ROM command or another ROM command.
3. Send the Write Memory command (0x0F).
4. Send the address of the memory to be written: low byte followed by high byte.
5. Send the single data byte to be written to the address.
6. The master reads CRC to verify whether or not the written data is correct. If it is not correct, return to step 1. The CRC is the 8-bit CRC of command, address, and data for the first pass and CRC of address and data for subsequent passes.
7. The master issues a programming pulse (12 volts on the 1-Wire bus for a minimum of 480us and maximum of 5000us) for the data to be written to the memory.
8. Change 1-Wire bus to 5V, and turn off the 12V pullup.
9. Send 8 read time slots to read the written data byte; data correctness should be verified. If incorrect, return to step 1.
10. If it is correct, go to step 5 to write to the next address. DS2502 will automatically increment its address counter to select the next byte in the 1024-bit EPROM data field if the programming was successful. Repeat step 5~10 as necessary.