I am using the ALFAT-USB and it is working very nicely. I have “saving” to the USB working 100% and also reading the saved data back from the USB working, however the manner which I am saving the data on the USB is a little complicated as I am using a Real time clock saving the the file to avoid over writing my text files saved in the folder
I am saving the file as shown below
USB04537 I am using the date/minute and sec as shown in the bold/strong text USB04537 as then I know I can overwrite or get duplicates.
The challenge come is when I have multiple files in the folder, how can I read one by one?, or is there an easier means on reading this data back?, current I do the following:
My apologies for the poor explanation, I am just wanting to know how I can read the data back multiple saved text files in a single folder, please see attached, how do I read these text files one by one?
You can use the @ command to return a directory listing, and use N to cycle through results. Or collect them in your local microcontroller logic, and iterate through them.
I noticed the N commands send the amount of files in the folder but but you need to keep pressing the N function to read through all. I have assumed you need to do the following for each text file:
I U0:
@ U0:\OVERRIDE_001
N
N
N (this is the 1st N which feeds the first text file)
O 0R>U0:\OVERRIDE_001\USB044329.TXT
O 1R>U0:\OVERRIDE_001\USB044329.TXT
R 0^>94
C 0
and then repeat and use the N functions 4 times then to read the next file, and 5 x N’s to read the 3rd file and so forth, is there not a faster means of doing this?
Yes this is something new we are busy with, we can write no problems to the ALFAT, reading is also ok but just with one file per folder, is the sequence we are using correct?
Hi Dat, I can read back one file below with no errors using the format below
I U0:
@ U0:\OVERRIDE_001
N
N
N (this is the 1st N which feeds the first text file)
O 0R>U0:\OVERRIDE_001\USB044329.TXT
O 1R>U0:\OVERRIDE_001\USB044329.TXT
R 0^>94
C 0
If you type the command via serial manually then yes, you have to look at the return and open single file, because there is no command to list all files out.
But for the real master application, I believe there is error code that tell you that end of folder or result was file or folder.
Idea is
while (send N return != end of folder)
{
if N return == file
Do Open for Read
}```