why i can create files on sd card only 32 files maximum?
kamengrinder666
Posts: 8
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
obj
text : "vga_text"
fs: "fsrw2.6"
var
byte filename[13]
pub start
text.start (16)
fs.mount (0)
bytemove(@filename,string("REC_0000.CSV"),13)
repeat
increment (@filename , 13)
fs.popen (@filename , "w")
fs.pclose
text.str (@filename)
text.str (string(13))
waitcnt (30_000_000 + cnt)
pub increment(address,length)
' address is the starting address of the byte array for the string
' length is the total length of the byte array including the zero byte that marks the end of the string
address += length - 6 ' Change the address so it points to the rightmost digit of the numeric value.
repeat
result := byte[address] ' Use the implicit result variable for a temporary variable
if result => "0" and result =< "9" ' Check to make sure there's a digit character there
byte[address] := ++result ' Increment the character
if result > "9"
byte[address--] := "0" ' If greater than "9", set to zero and carry a one
next ' Repeat the loop
quit
pub increment is the function that increase number of filename that i found on this forum (thank you very much)
i want to test how many files that i can create on sd card with my code
and the result is 32 files
i don't understand why i can create only 32 files .
and how to create more than 32 files ?
i'd be grateful to anyone who could make this clear to me
thank you very much in advance
sorry for my english
my sd card is fat32 format
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
obj
text : "vga_text"
fs: "fsrw2.6"
var
byte filename[13]
pub start
text.start (16)
fs.mount (0)
bytemove(@filename,string("REC_0000.CSV"),13)
repeat
increment (@filename , 13)
fs.popen (@filename , "w")
fs.pclose
text.str (@filename)
text.str (string(13))
waitcnt (30_000_000 + cnt)
pub increment(address,length)
' address is the starting address of the byte array for the string
' length is the total length of the byte array including the zero byte that marks the end of the string
address += length - 6 ' Change the address so it points to the rightmost digit of the numeric value.
repeat
result := byte[address] ' Use the implicit result variable for a temporary variable
if result => "0" and result =< "9" ' Check to make sure there's a digit character there
byte[address] := ++result ' Increment the character
if result > "9"
byte[address--] := "0" ' If greater than "9", set to zero and carry a one
next ' Repeat the loop
quit
pub increment is the function that increase number of filename that i found on this forum (thank you very much)
i want to test how many files that i can create on sd card with my code
and the result is 32 files
i don't understand why i can create only 32 files .
and how to create more than 32 files ?
i'd be grateful to anyone who could make this clear to me
thank you very much in advance
sorry for my english
my sd card is fat32 format
Comments
Your increment methode looks wrong, but it's difficult to say without indentions. "next" is not necessary to repeat a loop.
You need to capture the aborts from the fsrw methodes, this is done with a backslash before the methode call. And you should also test the return value. Most fsrw methodes return zero if succesful, or a negative error number otherwise.
Try it with this code: (I've only tested the increment methode)
Andy
ElectricAye
- thank you . i will post my code on your way on next time.
Ariba
- thank you for editing my code but i think my pub increment is work for sure
i have already tested by running number from 1 to 9999 and it's work
about my code, my vga screen stop display filenames at REC_0032.CSV
and i get 32 files on my sd card
i have tested your code now . filenames are displayed continuously even i unmount my sd card
i unmount my sd card when REC_0048.CSV displayed
i wish i get 48 files on my sd card but it's only 32 files too
is format of sd card involve?
==sorry for my english==
Andy
my vga screen show this :
REC_0001.CSV
REC_0002.CSV
.
.
REC_0032.CSV
open error: -2
REC_0033.CSV
open error: -2
REC_0034.CSV
open error: -2
.
.
what open error: -2 mean??
ariba : thank a lot for help . i will try it.
kwinn : i have tried to format already but it's also created only 32 files too.
mark_t : i understand what you said now . is fsrw have any methods to create files on other directories ?
Has code in there to fix your problem. Read the APP note first.
i'll try to edit my code and tell you the results.
thanks