Page 1 of 1

FAT Set File INDEX [solved]

Posted: Mon Nov 14, 2016 11:04 pm
by Alan_37
Hi

Is this a Bug or i am doing somthing wrong ? , I have 2 files in the SD Card named
A.txt and B.txt, A.txt contain " This is File A " and B.txt contain " This is File B "

In the flowchart I : INIT CARD -> SetFileIndex(0) -> OpenFile(A.txt) - > SetFileIndex(1) -> OpenFile(B.txt) - > ReadStringFromFile(50,13)
-> SendString via RS232 -> SetFileIndex(0) -> ReadStringFromFile(50,13) -> SendString via RS232

I get the below result :

This is File B
This is File B

Re: FAT Set File INDEX

Posted: Tue Nov 15, 2016 10:54 am
by Benj
Hi Alan,

I think I see what's going wrong. The buffer is not being reloaded when you change the file index so the data is coming from the FileB buffer.

How about trying this instead.

INIT CARD -> SetFileIndex(0) -> OpenFile(A.txt) - > SetFileIndex(1) -> OpenFile(B.txt) - > ReadStringFromFile(50,13)
-> SendString via RS232 -> SetFileIndex(0) -> ReadFileSector() -> ReadStringFromFile(50,13) -> SendString via RS232

Re: FAT Set File INDEX

Posted: Tue Nov 15, 2016 11:16 am
by Alan_37
Hi Benj

Thanks for your reply

I have added the ReadFileSector() but i am still getting the same result .

Re: FAT Set File INDEX

Posted: Tue Nov 15, 2016 1:02 pm
by Benj
Hi Alan,

In the FAT component properties the Max Concurrent Files property is set to 1, if you change this to 2 does this make any difference?

Re: FAT Set File INDEX

Posted: Tue Nov 15, 2016 1:24 pm
by Alan_37
Hi Benj

Yes that was the problem , now it is working fine , i must have missed that setting

can move this to general programming as it was not a bug .

Thanks very much for your support .

Re: FAT Set File INDEX

Posted: Tue Nov 15, 2016 1:34 pm
by Benj
Great news, thanks for letting us know.