program newtest(indata,outdata,input ,output);
uses crt,dos;
Type
Arraytype = Array[0..1000,1..10] of integer;
Var
J:arraytype;
Ch,current:char;
indata,outdata: text;
some,dely:longint;
ad,xi,xii,data,yo1,coun,x11,count,value,temp1,index,step,Rb7I,X2,
counter,z,b,x1,y1,d1,Row,s,Col,x,y:integer;
flag:boolean;
procedure Delay;
begin
for dely:=0 to 100 do
begin
end;
end;
Procedure chipselL;
begin delay; Port[$379]:=B;delay; end;
Procedure chipselH;
begin delay; Port[$378]:=B;delay; end;
Procedure clockH;
begin delay; Port[$37C]:=B;{ write(' 6H');} delay; end;
Procedure clockL;
begin delay; port[$37D]:=B;{ write(' 6L');} delay; end;
procedure RB7H;
begin delay; port[$37B]:=B;{ Write(' 7H ');}delay; end;
procedure RB7L;
begin delay; port[$37A]:=B;{Write(' 7L ');}delay; end;
Procedure ToRB7;
Begin port[$37E]:=B;delay;delay; end;
Procedure FromRB7;
Begin Port[$37F]:=B;delay;delay; end;
{--------------------------- Main ------------------------}
Begin
toRB7; clockL; {initial conditions}
repeat
Y:=1; ChipselH;
chipselL; {conversion start}
Rb7H;
clockH; {start bit,clk1}
clockL;
clockH; {single/diff}
clockL;
rb7l;
clockH; {D2}
clockL;
clockH; { D1}
clockL;
clockH; {D0}
clockL;
clockH; {t Sample}
clockL;
clockH; {null bit,clk7}
clockL;
fromRB7;
clockH; {Bit9,clk8}
J[Y,1]:= Port[$37F];
clockL;
clockH; {bit8,clk9}
J[Y,2]:= port[$37F];
clockL;
clockH; {bit7,clk10}
J[Y,3]:= Port[$37F];
clockL;
clockH; {bit6,clk11}
J[Y,4]:= port[$37F];
clockL;
clockH; {bit5,clk12}
J[Y,5]:= Port[$37F];
clockL;
clockH; {bit4,clk13}
J[Y,6]:= Port[$37F];
clockL;
clockH; {bit3 ,clk14}
J[Y,7]:= Port[$37F];
clockL;
clockH; {bit2 ,clk15 }
J[Y,8]:= Port[$37F];
clockL;
clockH; {bit1 ,clk16}
J[Y,9]:= Port[$37F];
clockL;
clockH; {bit0 clk17}
J[Y,10]:= Port[$37F];
clockL;
toRB7;
clockH; { clk18}
clockL;
for y:=1 to 10 do begin
write(J[1,y]);
end;
writeln;
Until keypressed;
{end;}
for Y:=1 to 1 do begin
For x:= 1 to 10 do begin
Write(J[y,x]);end;
writeln;
end;
end.