Почему то не работает ЦАП.
Среда разработки: BP 7.0
Обращаюсь как в документации:
const StopCmd = 0;
const AdchanCmd = 1;
const OutdaCmd = 2;
const StreamCmd = 3;
const SoftCmd = 4;
const SampleCmd = 5;
const TtlInCmd = 6;
const TtlOutCmd = 7;
const IrqSimpleCmd = 8;
const IrqAdchanCmd = 9;
const IrqKadrCmd = 10;
const TestCmd = 12;
const DaStreamCmd = 13;
const MemoryStateCmd = 14;
const FilterCmd = 15;
const FltNoLoadCmd = 16;
const SetScaleCmd = 18;
const SetDspSpeedCmd = 20;
const SetWaitStateCmd = 21;
const SetDelayCmd = 22;
const SynchroModeCmd = 23;
const DaConfigCmd = 24;
const ConfigFifoCmd = 25;
const SoftMemoryCmd = 26;
const BA=$340;
procedure OutportW(port : WORD; outp : Word);
begin
asm
mov DX, port
mov AX, outp
out DX, AX
end;
end;
function InportW(port : WORD) : word;
begin
asm
mov DX, port
in AX, DX
mov @Result, AX
end;
end;
procedure SendData(wDATA:word);
begin
OutPortW(BA,wDATA);
repeat
until (InPortW(BA+$c) and $2)<>0;
end;
function GetData:WORD;
begin
repeat
until (InPortW(BA+$c) and $1)<>0;
GetData:=InPortW(BA);
end;
procedure SendCommand(wCOMMAND:WORD);
begin
OutPortW(BA+$8,wCOMMAND);
inPortW(BA);
repeat
until (inPortW(BA+$c) and $2)<>0;
{ asm
mov ax, wCOMMAND
mov dx, BA+$8
out dx, ax
mov dx, BA
in ax, dx
mov dx, BA+$C
@WaitReadLp1:
in ax, dx
test ax, 2
jz @WaitReadLp1
end;}
end;
procedure SummedStream( canal,ampl,period,N:word;
var Buff);
var wArr :array[1..4] of word absolute Buff;
j :word;
begin
canal:=(canal and $f)+(ampl shl 8);
SendCommand(StreamCmd);
SendData(canal);
SendData(period); {in mks}
for j:=1 to N do wArr[j] := GetData;
SendCommand(StopCmd);
end;
procedure SetDAC(iVolt:integer);
begin
SendCommand(OutDaCmd);
SendData(iVolt);
end;
BEGIN
SetDAC(-1000);
write(/'Press ENTER to reset voltage.../');readln;
SetDAC(0);
SendCommand(StopCmd);
END.