{###########################################################################}

procedure ShiftIn2400;
//holt AD24temp aus LTC2400
begin
  STRAD24:=low;
  AD24temp:=0;
  for j:=0 to 3 do
    SCLK:=high;
    if (j=2) then
      NegativeFlag:=(not SDATAIN1);
    endif;
    if (j=3) then
      OverloadFlag:=SDATAIN1;
    endif;
    SCLK:=low;
  endfor;
  for j:=0 to 23 do
    AD24temp:=AD24temp shl 1;
    if SDATAIN1 then
      AD24temp:=AD24temp or 1;
    endif;
    SCLK:=high;
    nop; nop;
    SCLK:=low;
  endfor;
  for j:=0 to 3 do
    SCLK:=high;
    nop; nop;
    SCLK:=low;
  endfor;
  STRAD24:=high;
  if NegativeFlag then // Clipping
    AD24temp:= 0;
    OverloadFlag:=true;
  endif;
  if OverloadFlag then // Clipping
    AD24temp:= 16777215; // 2^24-1
  endif;
end;

procedure Abort2400;
//fordert neue Wandlung an
begin
  STRAD24:=low;
  nop;
  nop;
  SCLK:=high;
  nop;
  nop;
  SCLK:=low;
end;


