     if(i%15==0) Serial.println();
    
  }
-/**
- for(int i=0;i<256;i++) {
- write2RAM(0,i);
- Serial.println(readRAM(0),HEX);
- }
- **/
+
  Serial.println("done");
- 
+
+ //just stop here 
  while(1) {};
 }
-
-
 
 
 void loop() {
   
 }
 
+/**
+ * write one byte to a specific address of the SRAM
+ * @param address - unsigned integer with address 0x0000 - 0xffff 
+ * @param data    - byte that should be written
+ **/
 void write2RAM(unsigned int address, byte data) {
+  //take care that the shift register output is enabled (low active)
   digitalWrite(OEDATA,LOW);
+
+  //set SRAM to READ mode
   digitalWrite(WR,HIGH);
+
+  //set address and data to the address- and data-bus of the SRAM
   shiftout(address,data);
+
+  //generate write pulse
   digitalWrite(WR,LOW);
-  //delay(5);
   digitalWrite(WR,HIGH);
  
 }
 
+/**
+ * read one byte from a specific address
+ * @param address - unsigned integer with address 0x0000 - 0xffff
+ * @return byte   - data read from SRAM
+ **/
 byte readRAM(unsigned int address) {
+  //take care that the shift register output is enabled (low active)
   digitalWrite(OEDATA,LOW);
+
+  //set SRAM to READ mode
   digitalWrite(WR,HIGH);
+
+  //set address-bus, data-bus is not needed but 8 bits need to b shifted out
   shiftout(address,0);
+
+  //disable output of shiftregister for data-bus, so the SARM can drive the databus
   digitalWrite(OEDATA,HIGH);
+  
   delay(1);
- return ((digitalRead(13) << 7) +
+
+  //read all 8 data bits and return the complete byte
+  return ((digitalRead(13) << 7) +
       (digitalRead(12) << 6) +
       (digitalRead(11) << 5) +
       (digitalRead(10) << 4) +

 Serial.begin(9600);
 delay(100);
 

 Serial.println("writing data");
 for (int i=0;i<=255;i++) {

       digitalRead(6));
}

/**
 * wrapper function to shift out a 16 bit address and 8 bit data
 * @param address - unsigned integer with address 0x0000 - 0xffff
 * @param data    - one byte for data-bus
 **/
void shiftout(unsigned int address, byte data) {
  
  //split address to high- and low-byte
  byte lowbyte = address & 0xff;
  byte highbyte = address >> 8;
  
  //shift out all 3 bytes in the right order
  digitalWrite(LATCH,LOW);
  shiftOut(DATA,CLOCK,MSBFIRST,highbyte);
  shiftOut(DATA,CLOCK,MSBFIRST,lowbyte);
  shiftOut(DATA,CLOCK,MSBFIRST,data);
  //latch out the data
  digitalWrite(LATCH,HIGH);
  delay(10);
  digitalWrite(LATCH,LOW);
