         acc.init();
         accFlag=1;
       }
-      acc.getXYZ(&b[1],&b[2],&b[3]);
+      acc.getXYZ(&accv[0],&accv[1],&accv[2]);
+      b[1]=accv[0];
+      b[2]=accv[1];
+      b[3]=accv[2];
     }
+    //RTC tine read
+    if(cmd[0]=30)
+    {
+      if(clkFlag==0)
+      {
+        clock.begin();
+        //Set time the first time
+        //clock.fillByYMD(2013,1,19);
+        //clock.fillByHMS(15,28,30);//15:28 30"
+	//clock.fillDayOfWeek(SAT);//Saturday
+	//clock.setTime();//write time to the RTC chip
+        clkFlag=1;
+      }
+      clock.getTime();
+      b[1]=clock.hour;
+      b[2]=clock.minute;
+      b[3]=clock.second;
+      b[4]=clock.month;
+      b[5]=clock.dayOfMonth;
+      b[6]=clock.year;
+      b[7]=clock.dayOfMonth;
+      b[8]=clock.dayOfWeek;  
+    }
+    //
   }
 }
 

  }
  if(cmd[0]==20)
    Wire.write(b, 4);
}


int index=0;
int flag=0;
int i;
byte val=0,b[9];
int aRead=0;
byte accFlag=0,clkFlag=0;
int8_t accv[3];
void setup() {
    //pinMode(13, OUTPUT);
    //Serial.begin(9600);         // start serial for output
