935486 wrote:What do you do if you don't find '*'? What if you don't find '$'? What if you find neither?
From my understanding based on the explanation of the hardware person. They ask to look for '$' as the start and '*' ad the end of the string. Thereafter for each complete string send an acknowledgment in this form "@@\r\n". Once the device receive this then it will send the next message. Thats all of my knowledge on the protocol for the device and there is nothing extra. I have tested with my current codes where I start to look first for '$' and start to read the each byte and conver to character later. Finally I look for '*' and then I send the acknowledgement. So since you have experience where in my if statement I could fail please highlight. Thank you in advance for help.
935486 wrote:The point to my response was that I was pointing that if you do not look at the protocol then you do not know what it is supposed to do and thus you can not anticipate what will happen when it doesn't do that. Nor will you be able to present diagnostic information. For example sometimes it might report an 'error' with useful information but because it doesn't match your form you will never see that.
Good question I never though of this what if the '*' is not found. About the '$' not being found ...