 }
 
 uint32_t readmuti(byte regAddress){
-   byte temp_byte = 0;
+   uint32_t temp_byte = 0;
   uint32_t reg_value = 0;
-  
+ // Serial.println("Read_START");
   digitalWrite( afe.chipSelectPin, LOW);
   
   // set address

int32_t dataout[6] = {0};
#define ave 10
int value;

unsigned long data[6]={0};
int count = 0;

void setup() {
	Serial.begin(115200);
	afe.begin(10,3,4);   //SS,AFE_PWN,AFE_RST
        
        Serial.println(afe.diag(),BIN);  
        afe.setDefaultTiming();
        afe.setLEDCurrent(75, 75); 
        afe.setGain(0,0,0,0,0x02);
	// begin measuring

	afe.beginMeasure(false);
        Serial.println("==========REG_SRT========");
	dumpreg();
        Serial.println("==========REG_END========");
        attachInterrupt(0,readadc,RISING);
}


void loop() {

   if(count>=ave){
     detachInterrupt(0);

  // get first byte
  temp_byte = SPI.transfer(0x00);
  reg_value |= temp_byte << 16;
  //Serial.println(reg_value,BIN);
  // get second byte
  temp_byte = SPI.transfer(0x00);
  reg_value |= temp_byte << 8;
//Serial.println(reg_value,BIN);
  // get last byte
  temp_byte = SPI.transfer(0x00);
  reg_value |= temp_byte;
//Serial.println(reg_value,BIN);
  reg_value = (reg_value<<8)>>8;
  digitalWrite( afe.chipSelectPin, HIGH);
  return reg_value;
  
