Senin, 12 September 2011

Pemrograman Parallel Port

Program nyala_lampu_CK; { common catode}
Var I : byte;
Procedure nyala_naik_1; {menyala "naik" satu per satu}
Begin
         I := 1;
         Repeat
                   Port [$378] := i;
                   I := I * 2;
         Until I > 255;
End;
Procedure nyala_turun_1; {menyala turun satu per satu}
Begin
         I := 255;
         Repeat
                   Port [$378] := i;
                   I := I div 2;
         Until I < 1;
End;
Procedure nyala_naik_2; {menyala naik biner}
Begin
         I := 0;
         Repeat
                   Port [$378] := i;
                   Inc ( I );
         Until I > 255;
End;
Procedure nyala_turun_2; {menyala turun biner}
Begin
         I := 255;                   
         Repeat
                   Port [$378] := i;
                   I := I - 1;
         Until I < 0;
End;

{Program utama}
Begin
        nyala_naik_1;
        nyala_turun_1;
        nyala_naik_2;
        nyala_turun_2;
End.

Tidak ada komentar:

Posting Komentar