Page 1 of 1

Strange Behavior

Posted: Sat Nov 05, 2016 9:38 pm
by Alan_37
Hi
I have been developing this Fat ( Miro-SD ) read and Execute from File stored on
Micro sd , but at point I got stuck in this Problem which I think is a Bug .

When I try to read and exec commands only the first 1 will run , After
doing some investigation I found that the problem is in the String manipulation
maco -> Global_Str = Left$ (RS232_OUT,7) this works fine the first time it executes
but After that Global_Str will Have only the first 5 letters not 7 .

When Checking Global_Str length it display’s 7 although string was sent via rs232 and I can only see
The first 5 letters only .

I was Not able replicate this in a new file , happens only in my project so I have included the FCFX file .

Re: Strange Behavior

Posted: Mon Nov 07, 2016 9:58 pm
by Alan_37
Hi Here is an update

After spending several hours trying to find what is wrong , I found a more Advanced Serial monitor
And now I can see that the output string really contains 7 characters, the 2 characters
at the beginning of the string are causing the problem 0d 0a , please see attached Pic

According to the ASCII Table 0d is carriage return , and 0a is line feed ok
these are in the txt file, but I thought they should be at the end of the string not at the beginning .

Now not sure if this is a bug or not , I will try to resolve by scanning the string and remove
these characters before running the string manipulation
,
I beleve that thes 2 characters are comming from the end of the previous line and there is where they should
Be at the end of the string.


Thanks

Re: Strange Behavior

Posted: Tue Nov 08, 2016 1:23 pm
by Alan_37
Hi

I have worked around this problem , Please Delete / Move this tread if you feel this
is not a bug .

Thanks .

Re: Strange Behavior

Posted: Tue Nov 08, 2016 1:44 pm
by LeighM
Hi
OK, thanks for the update.
As you have found, the ReadStringFromFile captures all characters from the file until the specified EndChar matches, in your case this is the ';' character.
At this point it will stop.
So the next read will include the CR/LF pair that occur after the ';'
You could at that point do another read with EndChar set to 0x0a to flush the CR/LF pair.