Selasa, 20 Maret 2012

Berikut tahap-tahap dalam membuat DC Motor Speed Control dengan AVR
Alat-alat yang dibutuhkan adalah sebagai berikut:
  1. ATMEGA-16
  2. 1N4148 —> Driver Motor
  3. Led-Bargraph-Green —> Indikator Speed
  4. Motor-DC
Langkah selanjutnya adalah melakukan simulasi dengan menggunakan beberapa software pendukung, software yang dibutuhkan adalah:
  1. Proteus(ISIS 7 Professional)
  2. Bascom-AVR
Mari kita mulai untuk melakukan simulasi terlebih dahulu:
  1. Buatlah rangkaian sesuai dengan gambar di bawah ini dengan menggunakan Software Proteus(ISIS 7 Profesional):
  2. setelah selesai merangkai gunakan software Bascom-AVR dengan mengetikkan kode sebagai berikut:


$regfile = “m16def.dat”
$crystal = 1000000
‘============================================================================
Config Timer1 = Pwm , Pwm = 8 , Compare A Pwm = Clear Down , Prescale = 1024
Config Portb = Input
Config Portc = Output
Config Porta = Output
‘============================================================================
Dim A As Word , B As Bit
‘============================================================================
Declare Sub Progress(num As Word)
‘============================================================================
A = 100
Pwm1a = A

Portc.0 = 1
Portc.1 = 0
B = 0
‘============================================================================
Do
‘////////////////////////////////////////////////////////////////////////////
If Pinb.0 = 1 Then
A = A + 10
If A >= 250 Then A = 250
Pwm1a = A
Waitms 250
End If
‘////////////////////////////////////////////////////////////////////////////
If Pinb.1 = 1 Then
A = A – 10
If A <= 10 Then A = 10
Pwm1a = A
Waitms 250
End If
'////////////////////////////////////////////////////////////////////////////
If Pinb.2 = 1 Then
If B = 0 Then
B = 1
Portc.0 = 0
Portc.1 = 1
Elseif B = 1 Then
B = 0
Portc.0 = 1
Portc.1 = 0
End If
Waitms 250
End If
'////////////////////////////////////////////////////////////////////////////
Call Progress(a)
'////////////////////////////////////////////////////////////////////////////
Loop
'============================================================================
End
'/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Sub Progress(num As Word)
If Num < 25 Then
Portc.7 = 1
Portc.6 = 0
Porta = 0
End If
If Num = 25 Then
Portc.6 = 1
Portc.7 = 1
Porta = 0
End If
If Num = 50 Then
Portc.6 = 1
Portc.7 = 1
Porta = &B00000001
End If
If Num = 75 Then
Portc.6 = 1
Portc.7 = 1
Porta = &B00000011
End If
If Num = 100 Then
Portc.6 = 1
Portc.7 = 1
Porta = &B00000111
End If

1 komentar:

  1. Isi postingannya bagus banget, tapi ada masukan nih,
    tolong resolusi printscreen nya diperbagus, ngga keliatan sih.
    trims.

    BalasHapus

Unordered List

Sample Text

Footer Widget 3

Popular Posts

Recent Posts

Text Widget

Diberdayakan oleh Blogger.

Social Icons

Followers

Sample Text

Featured Posts

Arsip Blog

profile

profile

Menu Blogku

Ordered List