UPDATED - Further Investigation on the delay GET/SET workaround - UPDATED
I investigated which delays are really needed in the above code using an Adafruit CP2102 cable. My starting point was 38400 baud with 3 msec delays, which had successes in 30 out of 30 previous trials. This time I used a Windows 8.1 computer.
- 20 new trials at 38400 baud with all delays active at 3 msec: 20 complete successes
As I had the number 53.90 in "SimpleData"!J3 and 42.42 in "Further sheet"!F6, the correct result is to print on the Arduino monitor:
42.00
Test print is 53.90
42.42
DONE
- 20 new trials at 38400 baud with all delays commented out: 0 complete successes
16 out of the 20 answers were:
42.00
Test print is 0.00
53.90
DONE
which pointed out that a delay may be necessary before the CELL,GET command
- 20 new trials at 38400 baud activating the delay before the CELL,GET,J3 command: 19 complete successes
The only failure was the first test
-
20 trials at 115200 baud with 3 msec delays before the CELL,GET and CELL,GET,FROMSHEET commands: 15 complete successes.
-
20 trials at 115200 baud with 10 msec delays before the CELL,GET and CELL,GET,FROMSHEET commands: only 5 complete successes!
The majority of failures printed
42.00
Test print is 53.00
942.42
DONE
- 10 trials at 115200 baud with 100 msec delays before the CELL,GET and CELL,GET,FROMSHEET commands: 0 complete successes!
Update: If tdelay is changed from byte to integer
Result: 10/10 complete successes
-
20 trials at 57600 baud with 3 msec delays before the CELL,GET and CELL,GET,FROMSHEET commands: 20 complete successes.
-
20 trials at 74880 baud with 3 msec delays before the CELL,GET and CELL,GET,FROMSHEET commands: 20 complete successes.
REVISED CONCLUSION
Placing delays before CELL,GET and CELL,GET,FROMSHEET commands seems to be completely effective for rates <= 74880 baud.
Delays of 3 msec were successful for the above test, but larger delays are needed if the Excel cells read from involve lengthy calculations.
I am not sure what is happening at 115200 baud. Perhaps it is an issue of the software serial port. Even though the current documentation states that it works up to 115200 baud, older documentation indicated issues at that rate.