Serial communication and reading byte arrays with Arduino
Shouldn't some of that code be inside of loop()? Specifically, everything but Serial.begin(9600)? Anyway, this code won't work because ackmodule is not defined. Is it supposed to be GetDataACK? It's also a good idea to implement error handling, especially when having to debug, like this:

  if(Serial.available() &gt; 0) {
    received_byte[i] = Serial.read();
    if(received_byte[i++] == -1) {  // no data available
      // error handling
    }
  }


I'm not sure what types the Arduino sketch libraries support, but i can just be an unsigned char (I would call it uint8_t) instead of a full singed 16-bit number (int). As Chris Stratton mentioned, there are better ways to wait for characters; for example the error handling example, or this:

while(Serial.available() &lt; 5) {}; // 5 can be 0 to fetch 1 char at a time


This can be implemented without the library in this form:

char rx()
{
        while ((UCSRA &amp; (1&lt;&lt;RXC)) == 0) {};
        return UDR;
}


... Calling it with something like char nextbyte = rx(). Arduino serial tutorial is here.