AVR
سه شنبه, ۱۷ بهمن ۱۳۹۱، ۰۳:۴۵ ب.ظ
برنامه AVR مدار
$regfile = "m8def.dat"
$crystal = 4000000
Config Portb = Output
Config Portd = Input
Config Adc = Single , Prescaler = Auto
Start Adc
Dim A As Word , B As Word , Z As Word
A = 1024
B = 1024
Wait 1
Do
A = Getadc(0)
Z = A - B
If A < B Then
B = A
Elseif Z > 10 Then
Goto L0
End If
L1:
A = Getadc(1)
If A > 512 Then
If Pind.0 = 1 Then
Set Portb.0
Else
Reset Portb.0
End If
Else
Reset Portb.0
End If
Waitms 100
Loop
L0:
Reset Portb.0
Set Portb.1
Do
If Pind.1 = 0 Then
Reset Portb.1
Goto L1
End If
Loop
End
۹۱/۱۱/۱۷