Hi
I tried but I didn't found a good solution.
The asynchronous solution doesn't work right for me since (it does what it means to do) it waits til the recording finish then writes 10 files with the same (last) data, instead of 10 files in parallel with the recording on a second core.
Follows a simplified code, maybe one of you can help me find a solution:
Var
DataArray: Array of Array of Array of Word;
evenodd:Integer;
fileNumber:Integer;
TotalLines:Integer;
procedure Save(totalLines)
Var s:String;
T:Text;
i:Integer;
begin
inc(fileNumber);
s:=IntToString(fileNumber)+'.txt';
AssignFile(T,s);
Rewrite(T);
for i:=0 to totalLines do begin
s:='';
for j:=0 to 10 do
s:=ConvertDatatoText(DataArray[evenodd,i,j];
end;
WriteLn(T,s);
CloseFile(T);
end;
procedure RecordHardware;
Var
i,line:Integer;
begin
setlength DataArray(2,1000000,11);
repeat
for i:=0 to do
DataArray[evenodd,line,i]:=readHW(i);
inc(line);
if line>=TotalLines then begin
change(evenodd);
Save(line); //<----------- This should be done on a separate thread without slowing the Hardware reading
// (on a separated core - there are 4 cores on Raspberry Pi 3B+)
line:=0;
end;
until HardwareStop;
end;
Can someone help me?