
          // set the Logger Sensro Mode
          if( (srchptr=strstr(cbuf, "MODE,")) != NULL ){

            if(strchr(srchptr, '?') != NULL){
              printf("ACK,MODE?,%lu\n", (ulong)sys_sensor_mode);
              SCIRxFlush();
              continue;
              }

            i = gotVal = 0;
            srchptr = strtok(srchptr, ",");
            while( (srchptr = strtok(NULL, ",")) != NULL ){
              ++i;
              if(i == 1){
                input_var = strtoul(srchptr, &endptr, 10);
                if( errno == ERANGE ){
                  printf("NAK,MODE,OverflowErr: %s\n", srchptr);
                  i = ERROR;
                  break;
                  }
                else if( (input_var == 0) && (endptr == srchptr) ){
                  printf("NAK,MODE,ConvertErr: %s\n", srchptr);
                  i = ERROR;
                  break;
                  }
                else if( input_var > 2 ){
                  printf("NAK,MODE,RangeErr [0,2]: %s\n", srchptr);
                  i = ERROR;
                  break;
                  }
                else
                  ++gotVal;
                }
              }

            if( (gotVal == 1) && (i != ERROR) ){
              printf("ACK,MODE,%lu\n", input_var);

              SCIRxFlush();
              if( SerGetsTmout(abuf, sizeof(abuf), GET_ACK_TIMEOUT) > 0 ){
                if( MatchACK(abuf) == ACK ){               // if ACK update variable
                  sys_sensor_mode = (uchar)input_var;
				  
                  //clear any previously collected data
				  gotSample = FALSE;
				  memset(dbuf, '\0', sizeof(dbuf));
				  CTD_Time = 0;
                  acquire_time = CTD_Temp = CTD_Salinity = CTD_Depth = -1.0;
				  
				  SCIRxFlush();
                  continue;
                  }
                }

              sprintf(ebuf, "MODE Command ACK Failure");
              LogErrorMsg(ebuf, (int)COMMAND_ACK_FAILURE, sys_message_enable);

              SCIRxFlush();
              continue;
              } // end gotVal if
            else{
              if(i != ERROR)
                printf("NAK,MODE,FormatErr\n");

              SCIRxFlush();
              continue;
              }

            } // end set Logger Sensor Mode if


