ðåôåðàòû
Ãëàâíàÿ

Ðåôåðàòû ïî ðåêëàìå

Ðåôåðàòû ïî ôèçèêå

Ðåôåðàòû ïî ôèëîñîôèè

Ðåôåðàòû ïî ôèíàíñàì

Ðåôåðàòû ïî õèìèè

Ðåôåðàòû ïî õîçÿéñòâåííîìó ïðàâó

Ðåôåðàòû ïî öèôðîâûì óñòðîéñòâàì

Ðåôåðàòû ïî ýêîëîãè÷åñêîìó ïðàâó

Ðåôåðàòû ïî ýêîíîìèêî-ìàòåìàòè÷åñêîìó ìîäåëèðîâàíèþ

Ðåôåðàòû ïî ýêîíîìè÷åñêîé ãåîãðàôèè

Ðåôåðàòû ïî ýêîíîìè÷åñêîé òåîðèè

Ðåôåðàòû ïî ýòèêå

Ðåôåðàòû ïî þðèñïðóäåíöèè

Ðåôåðàòû ïî ÿçûêîâåäåíèþ

Ðåôåðàòû ïî þðèäè÷åñêèì íàóêàì

Ðåôåðàòû ïî èñòîðèè

Ðåôåðàòû ïî êîìïüþòåðíûì íàóêàì

Ðåôåðàòû ïî ìåäèöèíñêèì íàóêàì

Ðåôåðàòû ïî ôèíàíñîâûì íàóêàì

Ðåôåðàòû ïî óïðàâëåí÷åñêèì íàóêàì

Ïñèõîëîãèÿ è ïåäàãîãèêà

Ïðîìûøëåííîñòü ïðîèçâîäñòâî

Áèîëîãèÿ è õèìèÿ

ßçûêîçíàíèå ôèëîëîãèÿ

Èçäàòåëüñêîå äåëî è ïîëèãðàôèÿ

Ðåôåðàòû ïî êðàåâåäåíèþ è ýòíîãðàôèè

Ðåôåðàòû ïî ðåëèãèè è ìèôîëîãèè

Ðåôåðàòû ïî ìåäèöèíå

Ðåôåðàòû ïî ñåêñîëîãèè

Ðåôåðàòû ïî èíôîðìàòèêå ïðîãðàììèðîâàíèþ

Êðàòêîå ñîäåðæàíèå ïðîèçâåäåíèé

Ðåôåðàò: Êîäîâûå êîìáèíàöèè íà îñíîâå öèêëè÷åñêèõ êîäîâ

Ðåôåðàò: Êîäîâûå êîìáèíàöèè íà îñíîâå öèêëè÷åñêèõ êîäîâ

                                                   ÀÍÍÎÒÀÖÈß

        Äîêóìåíò ñîäåðæèò îïèñàíèå ïðîãðàììû, êîòîðàÿ ñòðîèò  êîäîâûå êîìáèíàöèè íà îñíîâå öèêëè÷åñêèõ êîäîâ. Ïðîãðàììà êîäèðóåò è äåêî-äèðóåò  èíôîðìàöèîííûå ñëîâà. Èììèòèðóåòñÿ ðàáîòà èñòî÷íèêà, ïåðåäà-þùåãî èíôîðìàöèîííîå ñëîâî, êîäèðîâùèêà, êîäèðóþùåãî äàííîå ñëîâî, êàíàëà ñâÿçè è äåêîäèðîâùèêà, îáíàðóæèâàþùåãî è èñïðàâëÿþùåãî îøèáêè â èíôîðìàöèîííîì ïîëèíîìå. Ïðîãðàììà ðàáîòàåò ïî ïðèíöèïó ïðè¸ìíèê – èñòî÷íèê, òàê ,êàê ýòî ðåàëèçîâàíî â óñòðîéñòâàõ, ïåðåäàþùèõ èíôîðìàöèþ èëè îáûêíîâåííûõ ïðèâîäàõ äëÿ âíåøíèõ íîñèòåëåé â PC.

ÑÎÄÅÐÆÀÍÈÅ

1. Ââåäåíèå ........................................................................................... 6

2. Ïîñòàíîâêà çàäà÷è .......................................................................... 7

3. Îïåðàöèè íàä öèêëè÷åñêèìè êîäàìè ............................................. 8

4. Ïðèíöèï ïîñòðîåíèÿ öèêëè÷åñêèõ êîäîâ ....................................... 9

4.1. Ïîëó÷åíèå êîäîâîé êîìáèíàöèè äîáàâëåíèåì îñòàòêà R(x) ...... 11

4.2. Ïîëó÷åíèå êîäîâîé êîìáèíàöèè óìíîæåíèåì íà îáðàçóþùèé

       ïîëèíîì .......................................................................................... 14

5. Ðàçðàáîòêà ñõåìû àëãîðèòìà ........................................................... 15

6. Ðàçðàáîòêà òåêñòà ïðîãðàììû ......................................................... 16

7. Ðåçóëüòàòû ðàáîòû ïðîãðàììû ....................................................... 21

----------------------------------------------------------------------------------------------------

 Ëèòåðàòóðà ........................................................................................   23

 Ïðèëîæåíèå ¹ 1 ...............................................................................   24

 Ïðèëîæåíèå ¹ 2 ...............................................................................   30   


§ 1 Ââåäåíèå

Êîä ,â êîòîðîì êîäîâàÿ êîìáèíàöèÿ, ïîëó÷åííàÿ ïóòåì öèêëè÷åñêîãî ñäâèãà ðàçðåøåííîé êîäîâîé êîìáèíàöèè ÿâëÿåòñÿ òàêæå ðàçðåøåííîé êîäîâîé êîìáèíàöèåé íàçûâàåòñÿ öèêëè÷åñêèì ( ïîëèíîìèàëüíûì, êîäîì ñ öèêëè÷åñêèìè èçáûòî÷íûìè ïðîâåðêàìè-ÖÈÏ).

Ñäâèã îñóùåñòâëÿåòñÿ ñïðàâà íàëåâî, ïðè ýòîì êðàéíèé ëåâûé ñèìâîë ïåðåíîñèòñÿ â êîíåö êîìáèíàöèè.

 Öèêëè÷åñêèé êîä îòíîñèòñÿ ê ëèíåéíûì,  áëî÷íûì, êîððåêòèðóþùèì, ðàâíîìåðíûì êîäàì.

  öèêëè÷åñêèõ êîäàõ êîäîâûå êîìáèíàöèè ïðåäñòàâëÿþòñÿ â âèäå ìíîãî÷ëåíîâ, ÷òî ïîçâîëÿåò ïîçâîëÿåò ñâåñòè äåéñòâèÿ íàä êîäîâûìè êîìáèíàöèÿìè  ê  äåéñòâèåì  íàä ìíîãî÷ëåíàìè (èñïîëüçóÿ àïïàðàò ïîëèíîìèàëüíîé àëãåáðû).

Öèêëè÷åñêèå êîäû ÿâëÿþòñÿ ðàçíîâèäíîñòüþ ñèñòåìàòè÷åñêèõ êîäîâ

è ïîýòîìó îáëàäàþò âñåìè èõ ñâîéñòâàìè. Ïåðâîíà÷àëüíî îíè áûëè ñîçäàíû äëÿ óïðîùåíèÿ ñõåì êîäèðîâàíèÿ è äåêîäèðîâàíèÿ. Èõ ýôôåê-

òèâíîñòü ïðè îáíàðóæåíèè è èñïðàâëåíèè îøèáîê îáåñïå÷èëà èì øèðîåîå ïðèìåíåíèå íà ïðàêòèêå.

Öèêëè÷åñêèå êîäû  èñïîëüçóþòñÿ â ÝÂÌ ïðè ïîñëåäîâàòåëüíîé ïåðåäà÷å äàííûõ .

§ 2 Ïîñòàíîâêà çàäà÷è

Ïîñòðîèòü öèêëè÷åñêèé êîä äëÿ ïåðåäà÷è 31 ðàçðÿäíîé êîäîâîé êîìáèíàöèè ñ èñïðàâëåíèåì îäíîêðàòíîé îøèáêè ( n=31 ,s=1) äâóìÿ

ñïîñîáàìè.

Ïîêàçàòü ïðîöåññ îáíàðóæåíèÿ è èñïðàâëåíèÿ îäíîêðàòíîé îøèáêè â ïåðåäàâàåìîé êîäîâîé êîìáèíàöèè. Ñîñòàâèòü ïðîãðàììó, ðåàëèçóþùóþ àëãîðèòì êîäèðîâàíèÿ, äåêîäèðîâàíèÿ è èñïðàâëåíèÿ îøèáêè ïðè ïåðåäà÷å äàííûõ ñ èñïîëüçîâàíèåì öèêëè÷åñêîãî êîäà.


§ 3 Îïåðàöèè íàä öèêëè÷åñêèìè êîäàìè

     1. Ñäâèã ñïðàâà íàëåâî îñóùåñòâëÿåòñÿ ïóòåì óìíîæåíèÿ ïîëèíîìà íà x:

                     G(x)=x4+x2+1  Û 0010101;

                     G(x)×x=x5+x3+x Û 0101010.

     2. Îïåðàöèè ñëîæåíèÿ è âû÷èòàíèÿ âûïîëíÿþòñÿ ïî ìîäóëþ 2 .

Îíè  ÿâëÿþòñÿ ýêâèâàëåíòíèìè è  àññîöèàòèâíûìè :     

                     G1(x)+G2(x)=>G3(x);

                     G1(x) -G2(x)=>G3(x);

                     G2(x)+G1(x)=>G3(x);

Ïðèìåð:

              G1(x)= x5 +x3+x;

              G2(x)=x4 +x3 +1;          

              G3(x)=G1(x) Å G2(x) = x5 +x4+x+1.                              

       3. Îïåðàöèÿ äåëåíèÿ ÿâëÿåòñÿ îáû÷íûì äåëåíèåì ìíîãî÷ëåíîâ, òîëüêî âìåñòî âû÷èòàíèÿ  èñïîëüçóåòñÿ ñëîæåíîå ïî ìîäóëþ 2 :

         G1(x)=x6+x4+x3 ;          

         G2(x)=x3+x2+1  .

 


                   x6+x4+x3                 x3+x2+1

                Å x6+x5+x3                          x3 +x2

                            x5 + x4

                    Å   x5 + x4 +x2

                                     x2

òî æå â äâîè÷íîì êîäå:

                   

        1011000            1101                               

     Å1101                  1100                               

          1100                                            

       Å 1101                                     

            100                                      

        Âñå îïåðàöèè ëåãêî ðåàëèçóþòñÿ àïïàðàòíî íà ðåãèñòðàõ ñäâèãà ñ îáðàòíûìè ñâÿçÿì.


§ 4 Ïðèíöèï ïîñòðîåíèÿ öèêëè÷åñêèõ êîäîâ

Èäåÿ ïîñòðîåíèÿ öèêëè÷åñêèõ êîäîâ áàçèðóåòñÿ íà èñïîëüçîâàíèè íåïðèâîäèìûõ ìíîãî÷ëåíîâ. Íåïðèâîäèìûì íàçûâàåòñÿ ìíîãî-÷ëåí,êîòîðûé íå ìîæåò áÿòü ïðåäñòàâëåí â âèäå ïðîèçâåäåíèÿ ìíîãî÷ëåíîâ íèçøèõ ñòåïåíåé ,ò.å. òàêîé ìíîãî÷ëåí äåëèòüñÿ òîëüêî íà ñàìîãî ñåáÿ èëè íà åäèíèöó è íå äåëèòüñÿ íè íà êàêîé äðóãîé ìíîãî÷ëåí.  Íà òàêîé ìíîãî÷ëåí äåëèòüñÿ áåç îñòàòêà äâó÷ëåí xn+1.Íåïðèâîäèìûå ìíîãî÷ëåíû â òåîðèè öèêëè÷åñêèõ êîäîâ èãðàþò ðîëü îáðàçóþùèõ ïîëèíîìîâ.

×òîáû ïîíÿòü ïðèíöèï ïîñòðîåíèÿ öèêëè÷åñêîãî êîäà,óìíîæàåì êîìáèíàöèþ ïðîñòîãî k-çíà÷íîãî êîäà Q(x) íà  îäíî÷ëåí xr ,à çàòåì äåëèíà îáðàçóþùèé ïîëèíîì P(x) , ñòåïåíü êîòîðîãî ðàâíà r.  ðåçóëüòàòå óìíîæåíèÿ Q(x) íà xr ñòåïåíü êàæäîãî îäíî÷ëåíà, âõîäÿùåãî â Q(x), ïîâû-øàåòñÿ íà r. Ïðè äåëåíèè ïðîèçâåäåíèÿ xrQ(x) íà îáðàçóþùèé ïîëèíîì ïîëó÷àåòñÿ ÷àñòíîå C(x) òàêîé æå ñòåïåíè, êàê è Q(x).Ðåçóëüòàò ìîæíî ïðåäñòàâèòü â âèä

                    Q(x) xr                     R(x)                                                                                                                                                                                                                                                                            

                   ¾¾¾¾ =   C(x) + ¾¾¾   ,               (1)                                                                             

                      P(x)                        P(x)

ãäå R(x) - îñòàòîê îò äåëåíèÿ  Q(x) xr íà P(x).

×àñòíîå C(x) èìååò òàêóþ æå ñòåïåíü, êàê è êîäîâàÿ êîìáèíàöèÿ Q(x) ïðîñòîãî êîäà, ïîýòîìó C(x) ÿâëÿåòñÿ êîäîâîé êîìáèíàöèåé ýòîãî æå

ïîñòîãî k-çíà÷íîãî êîäà. Ñëåäóåò çàìåòèòü,÷òî ñòåïåíü îñòàòêà íå ìîæåò áûòü áîëüøå ñòåïåíè îáðàçóþùåãî ïîëèíîìà, ò.å. åãî íàèâûñøàÿ ñòåïåíü ìîæåò áûòü ðàâíà (r-1). Ñëåäîâàòåëüíî, íàèáîëüøåå ÷èñëî ðàçðÿäîâ îñòàòêà R(x) íå ïðåâûøàåò ÷èñëà r.    

Óìíîæàÿ îáå ÷àñòè ðàâåíñòâà (1) íà P(x) è ïðîèçâåäÿ íåêîòîðûå ïåðåñòàíîâêè ïîëó÷àåì :

                       F(x) = C(x) P(x) = Q(x) xr + R(x)               (2)

Òàêèì îáðàçîì, êîäîâàÿ êîìáèíàöèÿ öèêëè÷åñêîãî n-çíà÷íîãî êîäà ìîæåò

áûòü ïîëó÷åíà  äâóìÿ ñïîñîáàìè:

 1) óìíîæåíèå êîäîâîé êîìáèíàöèè Q(x) ïðîñòîãî êîäà íà îäíî÷ëåí xr

è äîáàâëåíèå ê ýòîìó ïðîèçâåäåíèþ îñòàòêà R(x) , ïîëó÷åííîãî â ðåçóëüòàòå äåëåíèÿ ïðîèçâåäåíèÿ Q(x) xr íà îáðàçóþùèé ïîëèíîì P(x);

2) óìíîæåíèÿ êîäîâîé êîìáèíàöèè C(x) ïðîñòîãî k-çíà÷íîãî íà îáðàçóþùèé ïîëèíîì P(x).

 Ïðè ïîñòðîåíèè öèêëè÷åñêèõ êîäîâ ïåðâûì ñïîñîáîì ðàñðîëîæåíèå èíôîðìàöèîííûõ ñèìâîëîâ âî âñåõ êîìáèíàöèÿõ ñòðîãî óïîðÿäî÷åíî -

îíè çàíèìàþò k ñòàðøèõ ðàçðÿäîâ êîìáèíàöèè, à îñòàëüíûå (n-k) ðàçðÿäîâ

 îòâîäÿòñÿ ïîä êîíòðîëüíûå.

Ïðè âòîðîì ñïîñîáå  îáðàçîâàíèÿ öèêëè÷åñêèõ êîäîâ  èíôîðìà-

öèîííûå è êîíòðîëüíûå ñèìâîëû â êîìáèíàöèÿõ öèêëè÷åñêîãî êîäà íå îòäåëåíû äðóã îò äðóãà, ÷òî çàòðóäíÿåò ïðîöåññ äåêîäèðîâàíèÿ.

 

 


§ 4.1 Ïîëó÷åíèå êîäîâîé êîìáèíàöèè äîáàâëåíèåì îñòàòêà R(x)

Ïîñòðîèòü öèêëè÷åñêèé êîä äëÿ ïåðåäà÷è 31 ðàçðÿäíîé êîäîâîé

êîìáèíàöèè ñ èñïðàâëåíèåì îäíîêðàòíîé îøèáêè ( n=31, s=1)

        Ðåøåíèå.

1. Îïðåäåëèì ÷èñëî êîíòðîëüíûõ ðàçðÿäîâ - m :

 m = log2 (n+1) = log2 (31+1) = 5.

2. Îïðåäåëèì êîëè÷åñòâî èíôîðìàöèîííûõ ðàçðÿäîâ k :

 k = n-m = 26, 

ò.å  ïîëó÷èëè (31, 26 ) - êîä .

3. Ñòðîèì èíôîðìàöèîííûé ïîëèíîì,ñîòâåòñòâóþùèé èíôîðìàöèîííîìó             ñëîâó äëèíîé k-áèò:

   G(x)=00000000000000000000000101= x2 +1.

4. Îñóùåñòâëÿì ñäâèã  êîäà  âëåâî íà m=n-k=5 ðàçðÿäîâ ò.å  ïîëèíîì G(x) óìíîæàåòñÿ íà  xm : 

 xm G(x)= (x2+1) x5= x7+ x5 =0000000000000000000000010100000.

5. Âûáèðàåòñÿ îáðàçóþùèé ìíîãî÷ëåí-P(x) ïî òàáëèöå íåïðèâîäèìûõ ìíîãî÷ëåíîâ.  Äëÿ èñïðàâëåíèÿ îäèíî÷íîé îøèáêè (d0=3) îáðàçóþùèé ïîëèíîì P(x)  äîëæåí áûòü ñòåïåíè m=n-k=5 è êîëè÷åñòâîì íåíóëåâûõ ÷ëåíîâ  íå ìåíüøå ìèíèìàëüíîãî êîäîâîãî ðàññòîÿíèÿ d0 =3. Èñõîäÿ èç

ýòîãî îáðàçóþøèé ïîëèíîì P(x)  ðàâåí :

 P(x)= x5 + x4 +x3 +x 2 +1 = 111101.

6.  Îïðåäåëèì  îñòàòîê R(x) îò  äåëåíèÿ G(x)×x m  íà  îáðàçóþùèé ïî-

      ëèíîì P(x)                                  

  x7+ x5                                       x5 + x4 +x3 +x 2 +1          10100000         111101

  x7 + x6 +x5 +x 4 +x2        x2 +x +1                       111101              111

             x6 + x4 +x2                                                 101010

             x6 + x5 +x4 +x 3 +x                                     111101

                 x5 + x3 +x2 +x                                              101110 

                 x5 + x4 +x3 +x 2 +1                                   111101

                        x4 +x +1                                             10011

 Îñòàòîê R(x)= x4+x+1 =10011.

7. Ñòðîèì ïåðåäàâàåìûé êîäîâûé ïðîëèíîì F(x) :

  F(x)=xm G(x)ÅR(x)= x7+ x5+ x4+x+1 =0000000000000000000000010110011.

8. Ïóñòü â ïðèíÿòîì ñîîáùåíèè ïðîèçîøëà îøèáêà â òðèäöàòü ïåðâîì ðàçðÿäå,ïðè çòîì ïðèíÿòîå êîäîâîå ñîîáùåíèå èìååò âèä :

     F¢(x)=F(x) Å E(x)= 1000000000000000000000010110011.

9.  Ðàçäåëèì ìíîãî÷ëåí F1(x) ñîîòâåñòâóþùèé ïîëó÷åííîé êîäîâîé êîì-áèíàöèè íà îáðàçóþùèé ïîëèíîì, ïðè ýòîì âåñ îñòàòêà (êîëè÷åñòâî åäèíèö â êîäå îñòàòêà) äîëæåí áûòü ìåíüøå èëè ðàâåí êîëè÷åñòâó îøèáîê W £S

   1000000000000000000000010110011   111101

   111101

     111010

     111101

           111000

           111101   

                 101000

                 111101            

                    101010

                    111101        

                      101110

                      111101                                 

                        100110

                        111101       

                          110110

                          111101

                             101100

                             111101

                               100010

                               111101                  

                                 111110

                                 111101

                                        110010

                                        111101    

                                            111111

                                            111101

                                                    100011

                                                     111101      

                                                       11110   

Ñðàâíèâàåì âåñ ïîëó÷åííîãî îñòàòêà w ñ ÷èñëîì èñïðàâëÿåìûõ îøèáîê

w>s .

10. Ïðîèçâîäèì öèêëè÷åñêèé ñäâèã ïðèíÿòîé êîäîâîé êîìáèíàöèè íà îäèí

ðàçðÿä âëåâî è ïîâòîðÿåì ï.9 ïîêà w £ s. 

a) 0000000000000000000000101100111     111101

                                             111101

                                               100011

                                               111101  

                                                 111101

                                                 111101

                                                            1   Þ w=s .

Ñêëàäûâàåì ïî ìîäóëþ 2  ïîñëåäíåå äåëèìîå ñ ïîñëåäíèì îñòàòêîì:

   0000000000000000000000101100111                    

Å                                                       1    

   0000000000000000000000101100110

Îñóùåñòâëÿåì îáðàòíûé ñäâèã íà 1 ðàçðÿä ïîëó÷åííîé êîìáèíàöèè

 0000000000000000000000010110011

Îòáðîñèâ êîíòðîëüíûå ðàçðÿäû , ïîëó÷àåì ïåðåäàííîå èíôîðìàöèííîå ñëîâî.


§ 4.2  Ïîñòðîåíèå êîäîâîé êîìáèíàöèè ïóòåì óìíîæåíèÿ

                íà îáðàçóþùèé ïîëèíîì

Ïîñòðîèòü öèêëè÷åñêèé êîä äëÿ ïåðåäà÷è 31 ðàçðÿäíîé êîäîâîé

êîìáèíàöèè ñ èñïðàâëåíèåì îäíîêðàòíîé îøèáêè ( n=31, s=1) ïóòåì óìíîæåíèÿ îáðàçóþùåãî ìíîãî÷ëåíà íà ìíîãî÷ëåí ïîëíîãî 31 ðàçðÿäíîãî êîäà.

      Ðåøåíèå.

1. Ñòðîèì èíôîðìàöèîííûé ïîëèíîì,ñîòâåòñòâóþùèé èíôîðìàöèîííîìó             ñëîâó äëèíîé k-áèò:

G(x)=00000000000000000000000101= x2 +2.

2. Ñòðîèì ïåðåäàâàåìûé êîäîâûé ïîëèíîì

                00000000000000000000000101

                                                     111101        

                00000000000000000000000101

             00000000000000000000000101

           00000000000000000000000101

          00000000000000000000000101

        00000000000000000000000101

        0000000000000000000000011001001

  3.  Ïðîöåññ èñïðàâëåíèÿ îäíîêðàòíîé îøèáêè àíàëîãè÷åí îïèñàííîìó

â  § 4.1.


§ 5. Ðàçðàáîòêà ñõåìû àëãîðèòìà

Ciclic code


                                                                          íåò  

                                     

                                                                 äà    


                                                                                                                       

                                                                                                                             

                                                                                                                       

                                                                                                                    

                                                                                                                           

                                                                                                                  

                                                                                                                     

                                                                                                                  

                                                                                                                      

                                                                                                                       

                                                                                                                      

                                                                            íåò                                    

                                                                                                                        

                                                                   äà                                                                            

                                                                                                                                                                              

                                                                                                          

                                                           Êîíåö 


§ 6. Ðàçðàáîòêà òåêñòà ïðîãðàììû

     Äëÿ ïðåäñòàâëåíèÿ èíôîðìàöèîííîãî ñëîâà â ïàìÿòè èñïîëüçóåòñÿ

 ìàññèâ. Â ñîñòàâ ïðîãðàììû âõîäèò îñíîâíàÿ ïðîãðàììà è äâà ìîäóëÿ,

ðåàëèçóþùèå àëãîðèòì êîäèðîâàíèÿ è äåêîäèðîâàíèÿ èíôîðìàöèîííûõ ñëîâ è äèàëîãà ñ ïîëüçîâàòåëåì ñîîòâåòñòâåííî.

Program Cyclic_Code;

Uses

    Crt,_CC31,_Serv;

Var

            m,mm:Move_code;

            p:Polinom;

            r:Rest;

            i,Mainflag,From,Error:integer;

            Switch:byte;

            Key:boolean;

begin

Repeat

     Key:=true;

     TextColor(11);

     TextBackGround(7);

     Clrscr;

     SetWindow(24,10,45,14,2,' Ãëàâíîå ìåíþ ');

     Switch:=GetMainMenuChoice;

     case Switch of

              1:begin

                  About;

                  Readln;

                  Key:=False;

                end;

              2: begin

                   TextColor(0);

                   ClrScr;

                   SetWindow(25,10,40,13,1,' Îáðàçîâàòü ');

                   Switch:=GetSubMenuChoice;

                   case Switch of

                            1:begin

                                   TextBackGround(0);

                                   TextColor(15);

                                   ClrScr;

                                   SetWindow(1,1,79,24,2,' Äåìîíñòðàöèÿ');

                                   TextColor(14);

                                  

                            

                              GotoXY(2,2);

                                   Init(m,p,r,MainFlag);

                                   Write(‘Èíôîðìàöèîííûé ïîëèíîì           ');

                                   TextColor(2);

                                   for i:=n downto 0 do

                                   begin

                                     if(i<n-n1+1)then Textcolor(9);

                                     Write(m[i]);

                                   end;

                                   TextColor(14);

                                   GotoXY(2,3);

                                   Write('Îáðàçóþùèé ïîëèíîì                ');

                                   TextColor(13);

                                   for i:=n1 downto 0 do

                                   Write(p[i]);

                                   TextColor(14);

                                   GotoXY(2,4);

                                   Write('Ñëîæåíèå ïî ìîäóëþ 2 (F(x)+P(x)): ');

                                   FxPx(m);

                                   TextColor(9);

                                   for i:=n downto 0 do

                                   begin

                                     if(i<n1)then TextColor(2);

                                     Write(m[i]);

                                   end;

                                   TextColor(14);

                                   GotoXY(2,5);

                                   Write('Îñòàòîê:                          ');

                                   Divizion(m,r,p,Mainflag);

                                   TextColor(11);

                                   for i:=n1 downto Mainflag do

                                     Write(r[i]);

                                   GotoXY(2,6);

                                   TextColor(14);

                                   Write('Ïåðåäàâàåìûé ïîëèíîì:             ');

                                   BildMoveCode(m,r,Mainflag);

                                   TextColor(9);

                                   for i:=n downto 0 do

                                   begin

                                     if(i<n1) then TextColor(11);

                                     Write(m[i]);

                                   end;

                                   GotoXY(2,7);

                                   TextColor(14);

                                   Write('Ïðîèçîøëà îøèáêà...               ');

                                  

                                  

                                   MakeError(m,Error);

                                   TextColor(9);

                                   for i:=n downto 0 do

                                   begin

                                     if(i=Error)then

                                       TextColor(12)

                                     else

                                       TextColor(9);

                                     write(m[i]);

                                   end;

                                   GotoXY(2,8);

                                   TextColor(14);

                                   Write('Îøèáêà èñïðàâëåíà!                ');

                                   TextColor(9);

                                   Correction(m,p,r);

                                   for i:=n downto 0 do

                                   begin

                                       if(i=Error)then

                                       TextColor(10)

                                     else

                                       TextColor(9);

                                     write(m[i]);

                                    end;

                                    TextColor(14);

                                    GotoXY(2,9);

                                    Write('Èñõîäíûé ïîëèíîì:                 ');

                                    Decoder(m);

                                    TextColor(2);

                                    for i:=n downto 0 do

                                    begin

                                     if(i<n-n1+1)then Textcolor(9);

                                     Write(m[i]);

                                   end;

                            Key:=false;

                            end;

                            2:begin

                                   TextBackGround(0);

                                   TextColor(15);

                                   ClrScr;

                                   SetWindow(1,1,79,24,2,'Äåìîíñòðàöèÿ');

                                   TextColor(14);

                                   GotoXY(2,2);

                                   Init(m,p,r,MainFlag);

                                    Write('Èíôîðìàöèîííûé ïîëèíîì:           ');

                                   TextColor(2);

                                   for i:=n downto 0 do

                                  

                                   begin

                                     if(i<n-n1+1)then Textcolor(9);

                                     Write(m[i]);

                                   end;

                                   TextColor(14);

                                   GotoXY(2,3);

                                   Write('Îáðàçóþùèé ïîëèíîì:               ');

                                   TextColor(13);

                                   for i:=n1 downto 0 do

                                   Write(p[i]);

                                   TextColor(14);

                                   GotoXY(2,4);

                                   Write('Ðåçóëüòàò óìíîæåíèÿ:              ');

                                   BildMoveCodeMultiplication(m);

                                   TextColor(9);

                                   for i:=n downto 0 do

                                     Write(m[i]);

                                   GotoXY(2,5);

                                   TextColor(14);

                                   Write('Ïðîèçîøëà îøèáêà ...               ');

                                   MakeError(m,Error);

                                   TextColor(9);

                                   for i:=n downto 0 do

                                   begin

                                     if(i=Error)then

                                       TextColor(12)

                                     else

                                       TextColor(9);

                                     write(m[i]);

                                   end;

                                   GotoXY(2,6);

                                   TextColor(14);

                                   Write('Îøèáêà èñïðàâëåíà !                ');

                                   TextColor(9);

                                   Correction(m,p,r);

                                   for i:=n downto 0 do

                                   begin

                                       if(i=Error)then

                                       TextColor(10)

                                     else

                                       TextColor(9);

                                     write(m[i]);

                                    end;

                                   Key:=false;

                                   end;

                  end;

               

               

                 TextColor(14);

                 GotoXY(2,22);

                 Write('Íàæìèòå ëþáóþ êëàâèøó...');

                 Readln;

              end;

              3:begin

                  ClrScr;

                  GotoXY(1,24);

                  TextColor(14);

                  Writeln('Ðàáîòà ïðîãðàììû çàâåðøåíà ...');

                  Readln;

                  TextBackGround(0);

                  TextColor(15);

                  ClrScr;

                  Key:=true;

                end;

       end;

 Until Key;

end.


§ 7 .Ðåçóëüòàòû ðàáîòû ïðîãðàììû

Ðåçóëüòàò ðàáîòû ïðîãðàììû ïðè îáðàçîâàíèè êîäà äîáàâëåíèåì îñòàòêà

Äåìîíñòðàöèÿ

 Èíôîðìàöèîííûé ïîëèíîì:            0000011010111110011110110110110           

 Îáðàçóþùèé ïîëèíîì:                     111101    

Cëîæåíèe ïî ìîäóëþ 2 (F(x)+P(x)): 1101011111001111011011011000000            

 Îñòàòîê:                                             010101

 Ïåðåäàâàåìûé ïîëèíîì:                  1101011111001111011011011010101           

 Ïðîèçîøëà îøèáêà...                       1101011111001110011011011010101           

 Îøèáêà èñïðàâëåíà!                         1101011111001111011011011010101           

 Èñõîäíûé ïîëèíîì:                          0000011010111110011110110110110           

Íàæìèòå ëþáóþ êëàâèøó...                                                    

                                                                             

Ðåçóëüòàò ðàáîòû ïðè îáðàçîâàíèè êîäà óìíîæåíèåì

Äåìîíñòðàöèÿ

 Èíôîðìàöèîííûé ïîëèíîì:           0000001010110000011111010001011           

 Îáðàçóþùèé ïîëèíîì:                   111101                                    

 Ðåçóëüòàò óìíîæåíèÿ:                     0110000011111010000100100101111           

 Ïðîèçîøëà îøèáêà...                     0110000011111010000100100101101           

 Îøèáêà èñïðàâëåíà!                       0110000011111010000100100101111           

Íàæìèòå ëþáóþ êëàâèøó...

Âûâîäû:

      Äàííàÿ ïðîãðàììà êîäèðóåò ñîîáùåíèÿ  èñïîëüçóÿ öèêëè÷åñêèé êîä.

Ïðè ýòîì îíà èììèòèðóåò ðàáîòó êàíàëà äëÿ ïåðåäà÷è èíôîðìàöèè.

    Ïðè âîçíèêíîâåíèè èñêëþ÷èòåëüíûõ ñèòóàöèé,êîãäà èíôîðìàöèîííîå ñëîâî ïî êàêèì-ëèáî ïðè÷èíàì ðàñêîäèðîâàòü íå óäà¸òñÿ, ïðîãðàììà ïîâòîðÿåò çàïðîñ íà ïåðåñûëêó äàííûõ, êàê ýòî äåëàåòñÿ â ðåàëüíûõ ñèòóàöèÿõ ïîäîáíîãî ðîäà.

     Êðîìå ýòîãî, ïðîãðàììà  ñëó÷àéíûì îáðàçîì, "ïðè ïðîõîæäåíèè

èíôîðìàöèîííîãî ñëîâà ÷åðåç êàíàë" äîïóñêàåò â ñëîâå îäíîêðàòíóþ îøáêó, çàòåì  èñïðàâëÿåò åå, äåêîäèðóåò èíôîðìàöèîííîå ñëîâî è ïåðåäà¸ò ðåçóëüòàò ïîëüçîâàòåëþ.


Ëèòåðàòóðà

1. “Êîäèðîâàíèå èíôîðìàöèè (äâîè÷íûå êîäû)”.Áåðåçþê Í.Ò.,

Àíäðóùåíêî À.Ã., Ìîùèöêèé Ñ.Ñ. è äð. Õàðüêîâ,èçäàòåëüñêîå îáúåäè-

íåíèå “Âèùà øêîëà”,1978. 252 ñ.

2. “ Ïðîãðàììèðîâàíèå â ñðåäå Turbo Pascal “ . Ìàð÷åíêî À.È., Ìàð÷åíêî

 Ë.À. Ìîñêâà,“Áèíîì Óíèâåðñàë”.Êèåâ,”Þíèîð”,1997.495 ñ.

     


Ïðèëîæåíèå ¹ 1

Ïðîöåäóðû è ôóíêöèè ìîäóëÿ _ññ31.

Unit _CC31;

Interface

Uses

     Crt;

Const

      n=30;                                   { Èíôîðìàöèÿ+êîä              }

      n1=5;                                   { Ðàçìåð êîíòðîëüíûõ ðàçðÿäîâ }

 Type

     Move_code=array[0..n] of byte; { Ïåðåäàâàåìûé ïîëèíîì F(x)   }

     Rest=array[0..n1] of byte;     { Îñòàòîê                     }

     Polinom=array[0..n1] of byte;  { Îáðàçóþùèé ïîëèíîì P(x)     }

Procedure Init(var m1:Move_code;var p1:Polinom;

                   var r1:Rest;var flag:integer);

Procedure FxPx(var m6:Move_Code);

Procedure Divizion(var m2:Move_code;var r2:Rest;

                           p2:Polinom;var flag:integer);

Procedure BildMoveCode(var m3:Move_code;r3:Rest;var flag:integer);

Procedure Decoder(var m6:Move_Code);

Procedure MakeError(var m4:Move_code;var err:integer);

Procedure BildMoveCodeMultiplication(var m7:Move_Code);

Procedure Correction(var m5:Move_code;p5:Polinom;var r5:Rest);

Implementation

Procedure Init;

var

  i:integer;

begin

   p1[5]:=1;

   p1[4]:=1;

   p1[3]:=1;

   p1[2]:=1;

   p1[1]:=0;

   p1[0]:=1;

   flag:=0;

   for i:=n1 downto 0 do

     r1[i]:=0;

   Randomize;

   for i:=n-n1 downto 0 do

     m1[i]:=random(2);

  end;

Procedure FxPx(var m6:Move_Code);

var

  i:integer;

  k:byte;

begin

  k:=5;

  while(k>0) do

  begin

    for i:=n downto 1 do

    m6[i]:=m6[i-1];

    dec(k);

  end;

  for i:=n1-1 downto 0 do

            m6[i]:=0;

end;

Procedure Divizion(var m2:Move_code;var r2:Rest;

                           p2:Polinom;var flag:integer);

label

    RETURN;

var

  i,j,i1,kol,Countzero:integer;

begin

   j:=n;

RETURN:while((j>=0)and(m2[j]=0))do dec(j);

   if(j>n1)

    then begin

               for i:=n1 downto 0 do

                 begin

                   r2[i]:=m2[j];

                   dec(j);

                 end;

                while(j>=0)do

                   begin

                         for i:=n1 downto 0 do

                           r2[i]:=r2[i] xor p2[i];

                         i1:=n1;

                         while((i1>=0)and(r2[i1]=0))do dec(i1);

                         if(i1=-1)then goto RETURN;

                         Kol:=n1-i1;

                         while(Kol>0)do

                            begin

                              for i:=n1 downto 1 do

                                   r2[i]:=r2[i-1];

                              dec(Kol);

                            end;

                         Kol:=n1-i1;

                         while((Kol>0)and(j>=0))do

                            begin

                              r2[Kol-1]:=m2[j];

                              dec(Kol);

                              dec(j);

                            end;

                         if((j=-1)and(Kol=0))

                          then begin

                                    for i:=n1 downto 0 do

                                      r2[i]:=r2[i] xor p2[i];

                                   end

                          else flag:=Kol;

                   end;

              end

    else if(n1=j)

              then begin

                         for i:=n1 downto 0 do

                           begin

                             r2[i]:=m2[j];

                             dec(j);

                           end;

                         for i:=n1 downto 0 do

                           r2[i]:=r2[i] xor p2[i]

                   end

    else if(j<n1)

             then begin

                        for i:=j downto 0 do

                          r2[i]:=m2[i]

                  end;

end;

Procedure  BildMoveCode(var m3:Move_code;r3:Rest;var flag:integer);

var

   i,k:integer;

begin

   if(flag>0)then

     begin

       k:=n1-flag;

       for i:=n1 downto flag do

             begin

               m3[k]:=r3[i];

               dec(k);

             end;

     end

   else begin

              for i:=n1-1 downto 0 do

                m3[i]:=r3[i];

            end;

end;

Procedure MakeError(var m4:Move_code;var err:integer);

begin

    Randomize;

    err:=Random(n);

    m4[err]:=m4[err] xor 1;

end;

Procedure Decoder(var m6:Move_Code);

var

  i:integer;

  k:byte;

begin

  k:=5;

  while(k>0) do

  begin

    for i:=0 to n-1 do

    m6[i]:=m6[i+1];

    dec(k);

  end;

  for i:=n downto n-n1+1 do

            m6[i]:=0;

end;

Procedure BildMoveCodeMultiplication(var m7:Move_Code);

var

   m1,m2,m3,m4,mm:Move_Code;

   i,j:integer;

begin

  mm:=m7;

  m1:=m7;

  for j:=0 to 1 do

    begin

      for i:=n downto 1 do

            m1[i]:=m1[i-1];

      m1[j]:=0;

    end;

  m2:=m7;

  for j:=0 to 2 do

    begin

      for i:=n downto 1 do

            m2[i]:=m2[i-1];

      m2[j]:=0;

    end;

  m3:=m7;

  for j:=0 to 3 do

    begin

      for i:=n downto 1 do

            m3[i]:=m3[i-1];

      m3[j]:=0;

    end;

  m4:=m7;

  for j:=0 to 4 do

    begin

      for i:=n downto 1 do

            m4[i]:=m4[i-1];

      m4[j]:=0;

    end;

  for i:=n downto 0 do

    m7[i]:=mm[i] xor m1[i]xor m2[i]xor m3[i] xor m4[i];

end;

Procedure Correction(var m5:Move_code;p5:Polinom;var r5:Rest);

var

   i,Correctflag,i1:integer;

   Count,Countcarry,Carryflag:byte;

begin

   Correctflag:=0;

   Countcarry:=0;

   repeat

     for i:=n1 downto 0 do

       r5[i]:=0;

     Count:=0;

     Divizion(m5,r5,p5,Correctflag);

     i1:=n1;

     while((i1>=Correctflag)and(r5[i1]=0))do dec(i1);

     if({(i1=Correctflag-1) or

       (}(i1=Correctflag)and(r5[Correctflag]=1)){)}

       then m5[0]:=m5[0] xor r5[Correctflag]

       else  begin

                   Carryflag:=m5[n];

                   for i:=n downto 1 do

                   m5[i]:=m5[i-1];

                   m5[0]:=Carryflag;

                   inc(Countcarry);

                 end;

   until ({(i1=Correctflag-1) or

             (}(i1=Correctflag)and(r5[Correctflag]=1));{);}

   while (Countcarry>0) do

    begin

       Carryflag:=m5[0];

             for i:=0 to n-1 do

                m5[i]:=m5[i+1];

             m5[n]:=Carryflag;

            dec(Countcarry);

    end;

end;

end.

Ïðèëîæåíèå ¹ 2

Ïðîöåäóðû è ôóíêöèè ìîäóëÿ _Serv.

Unit _SERV;

Interface

Uses

   Crt,Dos;

Const

   EmptyBorder  =0;

   SingleBorder =1;

   DoubleBorder =2;

   BorderChar:array[0..2,1..6] of Char=

                  ((#32,#32,#32,#32,#32,#32),

                   (#218,#196,#191,#179,#192,#217),

                   (#201,#205,#187,#186,#200,#188));

   MaxChar    =80;

   MaxLine     =25;

   MenuTop   =3;

   SubMenuTop   =2;

   MenuLine     :array[1..MenuTop]of string[20]=

                        ('  Î ïðîãðàììå...',' Äåìîíñòðàöèÿ '  ‘Âûõîä ');

   SubMenuLine  :array[1..SubMenuTop]of string[20]=

                        ('  Ñëîæåíèåì' , ' Óìíîæåíèåì');

Procedure   SetWindow(x1,y1,x2,y2,Bord:byte;Header:string);

Procedure   CursorOff;

Function    GetMainMenuChoice:byte;

Function    GetSubMenuChoice:byte;

Procedure   About;

Implementation

Procedure SetWindow(x1,y1,x2,y2,Bord:byte;Header:string);

var

  i:integer;

begin

  if not ((x1<1) or (x2<=x1) or

              (y1<1) or (y2<=y1) or (x2>MaxChar) or

              (y2>MaxLine) or (Bord>2)) then

    begin

      GotoXY(x1,y1);

      Write(BorderChar[Bord,1]);

      for i:=1 to x2-x1-1 do

            begin

              GotoXY(x1+i,y1);

              Write(BorderChar[Bord,2]);

            end;

      GotoXY(x2,y1);

      Write(BorderChar[Bord,3]);

      for i:=1 to y2-y1-1 do

            begin

              GotoXY(x1,y1+i);

              Write(BorderChar[Bord,4]);

              GotoXY(x2,y1+i);

              Write(BorderChar[Bord,4]);

            end;

      GotoXY(x1,y2);

      Write(BorderChar[Bord,5]);

      for i:=1 to x2-x1-1 do

            begin

              GotoXY(x1+i,y2);

              Write(BorderChar[Bord,2]);

            end;

      GotoXY(x2,y2);

      Write(BorderChar[Bord,6]);

    end;

    GotoXY((x2-x1-ord(Header[0])) div 2+x1,y1);

    Write(Header)

end;

Procedure CursorOff;

begin

  asm

    mov ah,1

    mov ch,20h

    int 10h

  end;

end;

Function GetMainMenuChoice:byte;

var

   Count:byte;

   i:integer;

   ch,ch1:char;

begin

  Count:=1;

  while KeyPressed do

    ch:=Readkey;

 repeat

   for i:=1 to MenuTop do

    begin

      if(i=Count)then

            begin

              HighVideo;

              TextColor(0);

            end

      else

             begin

               LowVideo;

               TextColor(8);

             end;

      GotoXY(25,10+i);

      Writeln(MenuLine[i]);

      CursorOff;

    end;

   if KeyPressed

     then begin

            ch:=Readkey;

   if(ch=#0)

     then begin

              ch1:=Readkey;

   case ch1 of

     #72 : if(Count>1)

                then dec(Count);

     #80 : if(Count<MenuTop)

                then inc(Count);

    end;

  end;

 end;

 until(ch=#13);

 GetMainMenuChoice:=Count;

end;

Function GetSubMenuChoice:byte;

var

   Count:byte;

   i:integer;

   ch,ch1:char;

begin

  Count:=1;

  while KeyPressed do

    ch:=Readkey;

 repeat

   for i:=1 to SubMenuTop do

    begin

      if(i=Count)then

            begin

              HighVideo;

              TextColor(9);

            end

      else

             begin

               LowVideo;

               TextColor(1);

             end;

      GotoXY(26,10+i);

      Writeln(SubMenuLine[i]);

      CursorOff;

    end;

   if KeyPressed

     then begin

            ch:=Readkey;

   if(ch=#0)

     then begin

              ch1:=Readkey;

   case ch1 of

     #72 : if(Count>1)

                then dec(Count);

     #80 : if(Count<SubMenuTop)

                then inc(Count);

    end;

  end;

 end;

 until(ch=#13);

 GetSubMenuChoice:=Count;

end;

Procedure About;

begin

  TextColor(15);

  SetWindow(5,1,75,3,1,'Î ïðîãðàììå');

  TextColor(10);

  GotoXY(6,2);

  TextColor(10+128);

  Write('Òîêàðü Àëåêñåé Þðüåâè÷ ÀÏ-57.Êóðñîâîé ïðîåêò.

            “Öèêëè÷åñêèé êîä”   ');

end;

end.


© 2012 Ðåôåðàòû, êóðñîâûå è äèïëîìíûå ðàáîòû.