FAT Set File INDEX [solved]

A forums to allow bugs and problems with Flowcode v7 to be reported and resolved.

Moderator: Benj

Post Reply
User avatar
Alan_37
Posts: 179
Joined: Sun May 01, 2016 8:36 pm
Has thanked: 51 times
Been thanked: 54 times
Contact:

FAT Set File INDEX [solved]

Post 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
Attachments
B.txt
(45 Bytes) Downloaded 215 times
A.txt
(47 Bytes) Downloaded 209 times
Flowcode1.fcfx
(9.79 KiB) Downloaded 217 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: FAT Set File INDEX

Post 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

User avatar
Alan_37
Posts: 179
Joined: Sun May 01, 2016 8:36 pm
Has thanked: 51 times
Been thanked: 54 times
Contact:

Re: FAT Set File INDEX

Post by Alan_37 »

Hi Benj

Thanks for your reply

I have added the ReadFileSector() but i am still getting the same result .
Attachments
rs232.png
(15.49 KiB) Downloaded 2608 times
Flowcode1.fcfx
(9.96 KiB) Downloaded 226 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: FAT Set File INDEX

Post 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?

User avatar
Alan_37
Posts: 179
Joined: Sun May 01, 2016 8:36 pm
Has thanked: 51 times
Been thanked: 54 times
Contact:

Re: FAT Set File INDEX

Post 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 .

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: FAT Set File INDEX

Post by Benj »

Great news, thanks for letting us know.

Post Reply