Getting Serial communication data of particular length

I have modified code bit.I need String compare function.

strcmp() perhaps, but note that it works with zero terminated arrays of chars (aka C style strings) not String objects. You have a mix of both in your program so be careful when using the str* functions.

With this changes i made it work. I need favor alter bit code. Currently i m sending command lik

<SMCB1,1,100,1>
where SMCB 1 is device name
1= device ID
100= delay value
1 = start counter or send data continuously.

With below code Whenever i request for data i get response. I also like to keep option for recevie data continuously.

Send and receive function can be stopped using last bit

<SMCB1,1,100,1> 1 means start serial data for predefined time interval , 0 means stop response .

void showParsedData() {

  Serial.print("data send from PC:");
  Serial.println(Received_String);
  Serial.println();


  Serial.print("Device_name: ");
  Serial.println(messageFromPC);
  Serial.print("Device_ID: ");
  Serial.println(integerFromPC);
  Serial.print("timer:");
  Serial.println(Time_delay);
  Serial.print("start_stop:");
  Serial.println(Start_Stop);
  Serial.println();

  temp_int = Take_Temp_Reading();
  temp_int = (uint16_t)temp_int;

  int HV_value= Take_HV_Reading();

  New_String=Old_string+"SMCB1"+","+Device_ID+","+Mod_current[0]+","+Mod_current[1]+","+Mod_current[2]+","+Mod_current[3]+","+Mod_current[4]+","+Mod_current[5]+","+Mod_current[6]+","+Mod_current[7]+","+Mod_current[8]+","+Mod_current[9]+","+Mod_current[10]+","+Mod_current[11]+ ","+Mod_current[23]+ ","+Mod_current[22]+ ","+Mod_current[21]+ ","+Mod_current[20]+ ","+Mod_current[19]+","+Mod_current[18]+","+Mod_current[17]+","+Mod_current[16]+","+Mod_current[15]+","+Mod_current[14]+","+Mod_current[13]+","+Mod_current[12]+ ","+ temp_int +","+ SPD+","+ DISCONNECTOR+","+ HV_value;                                                                                                       

  String firstString = Received_String.substring(0,14);
  String SecondString=New_String.substring(0,7);
  
  Serial.print("string length:");Serial.println(Received_String.length());
  
  /*  Serial.print("1:");
   Serial.println(firstString);
   Serial.print("2:");
   Serial.println(SecondString);
   */
  if (firstString==SecondString)
  {
    Serial.println(New_String);
  }
  else
  {
    Serial.println("wrong command send");
  }


  Received_String="";


}

The above code working fine. Need to alter bit. please give suggestions.

In the below code , If i am sending request then only get data.

Now i wanted request send in other 2 format

1)<SMCB1,1, Length of string>

If i send Request in this format New_String should print specified length

2)<SMCB1,1,Time_delay,Start_stop> i.e <SMCB1,1,1000,1>for start timer and <SMCB1,1,1000,0> stop timer.

Here I am sending requesting above format <SMCB1,1,1000,1>in format send data continuously 1s , if wanna stop <SMCB1,1,1000,0>. Then it goes to first case.

any suggestion how can impliment it.

void showParsedData() {

  Serial.print("data send from PC:");
  Serial.println(Received_String);
  Serial.println();
  Serial.print("Device_name: ");
  Serial.println(messageFromPC);
  Serial.print("Device_ID: ");
  Serial.println(integerFromPC);
  Serial.print("timer:");
  Serial.println(Time_delay);
  Serial.print("start_stop:");
  Serial.println(Start_Stop);
  Serial.println();
  temp_int = Take_Temp_Reading();
  temp_int = (uint16_t)temp_int;

  int HV_value= Take_HV_Reading();

  New_String=Old_string+"SMCB1"+","+Device_ID+","+Mod_current[0]+","+Mod_current[1]+","+Mod_current[2]+","+Mod_current[3]+","+Mod_current[4]+","+Mod_current[5]+","+Mod_current[6]+","+Mod_current[7]+","+Mod_current[8]+","+Mod_current[9]+","+Mod_current[10]+","+Mod_current[11]+ ","+Mod_current[23]+ ","+Mod_current[22]+ ","+Mod_current[21]+ ","+Mod_current[20]+ ","+Mod_current[19]+","+Mod_current[18]+","+Mod_current[17]+","+Mod_current[16]+","+Mod_current[15]+","+Mod_current[14]+","+Mod_current[13]+","+Mod_current[12]+ ","+ temp_int +","+ SPD+","+ DISCONNECTOR+","+ HV_value;                                                                                                       

  String firstString = Received_String.substring(0,14);
  String SecondString=New_String.substring(0,7);

  Serial.print("string length:");
  Serial.println(Received_String.length());
  if (firstString==SecondString)
  {
    Serial.println(New_String);
  }
  else
  {
    Serial.println("wrong command send");
  }
  Received_String="";
}

Here i am saying if any request send from serially then only send data. To implement above 2 case the request has to send from old request

void loop() {
  wdt_reset();
  recvWithStartEndMarkers() ;

  if (newData == true)
  {
    strcpy(tempChars, receivedChars);
    // this temporary copy is necessary to protect the original data
    //   because strtok() used in parseData() replaces the commas with \0
    parseData();
    showParsedData();
    newData = false;
  }
  HV_value= Take_HV_Reading();
  Take_Reading();

  //  Serial_Command();

}

I have made correction . I need help in over ride my Loop function to print data based on Delay function.

I have made it work with 2 things

  1. send request from PC and get response request<SMCB1,1>

2)Send request from PC of specified length<SMCB1,1,100> and get the specified response

Pending

3) Send request from PC <SMCB1,1,delaytime,ON> or <<SMCB1,1,delaytime,OFF>
This function has to override request. Is timer is on get data continuously for specified delaytime and if timer is off get back to normal

#include <avr/wdt.h>
String Old_string;
String New_String;
String Received_String;
const byte numChars = 32;
char receivedChars[numChars];
char tempChars[numChars];        // temporary array for use when parsing
String txtMsg = "";
// variables to hold the parsed data
char messageFromPC[numChars] = {
  0};
int integerFromPC = 0;
float floatFromPC = 0.0;
static int Length_String=0;
static int Start_Stop=0;

boolean newData = false;


void showParsedData() 
{

  New_String=New_String+"SMCB1"+","+"1"+","+"1"+","+"1"+","+"1"+","+"1"+","+"1"+","+"1"+","+"1"+","+"1"+","+"1"+","+"1"+","+"1"+","+"1"+","+"1"+","+"1"+","+"1"+","+"1"+","+"1"+","+"1"+","+"1"+","+"4000";
  String firstString = Received_String.substring(0,14);
  String SecondString=New_String.substring(0,7);
  if ((firstString==SecondString)&&Length_String==0)
  {
    Serial.println(New_String);
  }
  else
  {
    //Serial.println("wrong command send");
  }
  if(Length_String>8 && (firstString==SecondString))
  {
    Serial.println(New_String.substring(0,Length_String));
  }
  Received_String="";
  New_String="";
}


void parseData() 
{     
  char * strtokIndx; // this is used by strtok() as an index
  strtokIndx = strtok(tempChars,",");      // get the first part - the string
  strcpy(messageFromPC, strtokIndx); // copy it to messageFromPC
  strtokIndx = strtok(NULL, ","); // this continues where the previous call left off
  integerFromPC = atoi(strtokIndx);     // convert this part to an integer
  strtokIndx = strtok(NULL, ","); // this continues where the previous call left off
  Length_String = atoi(strtokIndx);     // convert this part to an integer
  strtokIndx = strtok(NULL, ","); // this continues where the previous call left off
  Start_Stop = atoi(strtokIndx);     // convert this part to an integer
  Received_String=Received_String+messageFromPC+","+integerFromPC;
}

void recvWithStartEndMarkers() {
  static boolean recvInProgress = false;
  static byte ndx = 0;
  char startMarker = '<';
  char endMarker = '>';
  char rc;

  while (Serial.available() > 0 && newData == false) {
    rc = Serial.read();

    if (recvInProgress == true) {
      if (rc != endMarker) {
        receivedChars[ndx] = rc;
        ndx++;
        if (ndx >= numChars) {
          ndx = numChars - 1;
        }
      }
      else {
        receivedChars[ndx] = '\0'; // terminate the string
        recvInProgress = false;
        ndx = 0;
        newData = true;
      }
    }

    else if (rc == startMarker) {
      recvInProgress = true;

    }
  }

}



void setup()
{
  wdt_enable(WDTO_8S);
  Serial.begin(57600);
  Serial.println("Format1: <SMCB1,1>");
  Serial.println("Format1: <SMCB1,1,Length>");
  Serial.println("Format1: <SMCB1,1,Timer,On_OFF>");
}

void loop() {
  wdt_reset();
  recvWithStartEndMarkers() ;
  if (newData == true)
  {
    strcpy(tempChars, receivedChars);
    parseData();
    showParsedData();
    newData = false;
  }


}

With below code i make it working, For small delay it give properly output. if i make delay of 1 minute its get reset MCU. Please let me know how to resolve.

#include <avr/wdt.h>
#include"glob.h"
String Old_string;
String New_String;
String Received_String;
const byte numChars = 32;
char receivedChars[numChars];
char tempChars[numChars];        // temporary array for use when parsing
static int OverRide_flag = 0;

// variables to hold the parsed data
char messageFromPC[numChars] = {
  0
};
int integerFromPC = 0;
float floatFromPC = 0.0;

boolean newData = false;




int array[8][3] = {
  {
    0, 0, 0
  }
  , {
    0, 0, 1
  }
  , {
    0, 1, 0
  }
  , {
    0, 1, 1
  }
  , {
    1, 0, 0
  }
  , {
    1, 0, 1
  }
  , {
    1, 1, 0
  }
  , {
    1, 1, 1
  }
};



void recvWithStartEndMarkers() {
  static boolean recvInProgress = false;
  static byte ndx = 0;
  char startMarker = '<';
  char endMarker = '>';
  char rc;

  while (Serial.available() > 0 && newData == false) {
    rc = Serial.read();

    if (recvInProgress == true) {
      if (rc != endMarker) {
        receivedChars[ndx] = rc;
        ndx++;
        if (ndx >= numChars) {
          ndx = numChars - 1;
        }
      }
      else {
        receivedChars[ndx] = '\0'; // terminate the string
        recvInProgress = false;
        ndx = 0;
        newData = true;
      }
    }

    else if (rc == startMarker) {
      recvInProgress = true;

    }
  }

}
void parseData()
{
  char * strtokIndx; // this is used by strtok() as an index
  strtokIndx = strtok(tempChars, ",");     // get the first part - the string
  strcpy(messageFromPC, strtokIndx); // copy it to messageFromPC

  strtokIndx = strtok(NULL, ","); // this continues where the previous call left off
  integerFromPC = atoi(strtokIndx);     // convert this part to an integer

  strtokIndx = strtok(NULL, ","); // this continues where the previous call left off
  Length_String = atoi(strtokIndx);     // convert this part to an integer

  strtokIndx = strtok(NULL, ","); // this continues where the previous call left off
  Start_Stop = atoi(strtokIndx);     // convert this part to an integer

  Received_String = Received_String + messageFromPC + "," + integerFromPC;
}



void showParsedData()
{
  // HV_value= Take_HV_Reading();
  // temp_int = Take_Temp_Reading();
  //  temp_int = (uint16_t)temp_int;
  New_String = Old_string + "SMCB1" + "," + Device_ID + "," + Mod_current[0] + "," + Mod_current[1] + "," + Mod_current[2] + "," + Mod_current[3] + "," + Mod_current[4] + "," + Mod_current[5] + "," + Mod_current[6] + "," + Mod_current[7] + "," + Mod_current[8] + "," + Mod_current[9] + "," + Mod_current[10] + "," + Mod_current[11] + "," + Mod_current[23] + "," + Mod_current[22] + "," + Mod_current[21] + "," + Mod_current[20] + "," + Mod_current[19] + "," + Mod_current[18] + "," + Mod_current[17] + "," + Mod_current[16] + "," + Mod_current[15] + "," + Mod_current[14] + "," + Mod_current[13] + "," + Mod_current[12] + "," + temp_int + "," + SPD + "," + DISCONNECTOR + "," + HV_value;

  //  Serial.println();
  String firstString = Received_String.substring(0, 14);
  Serial.println(firstString);
  String SecondString = New_String.substring(0, 7);

  //  Serial.println(Length_String);
  if ((firstString == SecondString) && (Length_String == 0))
  {
    Serial.println(New_String);
    // OverRide_flag=1;
  }
  else
  {
    //Serial.println("wrong command send");
  }
  if ((Length_String > 8 ) && (firstString == SecondString))
  {
    //   Serial.println("Length condition");
    Serial.println(New_String.substring(0, Length_String));
    OverRide_flag = 0;
    //   newData = false;
  }

  if ((Length_String > 8 ) && (firstString == SecondString) && (Start_Stop == 1))
  {
    // Serial.println(New_String);
    //delay(Length_String);
    newData = false;
    OverRide_flag = 1;
  }
  else
  {
    newData = true;
    OverRide_flag = 0;
  }

  Received_String = "";
  New_String = "";
}







void setup()
{
  wdt_enable(WDTO_8S);
  Serial.begin(57600);
  //analogReference(INTERNAL);

  pinMode(3, OUTPUT);
  pinMode(SO_enable, OUTPUT) ;// pin can enable/disable using digital IO 7 of arduino
  pinMode(S1_enable, OUTPUT) ;// pin can enable/disable using digital IO 6 of arduino
  pinMode(S2_enable, OUTPUT) ;// pin can enable/disable using digital IO 5 of arduino
  //  pinMode(Enablepin, OUTPUT) ;// pin can enable/disable using digital IO 4 of arduino
  pinMode(A0, INPUT) ;
  pinMode(A5, INPUT) ;
  //spd & DC STATUS
  pinMode(SPD_STATUS_PIN, INPUT);
  pinMode(DC_STATUS_PIN, INPUT);

  Serial.println("Format1: <SMCB1,1>");
  Serial.print("Format2: <SMCB1,1,Length>");
  Serial.print("\t");
  Serial.println("Send serial command in this format <SMCB1,1,100>");
  Serial.print("Format3: <SMCB1,1,Timer,On_OFF(1-ON,0-OFF)>");
  Serial.print("\t");
  Serial.println("Send serial command in this format <SMCB1,1,1000,1>");


}



void loop() {
  wdt_reset();
  recvWithStartEndMarkers() ;
  HV_value = Take_HV_Reading();
  Take_Reading();
  SPD = SPD_Check();
  DISCONNECTOR =  DC_Status();
  temp_int = Take_Temp_Reading();
  temp_int = (uint16_t)temp_int;

  if (newData == true)
  {
    strcpy(tempChars, receivedChars);
    parseData();
    showParsedData();
    newData = false;
  }
  if ( OverRide_flag == 1)
  {
    Device_ID = 1;
   New_String = Old_string + "SMCB1" + "," + Device_ID + "," + Mod_current[0] + "," + Mod_current[1] + "," + Mod_current[2] + "," + Mod_current[3] + "," + Mod_current[4] + "," + Mod_current[5] + "," + Mod_current[6] + "," + Mod_current[7] + "," + Mod_current[8] + "," + Mod_current[9] + "," + Mod_current[10] + "," + Mod_current[11] + "," + Mod_current[23] + "," + Mod_current[22] + "," + Mod_current[21] + "," + Mod_current[20] + "," + Mod_current[19] + "," + Mod_current[18] + "," + Mod_current[17] + "," + Mod_current[16] + "," + Mod_current[15] + "," + Mod_current[14] + "," + Mod_current[13] + "," + Mod_current[12] + "," + temp_int + "," + SPD + "," + DISCONNECTOR + "," + HV_value;
    Serial.println(New_String);
    delay(Length_String);
    New_String = "";

  }


}

Disable the wdt ?

Or instead of delay, something based on millis(). The below might give you the idea (it might even work :wink: )

void loop() {
  static unsigned long delayStarttime = 0;

  wdt_reset();

  if (delayStarttime == 0)
  {
    recvWithStartEndMarkers() ;
    HV_value = Take_HV_Reading();
    Take_Reading();
    SPD = SPD_Check();
    DISCONNECTOR =  DC_Status();
    temp_int = Take_Temp_Reading();
    temp_int = (uint16_t)temp_int;

    if (newData == true)
    {
      strcpy(tempChars, receivedChars);
      parseData();
      showParsedData();
      newData = false;
    }
    if ( OverRide_flag == 1)
    {
      Device_ID = 1;
      New_String = Old_string + "SMCB1" + "," + Device_ID + "," + Mod_current[0] + "," + Mod_current[1] + "," + Mod_current[2] + "," + Mod_current[3] + "," + Mod_current[4] + "," + Mod_current[5] + "," + Mod_current[6] + "," + Mod_current[7] + "," + Mod_current[8] + "," + Mod_current[9] + "," + Mod_current[10] + "," + Mod_current[11] + "," + Mod_current[23] + "," + Mod_current[22] + "," + Mod_current[21] + "," + Mod_current[20] + "," + Mod_current[19] + "," + Mod_current[18] + "," + Mod_current[17] + "," + Mod_current[16] + "," + Mod_current[15] + "," + Mod_current[14] + "," + Mod_current[13] + "," + Mod_current[12] + "," + temp_int + "," + SPD + "," + DISCONNECTOR + "," + HV_value;
      Serial.println(New_String);
      delayStartTime = millis();
      //delay(Length_String);
      New_String = "";

    }
  }
  else
  {
    if (millis - delayStarttime >= Length_String)
      delayStarttime = 0;
  }
}

The variable delayStarttime functions both as a flag and as a value.

If it's zero, your code is executed as usual. If it's not zero, it checks if a duration has lapsed. If not, the code 'goes back' to loop, else delayStarttime is set to zero and the code 'goes back' to loop.

Note:
No option to compile or debug; leave that to you.

else
  {
    if (millis - delayStarttime >= Length_String)
      delayStarttime = 0;
  }

How do i convert string to int . i get error as below

Woking_Serial3.cpp: In function 'void loop()':
Woking_Serial3:226: error: pointer to a function used in arithmetic
Woking_Serial3:226: error: ISO C++ forbids comparison between pointer and integer

it doing same thing it work out for smaller delay if give delay of 1 minute i.e 60000Ms. i wont get any response.

If i sending request<SMCB1,1,40000,1>
Length_String should contain 40000. How can make it read as 40000

In above code, when i declare the value as

unsigned long Length_String=0;

when i am printing the length string value as below

Length_String4294941760
command2
SMCB1,1,34,0,40,0,11,0,0,0,47,0,45,0,0,0,0,0,0,24,0,68,0,0,0,18,246,0,0,4788
command3
SMCB1,1,34,0,40,0,11,0,0,0,47,0,45,0,0,0,0,0,0,24,0,68,0,0,0,18,246,0,0,4788
Format1: <SMCB1,1>

WHen i declare as

int Length_String=0;

I will get answer as

Before loop start
SMCB1,1
SMCB1,1
Start_Stop1
Length_String-25536

changes in code;

void showParsedData()
{
  // HV_value= Take_HV_Reading();
  // temp_int = Take_Temp_Reading();
  //  temp_int = (uint16_t)temp_int;
  New_String = Old_string + "SMCB1" + "," + Device_ID + "," + Mod_current[0] + "," + Mod_current[1] + "," + Mod_current[2] + "," + Mod_current[3] + "," + Mod_current[4] + "," + Mod_current[5] + "," + Mod_current[6] + "," + Mod_current[7] + "," + Mod_current[8] + "," + Mod_current[9] + "," + Mod_current[10] + "," + Mod_current[11] + "," + Mod_current[23] + "," + Mod_current[22] + "," + Mod_current[21] + "," + Mod_current[20] + "," + Mod_current[19] + "," + Mod_current[18] + "," + Mod_current[17] + "," + Mod_current[16] + "," + Mod_current[15] + "," + Mod_current[14] + "," + Mod_current[13] + "," + Mod_current[12] + "," + temp_int + "," + SPD + "," + DISCONNECTOR + "," + HV_value;

  //  Serial.println();
  String firstString = Received_String.substring(0,14);
  Serial.println(firstString);
  String SecondString = New_String.substring(0, 7);

  Serial.println("Before loop start");
  Serial.println(firstString);
  Serial.println(SecondString);
  Serial.print("Start_Stop");
  Serial.println(Start_Stop);
  Serial.print("Length_String");
  Serial.println(Length_String);

  if ((firstString == SecondString) && (Length_String == 0))
  {
    Serial.println("command1");
    Serial.println(New_String);
    // OverRide_flag=1;
  }

  if ((Length_String > 8 ) && (firstString == SecondString))
  {
    Serial.println("command2");
    //   Serial.println("Length condition");
    Serial.println(New_String.substring(0, Length_String));
    OverRide_flag = 0;
    //   newData = false;
  }

  if ((Length_String > 8 ) && (firstString == SecondString) && (Start_Stop == 1))
  {
    Serial.println("command3");
    // Serial.println(New_String);
    //delay(Length_String);
    newData = false;
    OverRide_flag = 1;
  }
  if ((Length_String > 8 ) && (firstString == SecondString) && (Start_Stop == 0))
  {
    Serial.println("command4");
    newData = true;
    OverRide_flag = 0;
  }
  Received_String = "";
  New_String = "";
}

delay of 1 minute the device itself reset . Is there any process of providing delay of 1 minute

#include <avr/wdt.h>
#include "Timer.h"
#include"glob.h"
int LED = 13;
Timer t;
String Old_string;
String New_String;
String Received_String;
const byte numChars = 32;
char receivedChars[numChars];
char tempChars[numChars];        // temporary array for use when parsing
static int OverRide_flag = 0;

int Length_String=0;
static int Start_Stop=0;
static int HV_value;

// variables to hold the parsed data
char messageFromPC[numChars] = {
  0
};
int integerFromPC = 0;
float floatFromPC = 0.0;

boolean newData = false;




int array[8][3] = {
  {
    0, 0, 0
  }
  , {
    0, 0, 1
  }
  , {
    0, 1, 0
  }
  , {
    0, 1, 1
  }
  , {
    1, 0, 0
  }
  , {
    1, 0, 1
  }
  , {
    1, 1, 0
  }
  , {
    1, 1, 1
  }
};



void recvWithStartEndMarkers() {
  static boolean recvInProgress = false;
  static byte ndx = 0;
  char startMarker = '<';
  char endMarker = '>';
  char rc;

  while (Serial.available() > 0 && newData == false) {
    rc = Serial.read();

    if (recvInProgress == true) {
      if (rc != endMarker) {
        receivedChars[ndx] = rc;
        ndx++;
        if (ndx >= numChars) {
          ndx = numChars - 1;
        }
      }
      else {
        receivedChars[ndx] = '\0'; // terminate the string
        recvInProgress = false;
        ndx = 0;
        newData = true;
      }
    }

    else if (rc == startMarker) {
      recvInProgress = true;

    }
  }

}
void parseData()
{
  char * strtokIndx; // this is used by strtok() as an index
  strtokIndx = strtok(tempChars, ",");     // get the first part - the string
  strcpy(messageFromPC, strtokIndx); // copy it to messageFromPC

  strtokIndx = strtok(NULL, ","); // this continues where the previous call left off
  integerFromPC = atoi(strtokIndx);     // convert this part to an integer

  strtokIndx = strtok(NULL, ","); // this continues where the previous call left off
  //  Length_String = atoi(strtokIndx);     // convert this part to an integer
  Length_String=strtokIndx[4]+'0';
  strtokIndx = strtok(NULL, ","); // this continues where the previous call left off
  Start_Stop = atoi(strtokIndx);     // convert this part to an integer

  Received_String = Received_String + messageFromPC + "," + integerFromPC;
}



void showParsedData()
{
  // HV_value= Take_HV_Reading();
  // temp_int = Take_Temp_Reading();
  //  temp_int = (uint16_t)temp_int;
  New_String = Old_string + "SMCB1" + "," + Device_ID + "," + Mod_current[0] + "," + Mod_current[1] + "," + Mod_current[2] + "," + Mod_current[3] + "," + Mod_current[4] + "," + Mod_current[5] + "," + Mod_current[6] + "," + Mod_current[7] + "," + Mod_current[8] + "," + Mod_current[9] + "," + Mod_current[10] + "," + Mod_current[11] + "," + Mod_current[23] + "," + Mod_current[22] + "," + Mod_current[21] + "," + Mod_current[20] + "," + Mod_current[19] + "," + Mod_current[18] + "," + Mod_current[17] + "," + Mod_current[16] + "," + Mod_current[15] + "," + Mod_current[14] + "," + Mod_current[13] + "," + Mod_current[12] + "," + temp_int + "," + SPD + "," + DISCONNECTOR + "," + HV_value;

  //  Serial.println();
  String firstString = Received_String.substring(0,14);
  Serial.println(firstString);
  String SecondString = New_String.substring(0, 7);

  Serial.println("Before loop start");
  Serial.println(firstString);
  Serial.println(SecondString);
  Serial.print("Start_Stop");
  Serial.println(Start_Stop);
  Serial.print("Length_String");
  Serial.println(Length_String);

  if ((firstString == SecondString) && (Length_String == 0))
  {
    Serial.println("command1");
    Serial.println(New_String);
    // OverRide_flag=1;
  }

  if ((Length_String > 8 ) && (firstString == SecondString))
  {
    Serial.println("command2");
    //   Serial.println("Length condition");
    Serial.println(New_String.substring(0, Length_String));
    OverRide_flag = 0;
    //   newData = false;
  }

  if ((Length_String > 8 ) && (firstString == SecondString) && (Start_Stop == 1))
  {
    Serial.println("command3");
    // Serial.println(New_String);
    //delay(Length_String);
    newData = false;
    OverRide_flag = 1;
  }
  if ((Length_String > 8 ) && (firstString == SecondString) && (Start_Stop == 0))
  {
    Serial.println("command4");
    newData = true;
    OverRide_flag = 0;
  }
  Received_String = "";
  New_String = "";
}







void setup()
{
  wdt_enable(WDTO_8S);
  Serial.begin(57600);
  //analogReference(INTERNAL);

  pinMode(3, OUTPUT);
  pinMode(SO_enable, OUTPUT) ;// pin can enable/disable using digital IO 7 of arduino
  pinMode(S1_enable, OUTPUT) ;// pin can enable/disable using digital IO 6 of arduino
  pinMode(S2_enable, OUTPUT) ;// pin can enable/disable using digital IO 5 of arduino
  //  pinMode(Enablepin, OUTPUT) ;// pin can enable/disable using digital IO 4 of arduino
  pinMode(A0, INPUT) ;
  pinMode(A5, INPUT) ;
  //spd & DC STATUS
  pinMode(SPD_STATUS_PIN, INPUT);
  pinMode(DC_STATUS_PIN, INPUT);
  pinMode(LED, OUTPUT);
  Serial.println("Format1: <SMCB1,1>");
  Serial.print("Format2: <SMCB1,1,Length>");
  Serial.print("\t");
  Serial.println("Send serial command in this format <SMCB1,1,100>");
  Serial.print("Format3: <SMCB1,1,Timer,On_OFF(1-ON,0-OFF)>");
  Serial.print("\t");
  Serial.println("Send serial command in this format <SMCB1,1,1000,1>");


}



void loop() {

//  wdt_reset();
  HV_value = Take_HV_Reading();
  Take_Reading();
  SPD = SPD_Check();
  DISCONNECTOR =  DC_Status();
  temp_int = Take_Temp_Reading();
  temp_int = (uint16_t)temp_int;
  New_String=Old_string+Device_ID+","+Mod_current[0]+","+Mod_current[1]+","+Mod_current[2]+","+Mod_current[3]+","+Mod_current[4]+","+Mod_current[5]+","+Mod_current[6]+","+Mod_current[7]+","+Mod_current[8]+","+Mod_current[9]+","+Mod_current[10]+","+Mod_current[11]+ ","+Mod_current[23]+ ","+Mod_current[22]+ ","+Mod_current[21]+ ","+Mod_current[20]+ ","+Mod_current[19]+","+Mod_current[18]+","+Mod_current[17]+","+Mod_current[16]+","+Mod_current[15]+","+Mod_current[14]+","+Mod_current[13]+","+Mod_current[12]+ ","+ temp_int +","+ SPD+","+ DISCONNECTOR+","+ HV_value;                                                                                                       
  Serial.println(New_String);
  delay(1*60*1000);

}

Is there any process of providing delay of 1 minute

The delay() function comes to mind as long as you want the program to stop completely for one minute. If the program needs to be doing other things during the minute than there is, of course, the BlinkWithoutDelay principle using the millis() function.

Sorry, 'millis' should have been 'millis()'.