From 2ef68f1a1c43f9b1d0e851128ceaf1019bc6fe14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=20K=C3=A9vin?= Date: Sat, 2 Aug 2014 15:27:22 -0700 Subject: [PATCH] a time in clear_memory() for eeprom to writew --- pic/MDR/MDR.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pic/MDR/MDR.c b/pic/MDR/MDR.c index d362e2c..3124ec9 100644 --- a/pic/MDR/MDR.c +++ b/pic/MDR/MDR.c @@ -233,6 +233,7 @@ void save_code() void clear_memory(void) { uint16_t address; + uint16_t wait; /* go through memory */ for (address=0; address<0x7FFF; address++) { if ((address%0x40)==0) { /* select page */ @@ -253,6 +254,9 @@ void clear_memory(void) send_byte(0x00); /* clear byte */ if ((address%0x40)==0x3f) { /* end of page */ send_stop(); /* finish transaction */ + for (wait=0; wait<1024; wait++) { /* wait for eeprom to be writen */ + wait; + } } } }