[SOLVED] Freeze after 20-90 minutes when using serial communication

You do not have a test anywhere that iValueBufferIndex does not overstep the bounds of aValueBuffer[]. A bit of noise on the serial line, or a dropped would have you off clobbering lord knows what. I would suggest something like:

    // Store incoming value characters
    // in corresponding char array
    // (in order to be able to transform it
    // to a floating point number by 'atof')
    else if (bValueNext)
    {
      if (iValueBufferIndex >= (sizeof(aValueBuffer) - 1)) {
           // the character is not going to fit -- what do we do?
           // the easy thing is just to carry on waiting for the <NL>.
           // Better would be entering an error state where we just look for
           // the next <NL> and remember not to try to parse this
           // bad string. 
      } else { 
           aValueBuffer[iValueBufferIndex] = cBMSSerialChar;
           iValueBufferIndex++;
      }
    }