Datasheet
i = 0
while ostr[i] <> 0
UART1_Write(ostr[i])
Inc(i)
wend
UART1_Write($0A)
end sub'~
'-------------- Creates new file and writes some data to it
sub procedure Create_New_File
filename[7] = "A"
Cf_Fat_Assign(filename, 0xA0) ' Will not find file and then
create file
Cf_Fat_Rewrite() ' To clear file and start with
new data
for loop_=1 to 90 ' We want 5 files on the MMC
card
PORTC = loop_
file_contents[0] = loop_ div 10 + 48
file_contents[1] = loop_ mod 10 + 48
Cf_Fat_Write(file_contents, 38) ' write data to the assigned file
UART1_Write(".")
next loop_
end sub'~
'-------------- Creates many new files and writes data to them
sub procedure Create_Multiple_Files
for loop2 = "B" to "Z"
UART1_Write(loop2) ' this line can slow down the performance
filename[7] = loop2 ' set filename
Cf_Fat_Assign(filename, 0xA0) ' find existing file or cre-
ate a new one
Cf_Fat_Rewrite ' To clear file and start
with new data
for loop_ = 1 to 44
file_contents[0] = loop_ div 10 + 48
file_contents[1] = loop_ mod 10 + 48
Cf_Fat_Write(file_contents, 38) ' write data to the assigned
file
next loop_
next loop2
end sub'~
'-------------- Opens an existing file and rewrites it
sub procedure Open_File_Rewrite
206
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6