User manual
404
mikoBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
‘ UART write text and new line (carriage return + line feed)
sub procedure UART_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” ‘ Set lename for single-le tests
Mmc_Fat_Set_File_Date(2005,6,21,10,35,0) ‘ Set le date & time info
Mmc_Fat_Assign(lename, 0xA0) ‘ Will not nd le and then create le
Mmc_Fat_Rewrite ‘ To clear le and start with new data
for loop1=1 to 99 ‘ We want 5 les on the MMC card
UART1_Write(“.”)
le_contents[0] = loop1 div 10 + 48
le_contents[1] = loop1 mod 10 + 48
Mmc_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) ‘ signal the progress
lename[7] = loop2 ‘ set lename
Mmc_Fat_Set_File_Date(2005,6,21,10,35,0) ‘ Set le date & time info
Mmc_Fat_Assign(lename, 0xA0) ‘ nd existing le or create a new one
Mmc_Fat_Rewrite ‘ To clear le and start with new data
for loop1 = 1 to 44
le_contents[0] = byte(loop1 div 10 + 48)
le_contents[1] = byte(loop1 mod 10 + 48)
Mmc_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
Mmc_Fat_Assign(lename, 0)
Mmc_Fat_Rewrite
for loop1 = 1 to 55
le_contents[0] = byte(loop1 div 10 + 48)
le_contents[1] = byte(loop1 mod 10 + 48)
Mmc_Fat_Write(le_contents, 42) ‘ 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()
lename[7] = “B”
Mmc_Fat_Assign(lename, 0)
Mmc_Fat_Set_File_Date(2009, 1, 23, 17, 22, 0)
Mmc_Fat_Append() ‘ Prepare le for append
le_contents = “ for mikroElektronika 2007” ‘ Prepare le for append