Q: send code to and receive from amp AD8555 chip

Hello everyone,
I am a very beginner with arduino. I am trying to use boarduino to program a chip which is a programmable amplifier AD8555. I send code to its Simulation Mode to tell it about the value of Second Stage Gain, First Stage Gain and Offset Voltage I want, all of these values have been translated to Bin code . Then I want to read pulses from its Read Mode to check whether it is the value that I had sent.
Although through the voltage meter’s value, I know the chip AD8555 is working, but when I sent code to it, and want to receive some pulses from it, it seems always LOW voltage (or no pulses) was sent to my arduino. Don’t know why and want to cry. LOL
The code that I block is about trying to read the pulses and then store their duration, then to check whether it’s and Bin 0 or Bin 1. Because the chip AD8555 use different pulse width to differ Bin 0 and Bin 1.
By the way, the chip seems like an one-wire chip, I don’t know how to program with it.
Hope you can help me, sincerely. And thank you very much.

Here is a link to AD8555 datasheet :
http://www.analog.com/en/amplifiers-and-comparators/instrumentation-amplifiers/AD8555/products/product.html

And here is my code:

int chipPinIn = 3;
int chipPinOut = 4; 

float duration=0;
float array[9];
int i=0;
//int j=0;
unsigned long code;
int numofBits;
uint8_t a;


void setup()
{
  pinMode(chipPinIn, OUTPUT);
  pinMode(chipPinOut, INPUT);
  Serial.begin(9600);
}

void onepulse()
{
  //digitalWrite(chipPinIn,HIGH);  //set high voltage
  PORTD |= _BV(3);
  delayMicroseconds(56);  //use 50us to send the byte of 1,that is tw1
  //digitalWrite(chipPinIn,LOW);  //set low voltage
  PORTD &= ~(_BV(3));
  delayMicroseconds(12);  //there is a 10us in the interval of sending each bit, that is tws

}

void zeropulse()
{
  //digitalWrite(chipPinIn,HIGH);  //set pin on
  PORTD |= _BV(3);
  delayMicroseconds(4);  //use 10us to send the byte of 0,that is tw0
  //digitalWrite(chipPinIn,LOW);  //set pin off
  PORTD &= ~(_BV(3));
  delayMicroseconds(12);  //tws interval
}

void sendcode(unsigned long code, int numofBits)  //because the code could be as long as 12bits, so use unsigned long type to define the code, and numofBits is the number of bits in the code
{
      
  for(int i = numofBits - 1; i >= 0; i--)
  {
    if(code & (1 << i))
    {
      onepulse();
    }
    else
    {
      zeropulse();
    }
  }
}


void writeValueTo()
{
  delay(5000);
  /*set second stage gain code,3 LSBs*/
  sendcode(0B100000000001,12);
  sendcode(0B01,2);
  sendcode(0B00,2);  //2nd stage gain code 00
  sendcode(0B10,2);  //Dummy code 10
  sendcode(0B00000110,8);
  sendcode(0B011111111110,12);
  
  delay(200);  //need to check how long time should wait before sending out second part of the code?????????????????

  
  /*set first stage gain code, 7 LSBs*/  
  sendcode(0B100000000001,12);
  sendcode(0B01,2);
  sendcode(0B01,2);  //1st stage gain code 01
  sendcode(0B10,2);  //Dummy code 10
  sendcode(0B01101001,8);
  sendcode(0B011111111110,12);
  
  delay(200);  //need to check how long time should wait before sending out second part of the code

  /*set output offset code, 8 LSBs*/
  sendcode(0B100000000001,12);
  sendcode(0B01,2);
  sendcode(0B10,2);  //output offset code 10
  sendcode(0B10,2);  //Dummy code 10
  sendcode(0B01010101,8);
  sendcode(0B011111111110,12);
  
  delay(200);  //need to check how long time should wait before sending out second part of the code
}

void readModeInfo()
{
  delay(3000);
  /*set to read mode and read the second stage gain from AD8555 */
  sendcode(0B100000000001,12);
  sendcode(0B11,2);
  sendcode(0B00,2);  //second stage gain code 00
  sendcode(0B10,2);  //Dummy code 10
  sendcode(0B00000000,8);
  sendcode(0B011111111110,12);

}

/*
void readcode()
{
  
//  for(j=0;j<8;j++)
//  {
    
    duration = pulseIn(chipPinOut,HIGH);
//    while(digitalRead(chipPinOut)==LOW)
//    {
    array[j]=duration;
    i++;
    duration=0;
//    }
  
//  }

}
*/

void loop()
{

  writeValueTo();
  Serial.println("writing value");
  readModeInfo();
  Serial.println("writing read mode");
//  readcode();  
//  Serial.println("writing code");

/*
  while(digitalRead(chipPinOut)==LOW)
  {
  //  duration = pulseIn(chipPinOut,HIGH);
    Serial.println("0");
  //  a=digitalRead(chipPinOut);
  } 
*/
  /*while(digitalRead(chipPinOut)==HIGH)
  {
    duration = pulseIn(chipPinOut,HIGH);
    Serial.println("1");
  }*/
  for(int i = 0; i < 8; i++)
  {
    digitalWrite(chipPinIn, HIGH);
    Serial.print(digitalRead(chipPinOut));
    digitalWrite(chipPinIn, LOW);
  }
  Serial.println("");
  /*
  for(j=0;j<8;j++)
  {
  Serial.println("array[");
  Serial.print(j);  Serial.print("] = ");
  Serial.print(array[j]);
  }
  */
  
//  Serial.println(a);
}

I am a very beginner with arduino.

That's a complex chip for a beginner. Are you feeding it with a split supply? That is one that has a positave, ground and negitave? This is an unusual supply in this world and I just want to check you have it powerd up correctly before looking at the code.

It’s a single power supply chip (5V), but it has positive and negative inputs (it’s an op-amp with programmable gain / offset).

To Grummy_Mike: Thank you very much. The hardware was connected by another person but it seems works well. When I programmed with writting the output pin HIGH and LOW and check the voltage, it's jumping, and seems working.

PORTD |= _BV(3);
delay(1000);
PORTD &= ~(_BV(3));
delay(1000);

To Adrastos: Yes you're right, and thank you very much.

But still don't know why it's not working.