Anda di halaman 1dari 30

PRAKTIKUM KOMUNIKASI DATA

Pengkodean Data Digital


(Unipolar, RZ, AMI, D-Manchaster, HDB3)

Dosen Pembimbing :
M. Sarosa, Dipl. Ing, MT, Dr

Disusun Oleh :
Fanny Nur Amalia Sari ( 12 )
NIM. 1241160068
JTD 3B

KEMENTERIAN PENDIDIKAN DAN KEBUDAYAAN

POLITEKNIK NEGERI MALANG


Jalan Soekarno Hatta 9 Malang 65141
Telp (0341) 404424 404425 Fax (0341) 404420
http://www.poltek-malang.ac.id

2014

DAFTAR ISI

Cover .......................................................................................................................................... 1
Daftar Isi .................................................................................................................................... 2
Bab I Pendahuluan ..................................................................................................................... 3
1.1 Tujuan............................................................................................................................... 3
1.2 Alat yang dibutuhkan ....................................................................................................... 3
1.3 Teori Dasar ....................................................................................................................... 3
1.3.1 Pengkodean Sinyal Digital .................................................................................... 3
1.3.1.1 Unipolar ................................................................................................. 3
1.3.1.2 RZ .......................................................................................................... 4
1.3.1.3 AMI ........................................................................................................ 4
1.3.1.4 D-Manchester ......................................................................................... 5
1.3.1.5 HDB3 ..................................................................................................... 5
1.4 Desain Form .................................................................................................................... 6
Bab II Pembahasan .................................................................................................................... 7
2.1 Prosedur Percobaan ......................................................................................................... 7
2.2 Listing Program ............................................................................................................... 7
2.3 Hasil Percobaan ............................................................................................................. 29
Bab III Penutup ........................................................................................................................ 30
3.1 Kesimpulan ................................................................................................................... 30

BAB I
PENDAHULUAN
1.1 Tujuan
1.

Memahami macam-macam pengkodean data digital (Unipolar, RZ, AMI, DManchester, HDB3)

2.

Memahami teknik pengkodean data digital

3.

Mampu melakukan simulasi pengkodean data digital

4.

Membuat program untuk mensimulasikan karakteristik pengkodean data digital


(Unipolar, RZ, AMI, D-Manchester, HDB3)

5.

Membuat flowchart teknik pengkodean data digital.

1.2 Alat yang dibutuhkan


1. Komputer
2. Program Delphi 7
1.3 Teori Dasar
1.3.1

Pengkodean Sinyal Digital


Data digital merupakan data yang memiliki deretan nilai yang berbeda dan

memiliki ciri-ciri tersendiri. Contoh data digital adalah teks, deretan bilangan, dan
karakter-karakter yang lain. Data digital dalam bentuk karakter yang dapat dipahami
manusia tidak dapat langsung ditransmisikan dalam sistem komunikasi, data harus
terlebih dahulu diubah ke dalam bentuk biner. Jadi, data digital ditransmisikan dalam
bentuk deretan biner. Sedangkan sinyal digital merupakan sinyal untuk menampilkan
data digital. Deretan pulsa yang berbeda dan tidak terjadi secara terus-menerus
merupakan contoh sinyal digital. Pengkodean data digital ditujukan untuk
membangun sinyal digital, yang meliputi: unipolar, polar dan bipolar.
1.3.1.1 Unipolar
Unipolar merupakan pengkodean paling sederhana dimana data digital
yang telah berbentuk biner di diubah ke bentuk pulsa, biner 1 diwujudkan
dalam suatu tegangan positif dan biner 0 sebagai tanpa tegangan atau nol
volt. Gambar 1 menampilkan contoh sinyal digital sederhana dari suatu data
101100110.

Amplitudo
1

Unipolar

Gambar 1 Sinyal digital unipolar dari data 101100110

Pengkodean polar bercirikan menggunakan dua level tegangan positif


dan negatif sehingga dapat mengeliminasi timbulnya komponen DC.
Pengkodean polar terdiri atas NRZ (non return to zero), RZ (return to zero)
dan biphase.
1.3.1.2 Return to Zero ( RZ )
Format pengkodean selalu menuju ke level nol pada setengah
periodenya. Biner 0 diwakili oleh perubahan level dari negatif ke nol
sedangkan biner 1 diwakili oleh perubahan dari positif ke nol. Gambar 2
menampilkan contoh sinyal hasil pengkodean return to zero (RZ).

RZ

Gambar 2 Sinyal Return To Zero

1.3.1.3 AMI (Alternate Mark Inversion)


Pada pengkodean AMI, elemen data dengan bit 1 direpresentasikan
oleh sinyal yang beriversi bolak balik dari tegangan positif ke tegangan negatif
atau sebaliknya dari tegangan negatif ke tegangan positif. Sedangkan elemen
data dengan bit 0 direpresentasikan oleh tegangan 0 volt.

Gambar 4 Pengkodean Digital AMI

1.3.1.4 D-Manchester ( Differential Manchester )


Differential Manchester encoding (juga dikenal sebagai CDP;
Conditioned Diphase pengkodean) adalah sebuah metode pengkodean data di
mana data dan sinyal clock digabungkan untuk membentuk satu diri
sinkronisasi aliran data. Pada pengkodean differential manchester selain
terdapat perubahan sinyal pada separo dari durasi bit, juga terdapat inversi
sinyal pada saat bit berikut adalah bit 0. Apabila bit berikut adalah bit 1, maka
tidak ada inversi sinyal.

Gambar 5 Differential Manchester


1.3.1.5 HDB3 ( High Density Bipolar 3 Zeros )
Pengkodean HDB3 adalah suatu teknik yang mengkodekan setiap 4 bit
nol yang berurutan menjadi sebuah variasi dari tiga bit nol dan sebuah level
tegangan, baik itu positif maupun negative

Gambar 6 HDB3
1.4 Desain Form

BAB II
PEMBAHASAN
2.1 Prosedur Percobaan
1. Buatlah desain sesuai dengan gambar dibawah ini.

2. Buatlah program sesuai dengan pengkodean digital tersebut

2.2 Listing Program


unit Digital;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;

type
TForm1 = class(TForm)

imguni: TImage;
imgrz: TImage;
imgdman: TImage;
imgami: TImage;
imghdb: TImage;
PanelOption: TPanel;
Edit1: TEdit;
Exit: TButton;
GroupBox1: TGroupBox;
Proses: TButton;
GroupBox2: TGroupBox;
PanelUni: TPanel;
PanelRZ: TPanel;
PanelDman: TPanel;
PanelAMI: TPanel;
PanelHDB3: TPanel;
unipbut: TButton;
rzbut: TButton;
dmanbut: TButton;
amibut: TButton;
hdb3but: TButton;
Clear: TButton;
procedure ExitClick(Sender: TObject);
procedure ProsesClick(Sender: TObject);
procedure unipbutClick(Sender: TObject);
procedure rzbutClick(Sender: TObject);
//procedure nrzibutClick(Sender: TObject);
procedure dmanbutClick(Sender: TObject);
procedure amibutClick(Sender: TObject);
procedure hdb3butClick(Sender: TObject);
procedure ClearClick(Sender: TObject);
private
{ Private declarations }
public
8

{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

//------------------------------ Procedure RZ --------------------------------//

procedure rz_1(ax,ay,a,b,n:integer);
begin
Form1.imgrz.Canvas.Pen.Color:=clBlue;
Form1.imgrz.Canvas.Pen.Width:=2;
Form1.imgrz.Canvas.MoveTo(ax+(n-1)*(b+b),ay);
Form1.imgrz.Canvas.LineTo(ax+(n-1)*(b+b),ay-a);
Form1.imgrz.Canvas.LineTo(ax+b+(n-1)*(b+b),ay-a);
Form1.imgrz.Canvas.LineTo(ax+b+(n-1)*(b+b),ay);
Form1.imgrz.Canvas.LineTo(ax+b+b+(n-1)*(b+b),ay);
end;

procedure rz_0(ax,ay,a,b,n:integer);
begin
Form1.imgrz.Canvas.Pen.Color:=clBlue;
Form1.imgrz.Canvas.Pen.Width:=2;
Form1.imgrz.Canvas.MoveTo(ax+(n-1)*(b+b),ay);
Form1.imgrz.Canvas.LineTo(ax+(n-1)*(b+b),ay+a);
Form1.imgrz.Canvas.LineTo(ax+b+(n-1)*(b+b),ay+a);
Form1.imgrz.Canvas.LineTo(ax+b+(n-1)*(b+b),ay);
Form1.imgrz.Canvas.LineTo(ax+b+b+(n-1)*(b+b),ay);
end;

//---------------------- Procedure Unipolar ----------------------------------//

procedure satu(ax,ay,a,b,i:integer);
begin
Form1.imguni.Canvas.Pen.Color:=clBlue;
Form1.imguni.Canvas.Pen.Width:=2;
Form1.imguni.Canvas.MoveTo(ax+(i-1)*b,ay-a);
Form1.imguni.Canvas.LineTo(ax+b+(i-1)*b,ay-a);
end;

procedure nol(ax,ay,a,b,i:integer);
begin
Form1.imguni.Canvas.Pen.Color:=clBlue;
Form1.imguni.Canvas.Pen.Width:=2;
Form1.imguni.Canvas.MoveTo(ax+(i-1)*b,ay);
Form1.imguni.Canvas.LineTo(ax+b+(i-1)*b,ay);
end;

procedure tegak(ax,ay,a,b,i:integer);
begin
Form1.imguni.Canvas.Pen.Color:=clBlue;
Form1.imguni.Canvas.Pen.Width:=2;
Form1.imguni.Canvas.MoveTo(ax+(i-1)*b,ay);
Form1.imguni.Canvas.LineTo(ax+(i-1)*b,ay-a);
end;

//---------------------- Procedure NRZ-I -------------------------------------//

//procedure nolNRZI(ax,ay,a,b,i:integer);
//begin
//Form1.imgnrz.Canvas.Pen.Color:=clBlue;
//Form1.imgnrz.Canvas.Pen.Width:=2;
//Form1.imgnrz.Canvas.MoveTo(ax+(i-1)*b,ay-a);
//Form1.imgnrz.Canvas.LineTo(ax+b+(i-1)*b,ay-a);
10

//end;

//procedure satuNRZI(ax,ay,a,b,i:integer);
//begin
//Form1.imgnrz.Canvas.Pen.Color:=clBlue;
//Form1.imgnrz.Canvas.Pen.Width:=2;
//Form1.imgnrz.Canvas.MoveTo(ax+(i-1)*b,ay+a);
//Form1.imgnrz.Canvas.LineTo(ax+b+(i-1)*b,ay+a);
//end;

//procedure tegakNRZI(ax,ay,a,b,i:integer);
//begin
//Form1.imgnrz.Canvas.Pen.Color:=clBlue;
//Form1.imgnrz.Canvas.Pen.Width:=2;
//Form1.imgnrz.Canvas.MoveTo(ax+(i-1)*b,ay+a);
//Form1.imgnrz.Canvas.LineTo(ax+(i-1)*b,ay-a);
//end;

//------------------------- Procedure D-MANCHESTER ---------------------------//

procedure dmncstr_1(ax,ay,a,b,i:integer);
begin
form1.imgdman.Canvas.Pen.Color:=clBlue;
form1.imgdman.Canvas.Pen.Width:=2;
form1.imgdman.Canvas.MoveTo(ax+(i-1)*b+((i-1)*b),ay+a);
form1.imgdman.Canvas.LineTo((ax+(i-1)*b+((i-1)*b))+b,ay+a);
form1.imgdman.Canvas.LineTo((ax+(i-1)*b+((i-1)*b))+b,ay-a);
form1.imgdman.Canvas.LineTo((ax+(i-1)*b+((i-1)*b))+2*b,ay-a);
end;

procedure dmncstr_0(ax,ay,a,b,i:integer);
begin
Form1.imgdman.Canvas.Pen.Color:=clBlue;
Form1.imgdman.Canvas.Pen.Width:=2;
11

Form1.imgdman.Canvas.MoveTo(ax+(i-1)*b+((i-1)*b),ay-a);
Form1.imgdman.Canvas.LineTo((ax+(i-1)*b+((i-1)*b))+b,ay-a);
Form1.imgdman.Canvas.LineTo((ax+(i-1)*b+((i-1)*b))+b,ay+a);
Form1.imgdman.Canvas.LineTo((ax+(i-1)*b+((i-1)*b))+2*b,ay+a);
end;

procedure dtegak(ax,ay,a,b,i:integer);
begin
Form1.imgdman.Canvas.Pen.Color:=clBlue;
Form1.imgdman.Canvas.Pen.Width:=2;
Form1.imgdman.Canvas.MoveTo((ax+(i-1)*b+((i-1)*b)),ay-a);
Form1.imgdman.Canvas.LineTo((ax+(i-1)*b+((i-1)*b)),ay+a);
end;

//----------------------------- Procedure AMI --------------------------------//

procedure ami1_1(ax,ay,a,b,i:integer);
begin
Form1.imgami.Canvas.Pen.Color:=clBlue;
Form1.imgami.Canvas.Pen.Width:=2;
Form1.imgami.Canvas.MoveTo(ax+(i-1)*b,ay);
Form1.imgami.Canvas.LineTo(ax+(i-1)*b,ay-a);
Form1.imgami.Canvas.LineTo(ax+b+(i-1)*b,ay-a);
Form1.imgami.Canvas.LineTo(ax+b+(i-1)*b,ay);
end;

procedure ami1_2(ax,ay,a,b,i:integer);
begin
Form1.imgami.Canvas.Pen.Color:=clBlue;
Form1.imgami.Canvas.Pen.Width:=2;
Form1.imgami.Canvas.MoveTo(ax+(i-1)*b,ay);
Form1.imgami.Canvas.LineTo(ax+(i-1)*b,ay+a);
Form1.imgami.Canvas.LineTo(ax+b+(i-1)*b,ay+a);
Form1.imgami.Canvas.LineTo(ax+b+(i-1)*b,ay);
12

end;

procedure ami0(ax,ay,a,b,i:integer);
begin
Form1.imgami.Canvas.Pen.Color:=clBlue;
Form1.imgami.Canvas.Pen.Width:=2;
Form1.imgami.Canvas.MoveTo(ax+(i-1)*b,ay);
Form1.imgami.Canvas.LineTo(ax+b+(i-1)*b,ay);
end;

//----------------------------- Procedure HDB3 -------------------------------//

procedure hdb3plus(ax,ay,a,b,i:integer);
begin
Form1.imghdb.Canvas.Pen.Color:=clBlue;
Form1.imghdb.Canvas.Pen.Width:=2;
Form1.imghdb.Canvas.MoveTo(ax+(i-1)*b,ay);
Form1.imghdb.Canvas.LineTo(ax+(i-1)*b,ay-a);
Form1.imghdb.Canvas.LineTo(ax+b+(i-1)*b,ay-a);
Form1.imghdb.Canvas.LineTo(ax+b+(i-1)*b,ay);
end;

procedure hdb3minus(ax,ay,a,b,i:integer);
begin
Form1.imghdb.Canvas.Pen.Color:=clBlue;
Form1.imghdb.Canvas.Pen.Width:=2;
Form1.imghdb.Canvas.MoveTo(ax+(i-1)*b,ay);
Form1.imghdb.Canvas.LineTo(ax+(i-1)*b,ay+a);
Form1.imghdb.Canvas.LineTo(ax+b+(i-1)*b,ay+a);
Form1.imghdb.Canvas.LineTo(ax+b+(i-1)*b,ay);
end;

procedure hdb3nol(ax,ay,a,b,i:integer);
begin
13

Form1.imghdb.Canvas.Pen.Color:=clBlue;
Form1.imghdb.Canvas.Pen.Width:=2;
Form1.imghdb.Canvas.MoveTo(ax+(i-1)*b,ay);
Form1.imghdb.Canvas.LineTo(ax+b+(i-1)*b,ay);
end;

//------------------------------- Procedure Sumbu ----------------------------//

procedure sumbu;
var q,n:integer;
biner:string;

begin
biner:=Form1.Edit1.Text;
q:=length(biner);

//--------------------------------- Refresh Image ----------------------------//

form1.imgrz.Picture:=nil;
form1.imgrz.Refresh;
form1.imguni.Picture:=nil;
form1.imguni.Refresh;
form1.imgdman.Picture:=nil;
form1.imgdman.Refresh;
form1.imgami.Picture:=nil;
form1.imgami.Refresh;
form1.imghdb.Picture:=nil;
form1.imghdb.Refresh;
//form1.imgnrz.Picture:=nil;
//form1.imgnrz.Refresh;

//-------------------------- Sumbu Unipolar ----------------------------------//

Form1.imguni.Canvas.Pen.Color:=clBlack;
14

Form1.imguni.Canvas.Pen.Style:=pssolid;
Form1.imguni.Canvas.MoveTo(10,160);
Form1.imguni.Canvas.LineTo(10,160-145);
Form1.imguni.Canvas.TextOut(10,160-155,'Amplitudo');
Form1.imguni.Canvas.TextOut(10+150,160-155,'Unipolar');
Form1.imguni.Canvas.MoveTo(10,100);
Form1.imguni.Canvas.LineTo(10+370,100);
Form1.imguni.Canvas.TextOut(10+370,100+5,'Time');
Form1.imguni.Canvas.Pen.Color:=clBlue;
Form1.imguni.Canvas.Pen.Style:=psDot;
for n:=1 to q do
begin
Form1.imguni.Canvas.MoveTo(10+(30*n),160-130);
Form1.imguni.Canvas.LineTo(10+(30*n),160);
Form1.imguni.Canvas.TextOut((30*n)-5,160-130,biner[n]);
end;

//------------------------------- Sumbu RZ -----------------------------------//

Form1.imgrz.Canvas.Pen.Color:=clBlack;
Form1.imgrz.Canvas.Pen.Style:=pssolid;
Form1.imgrz.Canvas.MoveTo(10,160);
Form1.imgrz.Canvas.LineTo(10,160-145);
Form1.imgrz.Canvas.TextOut(10,160-155,'Amplitudo');
Form1.imgrz.Canvas.TextOut(10+150,160-155,'RZ');
Form1.imgrz.Canvas.MoveTo(10,100);
Form1.imgrz.Canvas.LineTo(10+370,100);
Form1.imgrz.Canvas.TextOut(10+370,100+5,'Time');
Form1.imgrz.Canvas.Pen.Color:=clBlue;
Form1.imgrz.Canvas.Pen.Style:=psDot;
for n:=1 to q do
begin
Form1.imgrz.Canvas.MoveTo(10+(30*n),160-130);
Form1.imgrz.Canvas.LineTo(10+(30*n),160);
15

Form1.imgrz.Canvas.TextOut((30*n)-5,160-130,biner[n]);
end;

//--------------------------- Sumbu NRZ-I ------------------------------------//

//Form1.imgnrz.Canvas.Pen.Color:=clBlack;
//Form1.imgnrz.Canvas.Pen.Style:=pssolid;
//Form1.imgnrz.Canvas.MoveTo(10,160);
//Form1.imgnrz.Canvas.LineTo(10,160-145);
//Form1.imgnrz.Canvas.TextOut(10,160-155,'Amplitudo');
//Form1.imgnrz.Canvas.TextOut(10+150,160-155,'NRZ-I');
//Form1.imgnrz.Canvas.MoveTo(10,100);
//Form1.imgnrz.Canvas.LineTo(10+370,100);
//Form1.imgnrz.Canvas.TextOut(10+370,100+5,'Time');
//Form1.imgnrz.Canvas.Pen.Color:=clBlue;
//Form1.imgnrz.Canvas.Pen.Style:=psDot;
//for n:=1 to q do
//begin
//Form1.imgnrz.Canvas.MoveTo(10+(30*n),160-130);
//Form1.imgnrz.Canvas.LineTo(10+(30*n),160);
//Form1.imgnrz.Canvas.TextOut((30*n)-5,160-130,biner[n]);
//end;

//---------------------- Sumbu D-Manchester ----------------------------------//

Form1.imgdman.Canvas.Pen.Color:=clBlack;
Form1.imgdman.Canvas.Pen.Style:=pssolid;
Form1.imgdman.Canvas.MoveTo(10,160);
Form1.imgdman.Canvas.LineTo(10,160-145);
Form1.imgdman.Canvas.TextOut(10,160-155,'Amplitudo');
Form1.imgdman.Canvas.TextOut(10+150,160-155,'D-MANCHESTER');
Form1.imgdman.Canvas.MoveTo(10,100);
Form1.imgdman.Canvas.LineTo(10+370,100);
Form1.imgdman.Canvas.TextOut(10+370,100+5,'Time');
16

Form1.imgdman.Canvas.Pen.Color:=clBlue;
Form1.imgdman.Canvas.Pen.Style:=psDot;
for n:=1 to q do
begin
Form1.imgdman.Canvas.MoveTo(10+(30*n),160-130);
Form1.imgdman.Canvas.LineTo(10+(30*n),160);
Form1.imgdman.Canvas.TextOut((30*n)-5,160-130,biner[n]);
end;

//------------------------------ Sumbu AMI -----------------------------------//

Form1.imgami.Canvas.Pen.Color:=clBlack;
Form1.imgami.Canvas.Pen.Style:=pssolid;
Form1.imgami.Canvas.MoveTo(10,160);
Form1.imgami.Canvas.LineTo(10,160-145);
Form1.imgami.Canvas.TextOut(10,160-155,'Amplitudo');
Form1.imgami.Canvas.TextOut(10+150,160-155,'AMI');
Form1.imgami.Canvas.MoveTo(10,100);
Form1.imgami.Canvas.LineTo(10+370,100);
Form1.imgami.Canvas.TextOut(10+370,100+5,'Time');
Form1.imgami.Canvas.Pen.Color:=clBlue;
Form1.imgami.Canvas.Pen.Style:=psDot;
for n:=1 to q do
begin
Form1.imgami.Canvas.MoveTo(10+(30*n),160-130);
Form1.imgami.Canvas.LineTo(10+(30*n),160);
Form1.imgami.Canvas.TextOut((30*n)-5,160-130,biner[n]);
end;

//----------------------------- Sumbu HDB3 -----------------------------------//

form1.imghdb.Canvas.Pen.Color:=clBlack;
form1.imghdb.Canvas.Pen.Style:=pssolid;
17

form1.imghdb.Canvas.MoveTo(10,160);
form1.imghdb.Canvas.LineTo(10,10-145);
form1.imghdb.Canvas.TextOut(10,160-155,'Amplitudo');
form1.imghdb.Canvas.TextOut(10+150,160-155,'HDB3');
form1.imghdb.Canvas.MoveTo(10,100);
form1.imghdb.Canvas.LineTo(10+370,100);
form1.imghdb.Canvas.TextOut(10+370,100+5,'Time');
form1.imghdb.Canvas.Pen.Color:=clBlue;
form1.imghdb.Canvas.Pen.Style:=psDot;
for n:=1 to q do
begin
form1.imghdb.Canvas.MoveTo(10+(30*n),160-130);
form1.imghdb.Canvas.LineTo(10+(30*n),160);
form1.imghdb.Canvas.TextOut((30*n)-5,160-130,biner[n]);
end;
end;

//----------------------------- Program Unipolar -----------------------------//

procedure unipolar;
var
tnd,ax,ay,a,b,n:integer;
biner:string;

begin
biner:=Form1.Edit1.Text;
ax:=10; ay:=100; a:=30; b:=15;
tnd:=0;
for n:=1 to length(biner) do
if biner[n]='1' then
if tnd=0 then begin tegak(ax,ay,b,a,n);
satu (ax,ay,b,a,n);
tnd:=1; end

18

else satu(ax,ay,b,a,n)
else if tnd=1 then begin tegak(ax,ay,b,a,n);
nol (ax,ay,b,a,n);
tnd:=0; end
else nol(ax,ay,b,a,n);
end;

//------------------------------- Program RZ ---------------------------------//

procedure rz2;
var ax,ay,a,b,n,q:integer;
biner:string;

begin
biner:=Form1.Edit1.Text;
q:=length(biner);
ax:=10; ay:=100; a:=15; b:=15;
for n:=1 to q do
if biner[n]='1' then begin
rz_1(ax,ay,b,a,n);
end
else if biner[n]='0' then
begin
rz_0(ax,ay,b,a,n);
end;
end;

//--------------------------- Program NRZ-I ----------------------------------//

//procedure nrzi;
//var
//tnd,ax,ay,a,b,n:integer;
//biner:string;
//begin
19

//biner:=Form1.Edit1.Text;
//ax:=10; ay:=100; a:=30; b:=15;
//tnd:=0;
//for n:=1 to length(biner) do
//if biner[n]='1' then
//if tnd=0 then
//begin
//tegakNRZI(ax,ay,b,a,n);
//satuNRZI(ax,ay,b,a,n);
//tnd:=1;
//end
//else
//begin
//tegakNRZI(ax,ay,b,a,n);
//nolNRZI(ax,ay,b,a,n);
//tnd:=0;
//end
//else
//if tnd=1 then
//begin
//satuNRZI(ax,ay,b,a,n);
//tnd:=1;
//end
// else
//begin
//nolNRZI(ax,ay,b,a,n);
//tnd:=0;
//end;
//end;

//---------------------- Program D-Manchester --------------------------------//

procedure dmanchester;
var
20

tnd, ax,ay,a,b,n:integer;
biner:string;
begin
biner:=Form1.Edit1.Text;
ax:=10; ay:=100; a:=15; b:=15;
tnd:=0;
for n:=1 to length(biner) do
begin
if biner[n]='1' then
if tnd = 0 then
begin dmncstr_1(ax,ay,b,a,n);
tnd:=1;
end
else
begin dmncstr_0(ax,ay,b,a,n);
tnd:=0;
end
else
if tnd = 0 then
begin dtegak(ax,ay,b,a,n);
dmncstr_0(ax,ay,b,a,n);
end
else
begin dtegak(ax,ay,b,a,n);
dmncstr_1(ax,ay,b,a,n);
end
end;
end;

//------------------------------- Program AMI --------------------------------//

procedure ami2;
var
tnd,ax,ay,a,b,n:integer;
21

biner,start:string;
begin
biner:=Form1.Edit1.Text;
ax:=10; ay:=100; a:=30; b:=15;
tnd:=0;
start:='atas';
if start='bawah' then tnd:=0
else if start='atas' then tnd:=1;
for n:=1 to length(biner) do
if biner[n]='1' then
if tnd=1 then
begin
ami1_1(ax,ay,b,a,n);
tnd:=0;
end
else
begin
ami1_2(ax,ay,b,a,n);
tnd:=1;
end
else
ami0(ax,ay,b,a,n);
end;

//-------------------------------- Program HDB3 ------------------------------//

procedure hdb3;
var
tnd,ax,ay,a,b,n,u:integer;
biner,start,tipe:string;
begin
biner:=Form1.Edit1.Text;
ax:=10; ay:=100; a:=30; b:=15;
tnd:=0;
22

start:='false';
tipe:='genap'; u:=0;
for n:=1 to length(biner) do
begin
if start='true' then
if n <= u then
begin
start:='true';
end
else
begin
start:='false';
end;
if biner[n]='1' then
begin
if tnd = 0 then
begin hdb3plus(ax,ay,b,a,n);
tnd:=1;
end
else
begin hdb3minus(ax,ay,b,a,n);
tnd:=0;
end;
if tipe='genap' then tipe:='ganjil' else tipe:='genap';
end
else if (biner[n-4]='0') and (biner[n-3]='0') and (biner[n-2]='0') and (biner[n-1]='0') and
(biner[n-1]='0') and
(biner[n]='0') and (biner[n+1]='0') and (biner[n+2]='0') and (biner[n+3]='0') then
begin
if tipe='genap' then tipe:='ganjil' else tipe:='genap';
end;
if (biner[n]='0') and (biner[n+1]='0') and (biner[n+2]='0') and (biner[n+3]='0') and
(start='false') then
begin
23

if tipe='genap' then
begin
if tnd = 1 then
begin
hdb3minus(ax,ay,b,a,n);
hdb3nol(ax,ay,b,a,n+1);
hdb3nol(ax,ay,b,a,n+2);
hdb3minus(ax,ay,b,a,n+3);
tnd:=0;
start:='true'; u:=n+3;
end
else
begin
hdb3plus(ax,ay,b,a,n);
hdb3nol(ax,ay,b,a,n+1);
hdb3nol(ax,ay,b,a,n+2);
hdb3plus(ax,ay,b,a,n+3);
tnd:=1;
start:='true'; u:=n+3;
end;
end
else if tipe='ganjil' then
begin
if tnd = 1 then
begin
hdb3nol(ax,ay,b,a,n);
hdb3nol(ax,ay,b,a,n+1);
hdb3nol(ax,ay,b,a,n+2);
hdb3plus(ax,ay,b,a,n+3);
tnd:=1;
start:='true'; u:=n+3;
end
else
begin
24

hdb3nol(ax,ay,b,a,n);
hdb3nol(ax,ay,b,a,n+1);
hdb3nol(ax,ay,b,a,n+2);
hdb3minus(ax,ay,b,a,n+3);
tnd:=0;
start:='true'; u:=n+3;
end;
end
end;
if biner[n]='0' then
begin
if start='false' then hdb3nol(ax,ay,b,a,n);
end;
end;
end;

procedure TForm1.ExitClick(Sender: TObject);


begin
Close ();
end;

procedure TForm1.ProsesClick(Sender: TObject);


begin
sumbu;
unipolar;
rz2;
//nrzi;
dmanchester;
ami2;
hdb3;
end;

procedure TForm1.unipbutClick(Sender: TObject);


begin
25

sumbu;
unipolar;
form1.imgrz.Picture:=nil;
form1.imgrz.Refresh;
form1.imgdman.Picture:=nil;
form1.imgdman.Refresh;
form1.imgami.Picture:=nil;
form1.imgami.Refresh;
form1.imghdb.Picture:=nil;
form1.imghdb.Refresh;
//form1.imgnrz.Picture:=nil;
//form1.imgnrz.Refresh;
end;

procedure TForm1.rzbutClick(Sender: TObject);


begin
sumbu;
rz2;
form1.imguni.Picture:=nil;
form1.imguni.Refresh;
form1.imgdman.Picture:=nil;
form1.imgdman.Refresh;
form1.imgami.Picture:=nil;
form1.imgami.Refresh;
form1.imghdb.Picture:=nil;
form1.imghdb.Refresh;
//form1.imgnrz.Picture:=nil;
//form1.imgnrz.Refresh;
end;

//procedure TForm1.nrzibutClick(Sender: TObject);


//begin
//sumbu;
//nrzi;
26

//form1.imgrz.Picture:=nil;
//form1.imgrz.Refresh;
//form1.imguni.Picture:=nil;
//form1.imguni.Refresh;
//form1.imgdman.Picture:=nil;
//form1.imgdman.Refresh;
//form1.imgami.Picture:=nil;
//form1.imgami.Refresh;
//form1.imghdb.Picture:=nil;
//form1.imghdb.Refresh;
//end;

procedure TForm1.dmanbutClick(Sender: TObject);


begin
sumbu;
dmanchester;
form1.imgrz.Picture:=nil;
form1.imgrz.Refresh;
form1.imguni.Picture:=nil;
form1.imguni.Refresh;
form1.imgami.Picture:=nil;
form1.imgami.Refresh;
form1.imghdb.Picture:=nil;
form1.imghdb.Refresh;
//form1.imgnrz.Picture:=nil;
//form1.imgnrz.Refresh;
end;

procedure TForm1.amibutClick(Sender: TObject);


begin
sumbu;
ami2;
form1.imgrz.Picture:=nil;
form1.imgrz.Refresh;
27

form1.imguni.Picture:=nil;
form1.imguni.Refresh;
form1.imgdman.Picture:=nil;
form1.imgdman.Refresh;
form1.imghdb.Picture:=nil;
form1.imghdb.Refresh;
//form1.imgnrz.Picture:=nil;
//form1.imgnrz.Refresh;
end;

procedure TForm1.hdb3butClick(Sender: TObject);


begin
sumbu;
hdb3;
form1.imgrz.Picture:=nil;
form1.imgrz.Refresh;
form1.imguni.Picture:=nil;
form1.imguni.Refresh;
form1.imgdman.Picture:=nil;
form1.imgdman.Refresh;
form1.imgami.Picture:=nil;
form1.imgami.Refresh;
//form1.imgnrz.Picture:=nil;
//form1.imgnrz.Refresh;
end;

procedure TForm1.ClearClick(Sender: TObject);


begin
form1.imgrz.Picture:=nil;
form1.imgrz.Refresh;
form1.imguni.Picture:=nil;
form1.imguni.Refresh;
form1.imgdman.Picture:=nil;
form1.imgdman.Refresh;
28

form1.imgami.Picture:=nil;
form1.imgami.Refresh;
form1.imghdb.Picture:=nil;
form1.imghdb.Refresh;
//form1.imgnrz.Picture:=nil;
//form1.imgnrz.Refresh;
end;
end.

2.3 Hasil Percobaan

29

BAB III
PENUTUP
3.1 Kesimpulan
1.

Data digital merupakan data yang memiliki deretan nilai yang berbeda dan
memiliki ciri-ciri tersendiri dan Sinyal digital merupakan hasil teknologi yang
dapat mengubah signal menjadi kombinasi urutan bilangan 0 dan 1

2.

Pengkodean unipolar hanya menggunakan sebuah level tegangan untuk


menyatakan dua posisi bilangan biner yaitu yaitu 0V dan +V untuk menyatakan
data biner 0 dan 1.

3.

Pengkodean saluran jenis Return to Zero (RZ) menggunakan level V dan +V


dengan transisi di pertengahan bit data biner. Data biner 0 dinyatakan dengan
transisi dari level V menuju 0V, sedangkan data biner 1 dinyatakan dengan
transisi dari level 0V menuju +V.

4.

Pengkodean D-Mancaster merupakan suatu kode di mana biner 0 diwakili oleh


adanya transisi di awal periode suatu bit dan biner 1 diwakili oleh ketiadaan
transisi di awal periode suatu bit.

5.

Pengkodean AMI merupakan suatu kode dimana binary '0' diwakili dengan tidak
adanya line sinyal dan binary '1' diwakili oleh suatu pulsa positif atau negatif.

6.

Pengkodean HDB3 adalah suatu kode yang menggantikan string-string dari 4 nol
dengan rangkaian yang mengandung satu atau dua pulsa, atau disebut violation
code. Jika violasi terakhir positif maka violasi berikutnya pasti negatif, begitu pula
sebaliknya.

30