Anda di halaman 1dari 29

LAPORAN PRAKTIKUM

( KOMUNIKASI DATA) PROGRAM STUDI TEKNIK TELEKOMUNIKASI D3

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

Disusun oleh : Abd. Hadi Muzaki T. Telekomunikasi / 2D

KEMENTRIAN PENDIDIKAN DAN KEBUDAYAAN

POLITEKNIK NEGERI MALANG

Laporan Praktikum Komunikasi Data Jl. Soekarno Hatta 9 PO. BOX 04 Malang 65141 Telp. (0341) 404424-25 (Hunting) Fax. (0341)404420 http://www.poltek-malang.ac.id

I. Tujuan

a. Menampilkan simulasi sinyal RZ, NRZ-L, Manch, HDB3 b. Memahami Perbedaan Sinyal RZ, NRZ-L, Manch, HDB3 c. Memahami Pemrograman Delphi. d. Membuat program untuk mensimulasi Karakteristik Sinyal Analog dan Sinyal Digital.

II. Alat & Bahan

a. Program delphi versi 6 ke atas b. Satu unit Komputer

III. Langkah Kerja


a. Membuat form sesuai ketentuan b. Mengedit caption, name, label dan lain-lain c. Membuat program d. Memperbaiki jika terjadi eror pada program e. Menjalankan program

Laporan Praktikum Komunikasi Data

IV. Flowchart Program Utama


START

inisialisasi library, form dan objek pendukung

Baca input data dari komponen edit

Apakah data kosong? Hapus kanvas

Hapus kanvas

Tampilkan dialog box perintah untuk input data

Gambar sumbu

Laporan Praktikum Komunikasi Data

Gambar gelombang kotak

Gambar gelombang RZ

Gambar gelombang NRZ-L

Gambar gelombang manchester

Gambar gelombang HDB3

Apakah ada perubahan data?


YA

TDK

Laporan Praktikum Komunikasi Data

Flowchart Gelombang Kotak

START

i=0

i=jumlah data? TDK data[i] = 1 ? YA gambar sinyal 1 dengan amplitudo = koordinat y-100

YA

TDK

gambar sinyal 0 dengan amplitudo = koordinat y

apa data ke i tidak sama dengan data setelahnya?

TDK

YA

START Laporan Praktikum Komunikasi Data

gambar garis vertikal yang menghubungkan 2 sinyal data yang

i:=i+i

END

Flowchart Gelombang RZ

i=0

i=jumlah data? TDK data[i] = 1 ? YA

YA

TDK

Laporan Praktikum Komunikasi Data

gambar garis vertikal naik dari (x2,y1) ke (x2,y1-100)

gambar garis vertikal turun dari (x2,y1) ke (x2,y1+100)

tarik garis horizontal ke koordinat ((x2+pnjg), y1100)

tarik garis horizontal ke koordinat ((x2+pnjg), y1+100)

tarik garis vertikal kembali menuju sumbu x dgn koordinat ((x2+pnjg),y1-1)

tarik garis vertikal kembali menuju sumbu x dgn koordinat ((x2+pnjg),y1-1)

tarik garis horizontal sejajar sumbu x menuju end point pad akoordinat ((x2+2*pnjg),y1-1)

tarik garis horizontal sejajar sumbu x menuju end point pad akoordinat ((x2+2*pnjg),y1-1)

i:=i+i

END

Flowchart Gelombang NRZ-L

nrzl.Canvas.MoveTo(x1,y1nrzl.Canvas.MoveTo(x1,y1+2 nrzl.Canvas.LineTo(x2,y1nrzl.Canvas.LineTo(x2,y1+25 j=jumlah data[j] = YA 5); 25); YA ); data? 0 ?

Laporan Praktikum Komunikasi Data

START

i:=0

TDK TDK

x1:=i*round(pnjg)-round(pnjg); x2:=(i+1)*round(pnjg)round(pnjg);

nrzl.Canvas.MoveTo(x2,y1-25); nrzl.Canvas.LineTo(x2,y1+25);

Laporan Praktikum Komunikasi Data

data[j] = 0? 1 ? YA

TDK

nrzl.Canvas.MoveTo(x2,y1-25); nrzl.Canvas.LineTo(x2,y1+25);

i:=i+i

END

Flowchart gelombang Manchester


START

i=0

i=jumlah data? TDK data[i] = 0 ?

YA

END

Laporan Praktikum Komunikasi Data

tempatkan pixel pada posisi (x2,y1-25)

tempatkan pixel pada posisi (x2,y1+25)

tarik garis horizontal ke titik (x2+pnjg),y1-25)

tarik garis horizontal ke titik (x2+pnjg),y1+25)

tarik garis vertikal turun ke (x2+pnjg),y1+25)

tarik garis vertikal naik ke (x2+pnjg),y1-25)

tarik garis horizontal ke ((x2+2*pnjg),y1+25)

tarik garis horizontal ke ((x2+2*pnjg),y1-25)

data[i]=data[ i+1] ?

tempatkan pixel pada posisi ((x2+2*pnjg),y1+25) tarik garis vertikal naik ke ((x2+2*pnjg),y1-25)

END

i:=i+i

Laporan Praktikum Komunikasi Data

Flowchart Program HDB3


START

jumnol:=0; jumsat:=0; p:=1; flag:=0; j:=1

j=jumlah data?

hdb3.Canvas.Pen.style:=pssolid; hdb3.Canvas.Pen.Color:=clred; hdb3.Canvas.MoveTo(0,y1-1); hdb3.Canvas.LineTo(1000,y1-1); x1:=round(j*pnjg-pnjg); x2:=round(x1+pnjg);

data[j] = 1 ? YA flag=0 ? YA p:=p+ 1


jumnol:=0; jumsat:=jumsat+1; cons:=round(Power(1,p)*25); with hdb3.Canvas do MoveTo(x1,round(y1-1)); LineTo(x1,round(y1-cons)); LineTo(x2,round(y1-cons)); LineTo(x2,round(y1-1));

TDK p:=p; jumnol:=jumnol+1;

TDK

p:=p

jumnol mod 4 =0?

TDK

YA flag:=1; hdb3.Canvas.MoveTo(x1,y11); hdb3.Canvas.LineTo(x1,y1cons); hdb3.Canvas.LineTo(x2,y1cons); hdb3.Canvas.LineTo(x2,y1-1);

flag =0

Laporan Praktikum Komunikasi Data

TDK flag=0 p:=p+1; ? cons:=round(Power(1,p)*25); YA hdb3.Canvas.MoveTo(x2,y11); hdb3.Canvas.LineTo(x2,y1cons); hdb3.Canvas.LineTo(round(x2 End +pnjg),y1-cons); hdb3.Canvas.LineTo(round(x2 +pnjg),y1-1);

V. Listing Program

unit alldigital;

interface

uses

Laporan Praktikum Komunikasi Data

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

type Tfrmdigital = class(TForm) kotak: TImage; Label1: TLabel; rz: TImage; nrzl: TImage; manchester: TImage; hdb3: TImage; Label2: TLabel; Label4: TLabel; Label5: TLabel; Panel1: TPanel; eddata: TEdit; Label8: TLabel; Label6: TLabel; bitrate: TEdit; label3: TLabel; procedure eddataChange(Sender: TObject);

procedure FormShow(Sender: TObject); private

Laporan Praktikum Komunikasi Data

{ Private declarations } public { Public declarations } end;

var frmdigital: Tfrmdigital;

implementation

{$R *.dfm}

procedure sumbu(image:Timage;ax,ay,b,c:integer); begin image.Canvas.Pen.Color:=clblack; image.Canvas.MoveTo(ax,ay); image.Canvas.LineTo(ax+b,ay); image.Canvas.MoveTo(ax,ay); image.Canvas.LineTo(ax,ay-c); image.Canvas.MoveTo(ax,ay); image.Canvas.LineTo(ax,ay+c); end;

Laporan Praktikum Komunikasi Data

procedure grid(image:Timage); var i,n:integer; pnjg:double; begin n:=length(frmdigital.eddata.Text); pnjg:=frmdigital.kotak.Width/round(n); for i:=1 to n do begin image.Canvas.Pen.Style:=psdot; image.Canvas.MoveTo(round(pnjg*i),0); image.Canvas.LineTo(round(pnjg*i),100); end; end;

procedure Tfrmdigital.eddataChange(Sender: TObject); var cons,i,n,p,x1,x2,y1,y2,nol,z,awal:integer; j,jumnol,jumsat,flag:integer; data,biner:string; pnjg,br:double;

Laporan Praktikum Komunikasi Data

a,pol:boolean;

begin x1:=0; y1:=50;

if length(eddata.Text)=0 then begin Showmessage('Masukkan input data biner'); eddata.SetFocus; kotak.Picture:=nil; rz.Picture:=nil; nrzl.Picture:=nil; manchester.Picture:=nil; hdb3.Picture:=nil; end else

begin data:=eddata.Text; n:=length(eddata.Text); pnjg:=kotak.Width/round(n); br:=1/n;

Laporan Praktikum Komunikasi Data

frmdigital.bitrate.Text:=floattostr(br);

kotak.Picture:=nil; rz.Picture:=nil; nrzl.Picture:=nil; manchester.Picture:=nil; hdb3.Picture:=nil;

sumbu(kotak,x1,y1,1000,50); sumbu(rz,x1,y1,1000,50); sumbu(nrzl,x1,y1,1000,50); sumbu(manchester,x1,y1,1000,50); sumbu(hdb3,x1,y1,1000,50);

kotak.Canvas.Pen.Color:=clblue; rz.Canvas.Pen.Color:=clfuchsia; nrzl.Canvas.Pen.Color:=clpurple; manchester.Canvas.Pen.Color:=clred; { startpen(kotak); startpen(rz); startpen(nrzl);

Laporan Praktikum Komunikasi Data

startpen(manchester); startpen(hdb3); }

//=======================Gambar gelombang kotak=======================

for i:=0 to n do begin if data[i] = '1' then begin x1:=i*round(pnjg)-round(pnjg); x2:=(i+1)*round(pnjg)-round(pnjg); kotak.Canvas.MoveTo(x1,y1-25); kotak.Canvas.LineTo(x2,y1-25); end else begin x1:=i*round(pnjg)-round(pnjg); x2:=(i+1)*round(pnjg)-round(pnjg); kotak.Canvas.MoveTo(x1,y1-1); kotak.Canvas.LineTo(x2,y1-1); end; if data[i]<>data[i+1] then begin

Laporan Praktikum Komunikasi Data

x2:=(i+1)*round(pnjg)-round(pnjg); kotak.Canvas.MoveTo(x2,y1-25); kotak.Canvas.LineTo(x2,y1-1); end end; //================================= ================================= == //=======================Gambar gelombang NRZ-L======================= for i:=0 to n do begin if data[i] = '0' then begin x1:=i*round(pnjg)-round(pnjg); nrzl.Canvas.MoveTo(x1,y1-25); x2:=(i+1)*round(pnjg)-round(pnjg); nrzl.Canvas.LineTo(x2,y1-25); end else begin x1:=i*round(pnjg)-round(pnjg); nrzl.Canvas.MoveTo(x1,y1+25); x2:=(i+1)*round(pnjg)-round(pnjg); nrzl.Canvas.LineTo(x2,y1+25);

Laporan Praktikum Komunikasi Data

end;

if data[i]<>data[i+1] then begin x2:=(i+1)*round(pnjg)-round(pnjg); nrzl.Canvas.MoveTo(x2,y1-25); nrzl.Canvas.LineTo(x2,y1+25); end end;

//================================= ================================= == //=======================Gambar gelombang Manchester================== pnjg:=round(manchester.Width/round(2*n)); for i:=0 to n do begin if data[i] = '0' then begin x2:=round((2*i*pnjg)-(2*pnjg));

manchester.Canvas.MoveTo(x2,y1-25); manchester.Canvas.LineTo(round(x2+pnjg),y1-25); manchester.Canvas.LineTo(round(x2+pnjg),y1+25);

Laporan Praktikum Komunikasi Data

manchester.Canvas.LineTo(round(x2+2*pnjg),y1+25) ;

end //endif else begin x2:=round((2*i*pnjg)-(2*pnjg));

manchester.Canvas.MoveTo(x2,y1+25); manchester.Canvas.LineTo(round(x2+pnjg),y1+25); manchester.Canvas.LineTo(round(x2+pnjg),y1-25); manchester.Canvas.LineTo(round(x2+2*pnjg),y1-25); end; //endif

if data[i]=data[i+1] then begin manchester.Canvas.MoveTo(round(x2+2*pnjg),y1+2 5); manchester.Canvas.LineTo(round(x2+2*pnjg),y1-25); end;

end;

//end loop

Laporan Praktikum Komunikasi Data

//================================= ================================= ==

//=======================Gambar gelombang RZ========================== pnjg:=round(rz.Width/round(2*n)); for i:=0 to n do begin if data[i] = '1' then begin x2:=round((2*i*pnjg)-(2*pnjg)); rz.Canvas.MoveTo(x2,y1-1); rz.Canvas.LineTo(x2,y1-25); rz.Canvas.LineTo(round(x2+pnjg),y1-25); rz.Canvas.LineTo(round(x2+pnjg),y1-1); rz.Canvas.LineTo(round(x2+2*pnjg),y1-1);

end else begin x2:=round((2*i*pnjg)-(2*pnjg)); rz.Canvas.MoveTo(x2,y1-1); rz.Canvas.LineTo(x2,y1+25); rz.Canvas.LineTo(round(x2+pnjg),y1+25);

Laporan Praktikum Komunikasi Data

rz.Canvas.LineTo(round(x2+pnjg),y1-1); rz.Canvas.LineTo(round(x2+2*pnjg),y1-1); end;

end;

//================================= ================================= ==

//=======================Gambar gelombang HDB3========================

data:=eddata.Text; n:=length(eddata.Text); pnjg:=hdb3.Width/round(n);

jumnol:=0; jumsat:=0; p:=1; cons:=0;

flag:=0;

Laporan Praktikum Komunikasi Data

for j:=1 to n do begin hdb3.Canvas.Pen.style:=pssolid; hdb3.Canvas.Pen.Color:=clteal; hdb3.Canvas.MoveTo(0,y1-1); hdb3.Canvas.LineTo(1000,y1-1); x1:=round(j*pnjg-pnjg); x2:=round(x1+pnjg); //================================= ================================= ============ if data[j] = '1' then begin

if flag=0 then p:=p+1 else p:=p; jumnol:=0; jumsat:=jumsat+1; cons:=round(Power(-1,p)*25); with hdb3.Canvas do begin MoveTo(x1,round(y1-1)); LineTo(x1,round(y1-cons)); LineTo(x2,round(y1-cons));

Laporan Praktikum Komunikasi Data

LineTo(x2,round(y1-1)); end end

else if data[j] = '0' then begin p:=p; jumnol:=jumnol+1; if(jumnol mod 4 =0) then begin flag:=1;

hdb3.Canvas.MoveTo(x1,y1-1); hdb3.Canvas.LineTo(x1,y1-cons); hdb3.Canvas.LineTo(x2,y1-cons); hdb3.Canvas.LineTo(x2,y1-1); end //endif else flag := 0;

if flag=1 then begin p:=p+1;

Laporan Praktikum Komunikasi Data

cons:=round(Power(-1,p)*25); hdb3.Canvas.MoveTo(x2,y1-1); hdb3.Canvas.LineTo(x2,y1-cons); hdb3.Canvas.LineTo(round(x2+pnjg),y1-cons); hdb3.Canvas.LineTo(round(x2+pnjg),y1-1); end //endif

//else nol.Font.Color:=clblack;

end;

end;

end;

end;

Laporan Praktikum Komunikasi Data

//================================= ================================= ==

procedure Tfrmdigital.FormShow(Sender: TObject); begin kotak.Picture:=nil; rz.Picture:=nil; nrzl.Picture:=nil; manchester.Picture:=nil; hdb3.Picture:=nil; eddata.Text:='1010'; end;

end.

Laporan Praktikum Komunikasi Data

VI. .Simulasi (RZ, NRZ-L, Manch, HDB3)

Laporan Praktikum Komunikasi Data