User manual

402
mikoPascal PRO for dsPIC30/33 and PIC24
MikroElektronika
buffer : array[512] of byte;
// UART write text and new line (carriage return + line feed)
procedure UART_Write_Line( var uart_text : string );
begin
UART1_Write_Text(uart_text);
UART1_Write(13);
UART1_Write(10);
end;
//-------------- Creates new le and writes some data to it
procedure M_Create_New_File();
begin
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 loop:=1 to 99 do // We want 5 les on the MMC card
begin
UART1_Write(‘.’);
le_contents[0] := loop div 10 + 48;
le_contents[1] := loop mod 10 + 48;
Mmc_Fat_Write(le_contents, LINE_LEN-1);// write data to the assigned le
end;
end;
//-------------- Creates many new les and writes data to them
procedure M_Create_Multiple_Files();
begin
for loop2 := ‘B’ to ‘Z’ do
begin
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 loop := 1 to 44 do
begin
le_contents[0] := byte(loop div 10 + 48);
le_contents[1] := byte(loop mod 10 + 48);
Mmc_Fat_Write(le_contents, LINE_LEN-1); // write data to the assigned le
end;
end;
end;
//-------------- Opens an existing le and rewrites it
procedure M_Open_File_Rewrite();
begin
lename[7] := ‘C’; // Set lename for single-le tests
Mmc_Fat_Assign(lename, 0);
Mmc_Fat_Rewrite;
for loop := 1 to 55 do
begin
le_contents[0] := byte(loop div 10 + 48);
le_contents[1] := byte(loop mod 10 + 48);
Mmc_Fat_Write(le_contents, 42); // write data to the assigned le
end;