Sunteți pe pagina 1din 2

Rangkailah rangkaian dan komponen hingga seperti hasil gambar dibawah :

Proteus Pembuatan Radar sesuai arah mata angin menggunakan Bascom AVR
dengan ditambahkan button untuk merubah arah mata angin.

Source Code:
$regfile = "m16def.dat"
$crystal = 11059200
Config Portb = Output
Config Pinc.0 = Output
Config Pinc.1 = Input

Port_led Alias Portb


Middle_led Alias Pinc.0
Button Alias Pinc.1
Button = 1
Dim Data_led As Byte , X As Byte
Dim Direction As Boolean
Dim Stopped As Boolean

Dim Flag As Boolean


Flag = 1
Stopped = 0
Direction = 0
Data_led = &B00000001

Middle_led = 1
Do
If Button = 0 Then
If Flag = 1 Then
Stopped = Not Stopped

If Stopped = 0 Then
Direction = Not Direction
End If
Flag = 0
End If
Else
Flag = 1
End If

If Stopped = 0 Then
If Direction = 1 Then
Rotate Data_led , Left , 1
Else
Rotate Data_led , Right , 1
End If
End If
Port_led = Data_led
Waitms 200
Loop

S-ar putea să vă placă și