On the delay workaround for the CELL, GET and CELL, GET,FROMSHEET commands for 115200 baud
As indicated in the earlier post, I started suspecting that the issue at 115200 baud may be related to the software serial port I have been using. The code below has removed it and gave the correct result (in cells J7-J11) in 18 out of 20 trials.
// 1. Open NetDevil's Excel file PLX-DAQ-v2.9.xlsm but do not connect PLX-DAQ
// (https://forum.arduino.cc/index.php?topic=437398.msg3160058#msg3160058)
// Enter a numerical value in cell J3 of sheet Simple Data
// Enter a numerical value in cell F6 of sheet Further sheet
// 2. Setting the port for the Arduino USB (in Tools), upload the sketch
// 3. With the Arduino serial monitor CLOSED connect PLX-DAQ at the same port
// 4. For repeating trials disconnect and reconnect PLX-DAQ
unsigned long baudr = 115200; //Do not forget to change the baud rate in PLX-DAQ
int tdelay = 100;
void setup(void) {
Serial.begin(baudr);
Serial.println("ClearRange,A,1,F,100");
Serial.println("ClearRange,J,7,J,11");
delay(tdelay);
delay(tdelay);
// 1st test of CELL,SET
float Ans = 42;
delay(tdelay);
Serial.print("CELL,SET,J7,");
Serial.println(Ans);
delay(tdelay);
// 2nd test of CELL,SET
Serial.print("CELL,SET,J8,");
Serial.println(F("Test print is "));
// Test of CELL,GET
delay(tdelay);
Serial.println("CELL,GET,J3");
float NotAns = Serial.parseFloat();
delay(tdelay);
Serial.print("CELL,SET,J9,");
Serial.println(NotAns);
// Test of GET FROMSHEET (thanks NetDevil)
delay(tdelay);
Serial.println("CELL,GET,FROMSHEET,Further sheet,F,6");
float AnsAns = Serial.parseFloat();
delay(tdelay);
Serial.print("CELL,SET,J10,");
Serial.println(AnsAns);
// Final printout
delay(tdelay);
Serial.print("CELL,SET,J11,");
Serial.println("DONE");
}
void loop(void) {;}
Testing results:
delay = 0 : completely correct 0/10
delay =10 : completely correct 19/20
delay = 100: completely correct 18/20
CONCLUSIONS
- Delays help but do not guarantee success at 115200
- Failures do not seem to be an issue with the previously used software serial port