Control flow troubles

Thank you, that's a very good point! I'm having trouble with the control flow again. This time a for loop gets executed continuously (as it's supposed to) but cannot make it run only once. Tried the break statement with no success.

char addressBit[10];
char dataBit[6];
int arrayIndex, dataIndex,i;
boolean startedA, endedA, startedD, endedD = false;

int CE  = 47;
int OE  = 48;
int WE  = 49;

int AP[13] = {22,24,26,28,30,32,34,36,38,40,42,44,46};
int DP[8] =  {23,25,27,29,31,33,35,37};

void setup(){
  Serial.begin(9600);
  Serial.println("Enter address in decimal starting with the letter a and finishing it with a period!");
  Serial.println("Then enter data in decimal between d and comma!");
  for (i=2;i<10;i++) {
    pinMode(AP[i],OUTPUT); // address pins
  }
  for (i=9;i<14;i++) {
    pinMode(DP[i],INPUT); // data pins
  }
  // Setup Control Pins
  pinMode(CE, OUTPUT);
  pinMode(WE, OUTPUT);
  pinMode(OE, OUTPUT);
  pinMode(45, OUTPUT);
  
  // Setup Chip
  digitalWrite(CE, HIGH);
  digitalWrite(WE, LOW);
  digitalWrite(OE, HIGH);
}

void loop(){
  digitalWrite(45, HIGH);
  while(Serial.available() > 0)
  {
    char aChar = Serial.read();
    if(aChar == 'r') //beginning of the string
    {
      startedA = true;
      arrayIndex = 0;
      addressBit[arrayIndex] = '\0';
    }
    else if(aChar == '/') ///end of string
    {
      endedA = true;
    }
    else if(startedA)
    {
      addressBit[arrayIndex] = aChar;
      arrayIndex++;
      addressBit[arrayIndex] = '\0';
    }
  }  
if(startedA && endedA){
    int incomingByteA = atoi(addressBit); // Convert the string to an integer
    for(int j=0; j<13; j++){
      digitalWrite (AP[j], bitRead (incomingByteA,j));  // extract relevant bit and output on relevant pin.
      int a = bitRead (incomingByteA,j);
      Serial.println(a);
    }
    Serial.println(" ");
    // Get ready for the next time
    startedA = false;
    endedA = false;
    arrayIndex = 0;
    addressBit[arrayIndex] = '\0';
  }
   delay(1);
    digitalWrite(WE,LOW);      // Write Disabled
    delay(1);
    digitalWrite(CE,HIGH);      // Chip enabled
    delay(1);
    digitalWrite(OE,HIGH);       // Reads Enabled
    delay(1);
  
for(int i=0; i<8; i++){       /// FOR LOOP 
  int DD = digitalRead(DP[i]);
  Serial.println(DD);
  }
 
  delay(100);
}

It's the last bit that gives me headache:

for(int i=0; i<8; i++){       /// FOR LOOP 
  int DD = digitalRead(DP[i]);
  Serial.println(DD);
  }

It seems that this bit prints whatever is coming from the serial as opposed to print the state of the pins. Where did I go wrong? Any suggestions would be appreciated!