
Добавил:
GEN
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:
program ADC_model_fixed_1;
uses crt;
type
o=array[1 .. 100,1 .. 100] of integer;
q=array[1 .. 100] of boolean;
w=array[1 .. 9] of boolean; { 9 - enabled input }
var data : q;
error:o;
in_data :w;
i,j,e,n,x_coor,max,orig,a,s,d,counter:integer;
test1_comp,test3_comp:boolean;
const
t=true;
f=false;
{-----------------------------------------------------------------------}
procedure clear_array;
begin
for i:=1 to 100 do data[i]:=f; {if t then error }
end;
{-----------------------------------------------------------------------}
procedure set_in_data1;
begin
test3_comp:=t;
test1_comp:=f;
in_data[1]:=f;
in_data[2]:=f;
in_data[3]:=f;
in_data[4]:=f;
in_data[5]:=f;
in_data[6]:=f;
in_data[7]:=f;
in_data[8]:=f;
in_data[9]:=f;
end;
{-----------------------------------------------------------------------}
procedure set_in_data2;
begin
test3_comp:=f;
test1_comp:=f;
in_data[1]:=t;
in_data[2]:=f;
in_data[3]:=f;
in_data[4]:=f;
in_data[5]:=f;
in_data[6]:=f;
in_data[7]:=f;
in_data[8]:=f;
in_data[9]:=f;
end;
{-----------------------------------------------------------------------}
procedure set_in_data3;
begin
test3_comp:=f;
test1_comp:=f;
in_data[1]:=t;
in_data[2]:=t;
in_data[3]:=f;
in_data[4]:=f;
in_data[5]:=f;
in_data[6]:=f;
in_data[7]:=f;
in_data[8]:=f;
in_data[9]:=f;
end;
{-----------------------------------------------------------------------}
procedure set_in_data4;
begin
test3_comp:=f;
test1_comp:=f;
in_data[1]:=t;
in_data[2]:=t;
in_data[3]:=t;
in_data[4]:=f;
in_data[5]:=f;
in_data[6]:=f;
in_data[7]:=f;
in_data[8]:=f;
in_data[9]:=f;
end;
{-----------------------------------------------------------------------}
procedure set_in_data5;
begin
test3_comp:=f;
test1_comp:=f;
in_data[1]:=t;
in_data[2]:=t;
in_data[3]:=t;
in_data[4]:=t;
in_data[5]:=f;
in_data[6]:=f;
in_data[7]:=f;
in_data[8]:=f;
in_data[9]:=f;
end;
{-----------------------------------------------------------------------}
procedure set_in_data6;
begin
test3_comp:=f;
test1_comp:=f;
in_data[1]:=t;
in_data[2]:=t;
in_data[3]:=t;
in_data[4]:=t;
in_data[5]:=t;
in_data[6]:=f;
in_data[7]:=f;
in_data[8]:=f;
in_data[9]:=f;
end;
{-----------------------------------------------------------------------}
procedure set_in_data7;
begin
test3_comp:=f;
test1_comp:=f;
in_data[1]:=t;
in_data[2]:=t;
in_data[3]:=t;
in_data[4]:=t;
in_data[5]:=t;
in_data[6]:=t;
in_data[7]:=f;
in_data[8]:=f;
in_data[9]:=f;
end;
{-----------------------------------------------------------------------}
procedure set_in_data8;
begin
test3_comp:=f;
test1_comp:=t;
in_data[1]:=t;
in_data[2]:=t;
in_data[3]:=t;
in_data[4]:=t;
in_data[5]:=t;
in_data[6]:=t;
in_data[7]:=t;
in_data[8]:=f;
in_data[9]:=f;
end;
{-----------------------------------------------------------------------}
procedure set_error;
begin
data[e]:=t;
e:=e+1;
end;
{-----------------------------------------------------------------------}
procedure fixed_false_test;
begin
{first_line}
if data[1]=true then data[1]:=t else
data[1]:=not(in_data[2]);
if data[2]=true then data[2]:=t else
data[2]:=not(in_data[3]);
if data[3]=true then data[3]:=t else
data[3]:=not(in_data[4]);
if data[4]=true then data[4]:=t else
data[4]:=not(in_data[6]);
{second_line}
if data[5]=true then data[5]:=t else
data[5]:=not(in_data[9]);
if data[6]=true then data[6]:=t else
data[6]:=not(in_data[1]);
if data[7]=true then data[7]:=t else
data[7]:=not(data[1]);
if data[8]=true then data[8]:=t else
data[8]:=not(data[2]);
if data[9]=true then data[9]:=t else
data[9]:=not(data[3]);
if data[10]=true then data[10]:=t else
data[10]:=not(in_data[5]);
if data[11]=true then data[11]:=t else
data[11]:=not(data[4]);
if data[12]=true then data[12]:=t else
data[12]:=not(in_data[7]);
{third_line}
if data[13]=true then data[13]:=t else
data[13]:=(data[5] and data [6]);
if data[14]=true then data[14]:=t else
data[14]:=(data[5] and data [1]);
if data[15]=true then data[15]:=t else
data[15]:=(data[5] and data [2]);
if data[16]=true then data[16]:=t else
data[16]:=(data[5] and data [3]);
if data[17]=true then data[17]:=t else
data[17]:=(data[5] and data [7]);
if data[18]=true then data[18]:=t else
data[18]:=(data[10] and data [8]);
if data[19]=true then data[19]:=t else
data[19]:=(data[5] and data [4]);
if data[20]=true then data[20]:=t else
data[20]:=(data[8] and data [9]);
if data[21]=true then data[21]:=t else
data[21]:=(data[5] and data [7]);
if data[22]=true then data[22]:=t else
data[22]:=(data[9] and data [12]);
if data[23]=true then data[23]:=t else
data[23]:=(in_data[1] and in_data[2]);
if data[24]=true then data[24]:=t else
data[24]:=(in_data[3] and in_data[4]);
if data[25]=true then data[25]:=t else
data[25]:=(in_data[5] and in_data[6]);
if data[26]=true then data[26]:=t else
data[26]:=(in_data[7] and in_data[8]);
{fourth_line}
if data[27]=true then data[27]:=t else
data[27]:=(data[7] and data [15]);
if data[28]=true then data[28]:=t else
data[28]:=(data[17] and data [18]);
if data[29]=true then data[29]:=t else
data[29]:=(data[19] and data [20]);
if data[30]=true then data[30]:=t else
data[30]:=(data[21] and data [22]);
if data[31]=true then data[31]:=t else
data[31]:=(data[23] and data [24]);
if data[32]=true then data[32]:=t else
data[32]:=(data[25] and data [26]);
{fifth_line}
if data[33]=true then data[33]:=t else
data[33]:=(data[9] and data [28]);
if data[34]=true then data[34]:=t else
data[34]:=(data[11] and data [30]);
if data[35]=true then data[35]:=t else
data[35]:=(data[31] and data [32]);
{sixth_line}
if data[36]=true then data[36]:=t else
data[36]:=(data[13] and data [14]);
if data[37]=true then data[37]:=t else
data[37]:=(data[16] or data [27]);
if data[38]=true then data[38]:=t else
data[38]:=(data[13] or data [14]);
if data[39]=true then data[39]:=t else
data[39]:=(data[29] or data [33]);
if data[40]=true then data[40]:=t else
data[40]:=(data[27] or data [13]);
if data[41]=true then data[41]:=t else
data[41]:=(data[33] or data [34]);
if data[42]=true then data[42]:=t else
data[42]:=not(data[35] and data [5]);
{seventh_line}
if data[43]=true then data[43]:=t else
data[43]:=not(data[36] or data [37]);
if data[44]=true then data[44]:=t else
data[44]:=not(data[39] or data [38]);
if data[45]=true then data[45]:=t else
data[45]:=not(data[40] or data [41]);
if data[46]=true then data[46]:=t else
data[46]:=not(data[42] and data [5]);
{eight_line}
if data[47]=true then data[47]:=t else
data[47]:=not(data[46]);
{nineth line}
if data[48]=true then data[48]:=t else
data[48]:=(data[46] xor data[42]);
if data[49]=true then data[49]:=t else
data[49]:=(data[46] xor data[42]);
if data[50]=true then data[50]:=t else
data[50]:=not(data[42] and data[47]);
{tenth line}
if data[51]=true then data[51]:=t else
data[51]:=(data[44] and data[45]);
{eleventh line}
if data[52]=true then data[52]:=t else
data[52]:=(data[44] or data[45]);
if data[53]=true then data[53]:=t else
data[53]:=(data[43] or data[52]);
if data[54]=true then data[54]:=t else
data[54]:=(test3_comp and data[53]);
if data[55]=true then data[55]:=t else
data[55]:=not(data[43] and data[51]);
if data[56]=true then data[56]:=t else
data[56]:=(test1_comp and data[55]);
if data[57]=true then data[57]:=t else
data[57]:=(data[48] and data[56]);
if data[58]=true then data[58]:=t else
data[58]:=not(data[49]);
if data[59]=true then data[59]:=t else
data[59]:=(data[50] and data[55]);
if data[60]=true then data[60]:=t else
data[60]:=(data[59] and data[55]);
{writeln ('A2=',data[43],' ','A1=',data[44],' ','A0=',data[45]);
writeln ('Error1=',data[57],' ','Error2=',data[58],
' ','Error3=',data[54],' ','Error4=',data[60]);}
if ((data[57]=t) or (data[58]=t) or (data[54]=t) or (data[60]=t)) then
begin
counter:=counter+1;
error[x_coor,n]:=j;
x_coor:=x_coor+1;
if max<x_coor then max:=x_coor;
end;
end;
{-----------------------------------------------------------------------}
begin
clrscr;
writeln ('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
writeln ('!! ЂЈ Ґў Ђ«ҐЄбҐ© ђ-682 !!');
writeln ('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
writeln ('#########################################################');
writeln ('#* Џ®¤бз%в Є®«ЁзҐбвў ҐЁбЇа ў®б⥩ , ®ЇаҐ¤Ґ«пҐ¬ле *#');
writeln ('#* бЁб⥬®© б ¬®Є®ва®«п Ђ–Џ *#');
writeln ('#*******************************************************#');
writeln ('#* ‚Ё¤ ҐЁбЇа ў®бвЁ : ®¤Ё®з п , дЁЄб жЁп 1 *#');
writeln ('#*******************************************************#');
writeln;
writeln ('ЋЎ а㦥® ҐЁбЇа ў®б⥩ : 43 Ё§ 60 (71.6%)');
writeln;
max:=1;
e:=1;
counter:=0;
n:=1;
x_coor:=1;
for j:=1 to 60 do
begin
clear_array;
set_error;
set_in_data1;
fixed_false_test;
end;
{ writeln(counter);}
e:=1;
n:=2;
x_coor:=1;
for j:=1 to 60 do
begin
clear_array;
set_error;
set_in_data2;
fixed_false_test;
end;
e:=1;
n:=3;
x_coor:=1;
for j:=1 to 60 do
begin
clear_array;
set_error;
set_in_data3;
fixed_false_test;
end;
e:=1;
n:=4;
x_coor:=1;
for j:=1 to 60 do
begin
clear_array;
set_error;
set_in_data4;
fixed_false_test;
end;
e:=1;
n:=5;
x_coor:=1;
for j:=1 to 60 do
begin
clear_array;
set_error;
set_in_data5;
fixed_false_test;
end;
e:=1;
n:=6;
x_coor:=1;
for j:=1 to 60 do
begin
clear_array;
set_error;
set_in_data6;
fixed_false_test;
end;
e:=1;
n:=7;
x_coor:=1;
for j:=1 to 60 do
begin
clear_array;
set_error;
set_in_data7;
fixed_false_test;
end;
e:=1;
n:=8;
x_coor:=1;
for j:=1 to 60 do
begin
clear_array;
set_error;
set_in_data8;
fixed_false_test;
end;
for i:=1 to 8 do
begin
write('‚室®© Ў®а ',i,' ');
for j:=1 to max-1 do
begin
if error[j,i]<>0 then
if error[j,i]<10 then write(' ',error[j,i]) else write(' ',error[j,i])
end;
writeln('');
end;
end.
uses crt;
type
o=array[1 .. 100,1 .. 100] of integer;
q=array[1 .. 100] of boolean;
w=array[1 .. 9] of boolean; { 9 - enabled input }
var data : q;
error:o;
in_data :w;
i,j,e,n,x_coor,max,orig,a,s,d,counter:integer;
test1_comp,test3_comp:boolean;
const
t=true;
f=false;
{-----------------------------------------------------------------------}
procedure clear_array;
begin
for i:=1 to 100 do data[i]:=f; {if t then error }
end;
{-----------------------------------------------------------------------}
procedure set_in_data1;
begin
test3_comp:=t;
test1_comp:=f;
in_data[1]:=f;
in_data[2]:=f;
in_data[3]:=f;
in_data[4]:=f;
in_data[5]:=f;
in_data[6]:=f;
in_data[7]:=f;
in_data[8]:=f;
in_data[9]:=f;
end;
{-----------------------------------------------------------------------}
procedure set_in_data2;
begin
test3_comp:=f;
test1_comp:=f;
in_data[1]:=t;
in_data[2]:=f;
in_data[3]:=f;
in_data[4]:=f;
in_data[5]:=f;
in_data[6]:=f;
in_data[7]:=f;
in_data[8]:=f;
in_data[9]:=f;
end;
{-----------------------------------------------------------------------}
procedure set_in_data3;
begin
test3_comp:=f;
test1_comp:=f;
in_data[1]:=t;
in_data[2]:=t;
in_data[3]:=f;
in_data[4]:=f;
in_data[5]:=f;
in_data[6]:=f;
in_data[7]:=f;
in_data[8]:=f;
in_data[9]:=f;
end;
{-----------------------------------------------------------------------}
procedure set_in_data4;
begin
test3_comp:=f;
test1_comp:=f;
in_data[1]:=t;
in_data[2]:=t;
in_data[3]:=t;
in_data[4]:=f;
in_data[5]:=f;
in_data[6]:=f;
in_data[7]:=f;
in_data[8]:=f;
in_data[9]:=f;
end;
{-----------------------------------------------------------------------}
procedure set_in_data5;
begin
test3_comp:=f;
test1_comp:=f;
in_data[1]:=t;
in_data[2]:=t;
in_data[3]:=t;
in_data[4]:=t;
in_data[5]:=f;
in_data[6]:=f;
in_data[7]:=f;
in_data[8]:=f;
in_data[9]:=f;
end;
{-----------------------------------------------------------------------}
procedure set_in_data6;
begin
test3_comp:=f;
test1_comp:=f;
in_data[1]:=t;
in_data[2]:=t;
in_data[3]:=t;
in_data[4]:=t;
in_data[5]:=t;
in_data[6]:=f;
in_data[7]:=f;
in_data[8]:=f;
in_data[9]:=f;
end;
{-----------------------------------------------------------------------}
procedure set_in_data7;
begin
test3_comp:=f;
test1_comp:=f;
in_data[1]:=t;
in_data[2]:=t;
in_data[3]:=t;
in_data[4]:=t;
in_data[5]:=t;
in_data[6]:=t;
in_data[7]:=f;
in_data[8]:=f;
in_data[9]:=f;
end;
{-----------------------------------------------------------------------}
procedure set_in_data8;
begin
test3_comp:=f;
test1_comp:=t;
in_data[1]:=t;
in_data[2]:=t;
in_data[3]:=t;
in_data[4]:=t;
in_data[5]:=t;
in_data[6]:=t;
in_data[7]:=t;
in_data[8]:=f;
in_data[9]:=f;
end;
{-----------------------------------------------------------------------}
procedure set_error;
begin
data[e]:=t;
e:=e+1;
end;
{-----------------------------------------------------------------------}
procedure fixed_false_test;
begin
{first_line}
if data[1]=true then data[1]:=t else
data[1]:=not(in_data[2]);
if data[2]=true then data[2]:=t else
data[2]:=not(in_data[3]);
if data[3]=true then data[3]:=t else
data[3]:=not(in_data[4]);
if data[4]=true then data[4]:=t else
data[4]:=not(in_data[6]);
{second_line}
if data[5]=true then data[5]:=t else
data[5]:=not(in_data[9]);
if data[6]=true then data[6]:=t else
data[6]:=not(in_data[1]);
if data[7]=true then data[7]:=t else
data[7]:=not(data[1]);
if data[8]=true then data[8]:=t else
data[8]:=not(data[2]);
if data[9]=true then data[9]:=t else
data[9]:=not(data[3]);
if data[10]=true then data[10]:=t else
data[10]:=not(in_data[5]);
if data[11]=true then data[11]:=t else
data[11]:=not(data[4]);
if data[12]=true then data[12]:=t else
data[12]:=not(in_data[7]);
{third_line}
if data[13]=true then data[13]:=t else
data[13]:=(data[5] and data [6]);
if data[14]=true then data[14]:=t else
data[14]:=(data[5] and data [1]);
if data[15]=true then data[15]:=t else
data[15]:=(data[5] and data [2]);
if data[16]=true then data[16]:=t else
data[16]:=(data[5] and data [3]);
if data[17]=true then data[17]:=t else
data[17]:=(data[5] and data [7]);
if data[18]=true then data[18]:=t else
data[18]:=(data[10] and data [8]);
if data[19]=true then data[19]:=t else
data[19]:=(data[5] and data [4]);
if data[20]=true then data[20]:=t else
data[20]:=(data[8] and data [9]);
if data[21]=true then data[21]:=t else
data[21]:=(data[5] and data [7]);
if data[22]=true then data[22]:=t else
data[22]:=(data[9] and data [12]);
if data[23]=true then data[23]:=t else
data[23]:=(in_data[1] and in_data[2]);
if data[24]=true then data[24]:=t else
data[24]:=(in_data[3] and in_data[4]);
if data[25]=true then data[25]:=t else
data[25]:=(in_data[5] and in_data[6]);
if data[26]=true then data[26]:=t else
data[26]:=(in_data[7] and in_data[8]);
{fourth_line}
if data[27]=true then data[27]:=t else
data[27]:=(data[7] and data [15]);
if data[28]=true then data[28]:=t else
data[28]:=(data[17] and data [18]);
if data[29]=true then data[29]:=t else
data[29]:=(data[19] and data [20]);
if data[30]=true then data[30]:=t else
data[30]:=(data[21] and data [22]);
if data[31]=true then data[31]:=t else
data[31]:=(data[23] and data [24]);
if data[32]=true then data[32]:=t else
data[32]:=(data[25] and data [26]);
{fifth_line}
if data[33]=true then data[33]:=t else
data[33]:=(data[9] and data [28]);
if data[34]=true then data[34]:=t else
data[34]:=(data[11] and data [30]);
if data[35]=true then data[35]:=t else
data[35]:=(data[31] and data [32]);
{sixth_line}
if data[36]=true then data[36]:=t else
data[36]:=(data[13] and data [14]);
if data[37]=true then data[37]:=t else
data[37]:=(data[16] or data [27]);
if data[38]=true then data[38]:=t else
data[38]:=(data[13] or data [14]);
if data[39]=true then data[39]:=t else
data[39]:=(data[29] or data [33]);
if data[40]=true then data[40]:=t else
data[40]:=(data[27] or data [13]);
if data[41]=true then data[41]:=t else
data[41]:=(data[33] or data [34]);
if data[42]=true then data[42]:=t else
data[42]:=not(data[35] and data [5]);
{seventh_line}
if data[43]=true then data[43]:=t else
data[43]:=not(data[36] or data [37]);
if data[44]=true then data[44]:=t else
data[44]:=not(data[39] or data [38]);
if data[45]=true then data[45]:=t else
data[45]:=not(data[40] or data [41]);
if data[46]=true then data[46]:=t else
data[46]:=not(data[42] and data [5]);
{eight_line}
if data[47]=true then data[47]:=t else
data[47]:=not(data[46]);
{nineth line}
if data[48]=true then data[48]:=t else
data[48]:=(data[46] xor data[42]);
if data[49]=true then data[49]:=t else
data[49]:=(data[46] xor data[42]);
if data[50]=true then data[50]:=t else
data[50]:=not(data[42] and data[47]);
{tenth line}
if data[51]=true then data[51]:=t else
data[51]:=(data[44] and data[45]);
{eleventh line}
if data[52]=true then data[52]:=t else
data[52]:=(data[44] or data[45]);
if data[53]=true then data[53]:=t else
data[53]:=(data[43] or data[52]);
if data[54]=true then data[54]:=t else
data[54]:=(test3_comp and data[53]);
if data[55]=true then data[55]:=t else
data[55]:=not(data[43] and data[51]);
if data[56]=true then data[56]:=t else
data[56]:=(test1_comp and data[55]);
if data[57]=true then data[57]:=t else
data[57]:=(data[48] and data[56]);
if data[58]=true then data[58]:=t else
data[58]:=not(data[49]);
if data[59]=true then data[59]:=t else
data[59]:=(data[50] and data[55]);
if data[60]=true then data[60]:=t else
data[60]:=(data[59] and data[55]);
{writeln ('A2=',data[43],' ','A1=',data[44],' ','A0=',data[45]);
writeln ('Error1=',data[57],' ','Error2=',data[58],
' ','Error3=',data[54],' ','Error4=',data[60]);}
if ((data[57]=t) or (data[58]=t) or (data[54]=t) or (data[60]=t)) then
begin
counter:=counter+1;
error[x_coor,n]:=j;
x_coor:=x_coor+1;
if max<x_coor then max:=x_coor;
end;
end;
{-----------------------------------------------------------------------}
begin
clrscr;
writeln ('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
writeln ('!! ЂЈ Ґў Ђ«ҐЄбҐ© ђ-682 !!');
writeln ('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
writeln ('#########################################################');
writeln ('#* Џ®¤бз%в Є®«ЁзҐбвў ҐЁбЇа ў®б⥩ , ®ЇаҐ¤Ґ«пҐ¬ле *#');
writeln ('#* бЁб⥬®© б ¬®Є®ва®«п Ђ–Џ *#');
writeln ('#*******************************************************#');
writeln ('#* ‚Ё¤ ҐЁбЇа ў®бвЁ : ®¤Ё®з п , дЁЄб жЁп 1 *#');
writeln ('#*******************************************************#');
writeln;
writeln ('ЋЎ а㦥® ҐЁбЇа ў®б⥩ : 43 Ё§ 60 (71.6%)');
writeln;
max:=1;
e:=1;
counter:=0;
n:=1;
x_coor:=1;
for j:=1 to 60 do
begin
clear_array;
set_error;
set_in_data1;
fixed_false_test;
end;
{ writeln(counter);}
e:=1;
n:=2;
x_coor:=1;
for j:=1 to 60 do
begin
clear_array;
set_error;
set_in_data2;
fixed_false_test;
end;
e:=1;
n:=3;
x_coor:=1;
for j:=1 to 60 do
begin
clear_array;
set_error;
set_in_data3;
fixed_false_test;
end;
e:=1;
n:=4;
x_coor:=1;
for j:=1 to 60 do
begin
clear_array;
set_error;
set_in_data4;
fixed_false_test;
end;
e:=1;
n:=5;
x_coor:=1;
for j:=1 to 60 do
begin
clear_array;
set_error;
set_in_data5;
fixed_false_test;
end;
e:=1;
n:=6;
x_coor:=1;
for j:=1 to 60 do
begin
clear_array;
set_error;
set_in_data6;
fixed_false_test;
end;
e:=1;
n:=7;
x_coor:=1;
for j:=1 to 60 do
begin
clear_array;
set_error;
set_in_data7;
fixed_false_test;
end;
e:=1;
n:=8;
x_coor:=1;
for j:=1 to 60 do
begin
clear_array;
set_error;
set_in_data8;
fixed_false_test;
end;
for i:=1 to 8 do
begin
write('‚室®© Ў®а ',i,' ');
for j:=1 to max-1 do
begin
if error[j,i]<>0 then
if error[j,i]<10 then write(' ',error[j,i]) else write(' ',error[j,i])
end;
writeln('');
end;
end.
Соседние файлы в папке Разработка системы самоконтроля аналого-цифрового преобразователя