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 .
Strange Behavior
Moderator: Benj
- Alan_37
- Posts: 179
- Joined: Sun May 01, 2016 8:36 pm
- Has thanked: 51 times
- Been thanked: 54 times
- Contact:
Strange Behavior
- Attachments
-
- Fast Dev.fcfx
- (56.81 KiB) Downloaded 220 times
-
- test.txt
- SD Card File
- (39 Bytes) Downloaded 236 times
-
- rs232.png
- Rs232 Debug Output
- (22.18 KiB) Downloaded 2295 times
- Alan_37
- Posts: 179
- Joined: Sun May 01, 2016 8:36 pm
- Has thanked: 51 times
- Been thanked: 54 times
- Contact:
Re: Strange Behavior
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
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
- Attachments
-
- Readline.png
- (15.44 KiB) Downloaded 2244 times
-
- Serial.png
- (22.61 KiB) Downloaded 2244 times
- Alan_37
- Posts: 179
- Joined: Sun May 01, 2016 8:36 pm
- Has thanked: 51 times
- Been thanked: 54 times
- Contact:
Re: Strange Behavior
Hi
I have worked around this problem , Please Delete / Move this tread if you feel this
is not a bug .
Thanks .
I have worked around this problem , Please Delete / Move this tread if you feel this
is not a bug .
Thanks .
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: Strange Behavior
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.
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.