124996 (593050), страница 13
Текст из файла (страница 13)
Procedure ProgramLeft(SoundOn : boolean);
Procedure Speedgraph1Reset(SoundOn : boolean);
Procedure Speedgraph2Reset(SoundOn : boolean);
Procedure Speedgraph3Reset( SoundOn : boolean);
var NNN : byte;
implementation
function Init_port : boolean; begin
port[$103]:=$92;
Init_port := true; end; {Init_port}
function Start_measurements : boolean; begin
Start_measurements:=false;
repeat
delay(10);
if keypressed then if readkey=#27 then exit;
until (port[$101] and $08)=$08;
repeat
delay(10);
if keypressed then if readkey=#27 then exit;
until (port[$101] and $08)=$00;
repeat
delay(5);
if keypressed then if readkey=#27 then exit;
until (port[$101] and $08)=$08;
Start_measurements := true; end; {Start_measurements}
function Strobe_imp : boolean; begin
Strobe_imp := false;
if (port[$101] and $08)=$00 then exit;
if (port[$101] and $08)=$08 then
repeat
delay(10);
until ( port[$101] and $08 = $00 ) or KeyPressed;
Strobe_imp := true; end; {Strobe_imp}
Procedure ProgramRight(SoundOn : boolean); begin
if SoundOn then sound(3500);
port[$102] := $11;
delay(30);
nosound;
port[$102] := $01;
delay(30);
inc(NNN); end; {ProgramRight}
Procedure ProgramLeft(SoundOn : boolean); begin
if SoundOn then sound(4500);
port[$102] := $21;
delay(30);
nosound;
port[$102] := $01;
delay(130);
if NNN > 0 then dec(NNN); end; {ProgramLeft}
Procedure NextECGMode( SoundOn : boolean );
begin
if SoundOn then sound(6000);
port[$102] := $11; {вкл}
delay(15);
nosound;
port[$102] := $01; {выкл}
delay(500);
inc(NNN); if NNN > 4 then NNN := NNN-5; end; {NextECGMode}
Procedure Speedgraph1Reset( SoundOn : boolean ); begin
if NNN <> 0 then
repeat
NextECGMode( SoundOn );
until NNN = 0; end;
Procedure Speedgraph2Reset(SoundOn : boolean); var i : byte; begin
for i := 1 to 6 do ProgramLeft(SoundOn); end;
Procedure Speedgraph3Reset( SoundOn : boolean );
begin
if NNN <> 1 then
repeat
NextECGMode( SoundOn );
until NNN = 1; end; {Speedgraph3Reset}
function ACP( num_channel : byte; DelayVarComm : word) : word; var my_word, i : word;
ErrCount : word;
masc : byte; begin {$IFNDEF FullRegime}
for ErrCount :=1 to DelayVarComm do;
ACP := random(10 * num_channel ); exit; {$ENDIF}
ErrCount := 0; ACP := 512;
port[$102]:=$01 or ( $07 shl 1 ); { снять пуск АЦП }
repeat
inc(ErrCount);
until ( port[$101] and $04 = $04 ) or ( ErrCount > 1000 ) or KeyPressed;
if num_channel > 6 then begin
masc := $80; dec(num_channel,7);
end else begin masc := 00; dec(num_channel,0); end;
port[$102]:= $01 or ( num_channel shl 1 ) or masc;
for ErrCount :=1 to DelayVarComm do;
port[$102]:= $00 or ( num_channel shl 1 ) or masc;
ErrCount := 0;
repeat
inc(ErrCount);
until ( port[$101] and $04 = $00 ) or ( ErrCount > 1000 ) or KeyPressed;
ACP := port[$100]+$100*(port[$101] and $03); end; {ACP}
(* function ACP(num_channel : byte; DelayVarComm : word) : word; var my_word, i , ErrCount : word;
ACP0, ACP1 : integer; begin
ErrCount := 0; ACP := 512;
if num_channel = 12 then num_channel := $07 else
if num_channel > 6 then begin
num_channel := ((num_channel - 6) shl 3) or $06;
end;
num_channel := num_channel shl 2;
port[$102]:=$01 or $07;
repeat
inc(ErrCount);
until ( port[$101] and $04 = $04 ) or ( ErrCount > 1000 ) or KeyPressed;
port[$102]:= $01 or num_channel;
for ErrCount :=1 to DelayVarComm do;
port[$102]:= $00 or num_channel; ErrCount := 0;
repeat
inc(ErrCount);
until(port[$101]and $04=$00)or (ErrCount>1000)or KeyPressed;
ACP0 := port[$100]+$100*(port[$101] and $03);
port[$102]:=$03 or $07;
repeat
inc(ErrCount);
until ( port[$101] and $04 = $04 ) or ( ErrCount > 1000 ) or KeyPressed;
port[$102]:= $03 or num_channel;
for ErrCount :=1 to DelayVarComm do;
port[$102]:= $02 or num_channel;
ErrCount := 0;
repeat
inc(ErrCount);
until (port[$101]and $04=$00)or(ErrCount>1000)or KeyPressed;
ACP1 := port[$100]+$100*(port[$101] and $03); { ACP := ((ACP0-ACP1+512) shr 1);
ACP := 1024-ACP1; end; } begin NNN := 0;
for Index := 1 to NumDeriv do
begin
gotoxy(1, wherey); write(Index);
Location := 1;
for Term := 1 to NumPoints-1 do
if XDeriv[Index] > XData[Term] then Location := Term;
X := XDeriv[Index] - XData[Location];
with Spline do { Approximate first derivative }
YDeriv[Index]:=(3*D[Location]*X+2*C[Location])*X+ B[Location];
end; end;
end.















