User manual
mikroBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
295
‘ UART write text and new line (carriage return + line feed)
sub procedure UART1_Write_Line( dim byref uart_text as string )
UART1_Write_Text(uart_text)
UART1_Write(13)
UART1_Write(10)
end sub
‘-------------- Creates new le and writes some data to it
sub procedure M_Create_New_File()
lename[7] = “A”
Cf_Fat_Set_File_Date(2005,6,21,10,35,0) ‘ Set le date & time info
Cf_Fat_Assign(lename, 0xA0) ‘ Will not nd le and then create le
Cf_Fat_Rewrite() ‘ To clear le and start with new data
for loop1=1 to 90 ‘ We want 5 les on the MMC card
UART1_Write(“.”)
le_contents[0] = loop1 div 10 + 48
le_contents[1] = loop1 mod 10 + 48
Cf_Fat_Write(le_contents, LINE_LEN-1) ‘ write data to the assigned le
next loop1
end sub
‘-------------- Creates many new les and writes data to them
sub procedure M_Create_Multiple_Files()
for loop2 = “B” to “Z”
UART1_Write(loop2) ‘ this line can slow down the performance
lename[7] = loop2 ‘ set lename
Cf_Fat_Set_File_Date(2005,6,21,10,35,0) ‘ Set le date & time info
Cf_Fat_Assign(lename, 0xA0) ‘ nd existing le or create a new one
Cf_Fat_Rewrite() ‘ To clear le and start with new data
for loop1 = 1 to 44
le_contents[0] = loop1 div 10 + 48
le_contents[1] = loop1 mod 10 + 48
Cf_Fat_Write(le_contents, LINE_LEN-1) ‘ write data to the assigned le
next loop1
next loop2
end sub
‘-------------- Opens an existing le and rewrites it
sub procedure M_Open_File_Rewrite()
lename[7] = “C” ‘ Set lename for single-le tests
Cf_Fat_Assign(lename, 0)
Cf_Fat_Rewrite()
for loop1 = 1 to 55
le_contents[0] = byte(loop1 div 10 + 48)
le_contents[1] = byte(loop1 mod 10 + 48)
Cf_Fat_Write(le_contents, LINE_LEN-1) ‘ write data to the assigned le
next loop1
end sub
‘-------------- Opens an existing le and appends data to it
‘ (and alters the date/time stamp)
sub procedure M_Open_File_Append()