Menu

GetString using software serial similar to HSergetstring

wn
2020-04-04
2020-05-09
<< < 1 2 (Page 2 of 2)
  • Anobium

    Anobium - 2020-05-09

    I have code reviewed this. Not tested the but I have a question.

    Now the string is passed as a reference, and then the string is indexed through to send each character to SerialSend, and, within SerialSend each byte is rotated through to send each bit. Each byte sent will result being 'destroyed... So, whilst passing a String constant should work, does a String variable get destroyed with this change?

     
  • Frank Steinberg

    Frank Steinberg - 2020-05-08

    New version of fixed files. No difference in code, but more precise comment on what has changed.

     
  • Anobium

    Anobium - 2020-05-09

    I have tested Rs232.h with the change. Looks ok but it would be best if you also check.

    My test was. Create string, write string variable to HEF ( position 0 ), Ser1Print string variable, rewrite string variable to HEF ( position 8 ).

    Results are shown here:

    Test results

    Code attached.

     

    Last edit: Anobium 2020-05-09
  • Frank Steinberg

    Frank Steinberg - 2020-05-09

    I have code reviewed this. Not tested the but I have a question.

    Now the string is passed as a reference, and then the string is indexed through to send each character to SerialSend, and, within SerialSend each byte is rotated through to send each bit. Each byte sent will result being 'destroyed... So, whilst passing a String constant should work, does a String variable get destroyed with this change?

    I can't see any reason for it. SerialSend uses a simple "for loop"; it does not change data. I've tested with a stringvariable too before posting (by simply sending the same variable twice).

    Another thought on this topic:
    This is how HSerPrint does it for years (usart.h);

    sub HSerPrint (In PrintData As String, optional In comport = 1)
    

    The body of the sub ist the same as for the software variants.

    Frank

     
  • Anobium

    Anobium - 2020-05-09

    The rotate could destroy the byte being send. Therotate will do this. If the byte is referenced back into the string then the string could be corrupted. This is a worry but we should check.

     
<< < 1 2 (Page 2 of 2)

Log in to post a comment.