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?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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?
New version of fixed files. No difference in code, but more precise comment on what has changed.
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:
Code attached.
Last edit: Anobium 2020-05-09
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);
The body of the sub ist the same as for the software variants.
Frank
The
rotatecould destroy the byte being send. Therotatewill 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.