YA KUNTIL, SAMA SAMA ^^
unit Unit1;
interface
uses
 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
 Dialogs, StdCtrls, ExtCtrls;
type
 Tfrmsinyal = class(TForm)
  rz: TImage;
  Edit1: TEdit;
  btKeluar: TButton;
  uni: TImage;
  nrzl: TImage;
  nrzi: TImage;
  man: TImage;
  dman: TImage;
  ami: TImage;
  b8zs: TImage;
  hdb3: TImage;
  Label1: TLabel;
  Label2: TLabel;
  Label3: TLabel;
  Label4: TLabel;
  Label5: TLabel;
  Label6: TLabel;
  Label7: TLabel;
                            YA KUNTIL, SAMA SAMA ^^
  Label8: TLabel;
  Label9: TLabel;
  procedure Edit1Change(Sender: TObject);
  procedure btKeluarClick(Sender: TObject);
 private
  { Private declarations }
 public
  { Public declarations }
 end;
var
 frmsinyal: Tfrmsinyal;
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);
 image.Canvas.Pen.Width:=3;
end;
                           YA KUNTIL, SAMA SAMA ^^
procedure Tfrmsinyal.Edit1Change(Sender: TObject);
var
 x1,x2,y1,y2,i,n,tnd1,tnd2,tnd3,tnd4:integer;
 data:string;
 pnjg:double;
begin
 x1:=0;
 y1:=50;
 if length(Edit1.Text)=0 then
  begin
  Showmessage('masukkan input data biner');
  Edit1.SetFocus;
  end
  else begin
  data:=Edit1.Text;
  n:=length(Edit1.Text);
  rz.Picture:=nil;         //rz
  sumbu(rz,x1,y1,1000,100);
  rz.Canvas.Pen.Color:=clblue;
  uni.Picture:=nil;        //uni polar
  sumbu(uni,x1,y1,1000,100);
  uni.Canvas.pen.Color:=clblue;
  nrzl.Picture:=nil;       //nrzl
  sumbu(nrzl,x1,y1,1000,100);
  nrzl.Canvas.pen.Color:=clblue;
                       YA KUNTIL, SAMA SAMA ^^
 nrzi.Picture:=nil;     //nrzi
 sumbu(nrzi,x1,y1,1000,100);
 nrzi.Canvas.pen.Color:=clblue;
 man.Picture:=nil;       //Manchester
 sumbu(man,x1,y1,1000,100);
 man.Canvas.Pen.Color:=clblue;
 dman.Picture:=nil;       //D-Manchester
 sumbu(dman,x1,y1,1000,100);
 dman.Canvas.pen.Color:=clblue;
 ami.Picture:=nil;       //ami
 sumbu(ami,x1,y1,1000,100);
 ami.Canvas.pen.Color:=clblue;
 b8zs.Picture:=nil;      //b8zs
 sumbu(b8zs,x1,y1,1000,100);
 b8zs.Canvas.pen.Color:=clblue;
 hdb3.Picture:=nil;       //hdb3
 sumbu(hdb3,x1,y1,1000,100);
 hdb3.Canvas.pen.Color:=clblue;
//===============================gambar===============================/
/
 tnd1:=1; tnd2:=1; tnd3:=1; tnd4:=1;
 pnjg:=round(rz.width/round(2*n));
 for i:=0 to n do
 begin
                        YA KUNTIL, SAMA SAMA ^^
if data[i]='1' then
begin //========================jika data ='1'======================
 x2:=round((2*i*pnjg)-(2*pnjg));
 rz.canvas.MoveTo(x2,y1-1);                 //RZ
 rz.canvas.LineTo(x2,y1-30);
 rz.canvas.LineTo(round(x2+pnjg),y1-30);
 rz.canvas.LineTo(round(x2+pnjg),y1-1);
 rz.canvas.LineTo(round(x2+2*pnjg),y1-1);
 uni.canvas.LineTo(x2,y1-30);
 uni.canvas.LineTo(round(x2+2*pnjg),y1-30);        //UNI POLAR
 nrzl.Canvas.LineTo(x2,y1+30);              //NRZL
 nrzl.Canvas.LineTo(round(x2+pnjg*2),y1+30);
 if tnd1=0 then begin               //NRZI
   nrzi.Canvas.MoveTo(x2,y1+30);
   nrzi.Canvas.LineTo(x2,y1-30);
   nrzi.Canvas.LineTo(round(x2+pnjg*2),y1-30);
   tnd1:=1;
 end
 else begin
   nrzi.Canvas.MoveTo(x2,y1-30);
   nrzi.Canvas.LineTo(x2,y1+30);
   nrzi.Canvas.LineTo(round(x2+pnjg*2),y1+30);
   tnd1:=0;
 end;
 if tnd2=0 then begin               //AMI
                       YA KUNTIL, SAMA SAMA ^^
 ami.Canvas.MoveTo(x2,y1);
 ami.Canvas.LineTo(x2,y1+30);
 ami.Canvas.LineTo(round(x2+pnjg*2),y1+30);
 ami.Canvas.LineTo(round(x2+pnjg*2),y1);
 tnd2:=1;
end
else begin
 ami.Canvas.MoveTo(x2,y1);
 ami.Canvas.LineTo(x2,y1-30);
 ami.Canvas.LineTo(round(x2+pnjg*2),y1-30);
 ami.Canvas.LineTo(round(x2+pnjg*2),y1);
 tnd2:=0;
end;
man.Canvas.LineTo(x2,y1+30);          //MANC
man.Canvas.LineTo(round(x2+pnjg),y1+30);
man.Canvas.LineTo(round(x2+pnjg),y1-30);
man.Canvas.LineTo(round(x2+2*pnjg),y1-30);
if tnd3=1 then begin
dman.Canvas.LineTo(x2,y1-30);         //DMANC
dman.Canvas.LineTo(round(x2+pnjg),y1-30);
dman.Canvas.LineTo(round(x2+pnjg),y1+30);
dman.Canvas.LineTo(round(x2+2*pnjg),y1+30);
tnd3:=0;
end
else begin
                       YA KUNTIL, SAMA SAMA ^^
dman.Canvas.LineTo(x2,y1+30);
dman.Canvas.LineTo(round(x2+pnjg),y1+30);
dman.Canvas.LineTo(round(x2+pnjg),y1-30);
dman.Canvas.LineTo(round(x2+2*pnjg),y1-30);
tnd3:=1;
end;
if tnd2=1 then begin             //HDB3
 hdb3.Canvas.MoveTo(x2,y1);
 hdb3.Canvas.LineTo(x2,y1-30);
 hdb3.Canvas.LineTo(round(x2+pnjg*2),y1-30);
 hdb3.Canvas.LineTo(round(x2+pnjg*2),y1);
 tnd2:=0;
end
else begin
 hdb3.Canvas.MoveTo(x2,y1);
 hdb3.Canvas.LineTo(x2,y1+30);
 hdb3.Canvas.LineTo(round(x2+pnjg*2),y1+30);
 hdb3.Canvas.LineTo(round(x2+pnjg*2),y1);
 tnd2:=1;
end;
if tnd2=0 then begin             // B8ZS
 b8zs.Canvas.MoveTo(x2,y1);
 b8zs.Canvas.LineTo(x2,y1-30);
 b8zs.Canvas.LineTo(round(x2+pnjg*2),y1-30);
 b8zs.Canvas.LineTo(round(x2+pnjg*2),y1);
                    YA KUNTIL, SAMA SAMA ^^
   tnd2:=1;
 end
 else begin
   b8zs.Canvas.MoveTo(x2,y1);
   b8zs.Canvas.LineTo(x2,y1+30);
   b8zs.Canvas.LineTo(round(x2+pnjg*2),y1+30);
   b8zs.Canvas.LineTo(round(x2+pnjg*2),y1);
   tnd2:=0;
 end;
 end//====================jika data='0'=========================
else begin
 x2:=round((2*i*pnjg)-(2*pnjg));
 rz.canvas.MoveTo(x2,y1-1);            //RZ
 rz.canvas.LineTo(x2,y1+30);
 rz.canvas.LineTo(round(x2+pnjg),y1+30);
 rz.canvas.LineTo(round(x2+pnjg),y1-1);
 rz.canvas.LineTo(round(x2+2*pnjg),y1-1);
 uni.canvas.LineTo(x2,y1-1);           //UNI POLAR
 uni.canvas.LineTo(round(x2+2*pnjg),y1-1);
 nrzl.canvas.LineTo(x2,y1-30);            //NRZL
 nrzl.canvas.LineTo(round(x2+2*pnjg),y1-30);
 if tnd1=0 then                    //NRZI
    nrzi.canvas.LineTo(round(x2+2*pnjg),y1+30)
 else nrzi.canvas.LineTo(round(x2+2*pnjg),y1-30);
 ami.canvas.LineTo(x2,y1);             //AMI
                          YA KUNTIL, SAMA SAMA ^^
       ami.canvas.LineTo(round(x2+2*pnjg),y1);
       man.Canvas.LineTo(x2,y1-30);          //MANC
       man.Canvas.LineTo(round(x2+pnjg),y1-30);
       man.Canvas.LineTo(round(x2+pnjg),y1+30);
       man.Canvas.LineTo(round(x2+2*pnjg),y1+30);
       dman.Canvas.LineTo(x2,y1+30);              //DMANC
       dman.Canvas.LineTo(round(x2+pnjg),y1+30);
       dman.Canvas.LineTo(round(x2+pnjg),y1-30);
       dman.Canvas.LineTo(round(x2+2*pnjg),y1-30);
       hdb3.canvas.LineTo(x2,y1);           //HDB3
       hdb3.canvas.LineTo(round(x2+2*pnjg),y1);
       b8zs.canvas.LineTo(x2,y1);           //B8ZS
       b8zs.canvas.LineTo(round(x2+2*pnjg),y1);
       end;
   end;
  end;
end;
procedure Tfrmsinyal.btKeluarClick(Sender: TObject);
begin
 frmsinyal.Close;
end;
end.