سلام دوستان کلی دنبال یه برنامه نویس برای avr گشتم که نتونستم پیدا کنم خودم کتاب برداشتم و اینو نوشتم اما جواب نمیده
لطفا کمک کنید اشتباهاتم رو بگین
$regfile = "m16def.dat"
$crystal = 1000000
Config Pina.0 = Input 'S close
Config Pina.1 = Input 'S vasat
Config Pina.2 = Input 'S Open
Config Pina.3 = Input 'Z out
Config Pina.4 = Input 'Z In
Config Pina.5 = Output 'R1
Config Pina.6 = Output 'R2
Config Pina.7 = Output 'r3
Config Pinc.0 = Input 'open
Config Pinc.1 = Input 'close
Config Pinc.2 = Input '1
Config Pinc.3 = Input '2
Sc Alias Pina.0
Sv Alias Pina.1
So Alias Pina.2
Zo Alias Pina.3
Zi Alias Pina.4
R1 Alias Pina.5
R2 Alias Pina.6
R3 Alias Pina.7
Swo Alias Pinc.0
Swc Alias Pinc.1
Sw1 Alias Pinc.2
Sw2 Alias Pinc.3
Dim Sc As Bit
Dim Sv As Bit
Dim So As Bit
Dim Zo As Bit
Dim Zi As Bit
Dim R1 As Bit 'close
Dim R2 As Bit 'open
Dim R3 As Bit '12\24
Dim Swo As Bit
Dim Swc As Bit
Dim Sw1 As Bit
Dim Sw2 As Bit
Do
If Swo = 0 Then
Goto Open
If Swc = 0 Then
Goto Close
If Sw1 = 0 Then
Goto 1tarafe
If Sw2 = 0 Then
Goto 2tarafe
End If
End If
End If
End If
Loop
Close:
Set R1
Bitwait Sc , Reset
Reset R1
Bitwait Sc , Set
Set R1
If Sv = 0 Then
Set R3
Wait 3
Reset R3
End If
Goto Close
Open:
Set R2
If So = 0 Then
Reset R2
Reset R3
End If
Goto Open
1tarafe:
Set R1
If Zi = 0 Then
Reset R1
Set R2
If So = 0 Then
Reset R2
Reset R3
Wait 5
Set R1
If Sc = 0 Then
Reset R1
Reset R3
If Sv = 0 Then
Set R3
End If
End If
End If
End If
Goto 1tarafe
2tarafe:
Set R1
If Zi = 0 Then
Reset R1
Set R2
If Zo = 0 Then
Reset R1
Set R2
If So = 0 Then
Reset R2
Reset R3
Wait 5
Set R1
If Sc = 0 Then
Reset R1
Reset R3
If Sv = 0 Then
Set R3
End If
End If
End If
End If
End If
Goto 2tarafe
End$regfile = "m16def.dat"
$crystal = 1000000
Config Pina.0 = Input 'S close
Config Pina.1 = Input 'S vasat
Config Pina.2 = Input 'S Open
Config Pina.3 = Input 'Z out
Config Pina.4 = Input 'Z In
Config Pina.5 = Output 'R1
Config Pina.6 = Output 'R2
Config Pina.7 = Output 'r3
Config Pinc.0 = Input 'open
Config Pinc.1 = Input 'close
Config Pinc.2 = Input '1
Config Pinc.3 = Input '2
Sc Alias Pina.0
Sv Alias Pina.1
So Alias Pina.2
Zo Alias Pina.3
Zi Alias Pina.4
R1 Alias Pina.5
R2 Alias Pina.6
R3 Alias Pina.7
Swo Alias Pinc.0
Swc Alias Pinc.1
Sw1 Alias Pinc.2
Sw2 Alias Pinc.3
Dim Sc As Bit
Dim Sv As Bit
Dim So As Bit
Dim Zo As Bit
Dim Zi As Bit
Dim R1 As Bit 'close
Dim R2 As Bit 'open
Dim R3 As Bit '12\24
Dim Swo As Bit
Dim Swc As Bit
Dim Sw1 As Bit
Dim Sw2 As Bit
Do
If Swo = 0 Then
Goto Open
If Swc = 0 Then
Goto Close
If Sw1 = 0 Then
Goto 1tarafe
If Sw2 = 0 Then
Goto 2tarafe
End If
End If
End If
End If
Loop
Close:
Set R1
Bitwait Sc , Reset
Reset R1
Bitwait Sc , Set
Set R1
If Sv = 0 Then
Set R3
Wait 3
Reset R3
End If
Goto Close
Open:
Set R2
If So = 0 Then
Reset R2
Reset R3
End If
Goto Open
1tarafe:
Set R1
If Zi = 0 Then
Reset R1
Set R2
If So = 0 Then
Reset R2
Reset R3
Wait 5
Set R1
If Sc = 0 Then
Reset R1
Reset R3
If Sv = 0 Then
Set R3
End If
End If
End If
End If
Goto 1tarafe
2tarafe:
Set R1
If Zi = 0 Then
Reset R1
Set R2
If Zo = 0 Then
Reset R1
Set R2
If So = 0 Then
Reset R2
Reset R3
Wait 5
Set R1
If Sc = 0 Then
Reset R1
Reset R3
If Sv = 0 Then
Set R3
End If
End If
End If
End If
End If
Goto 2tarafe
End
این برنامه قراره برای درب های اتومات باشه درب های فروشگاهها البته میخوام جایگزین برد سوخته یه درب اتومات کنم
سه تا سنسور داره که اول آخر و وسط درب رو تشخیص میدهد
وسطی برای کنترل سرعت درب
دوتا زوم هم داره که درب رو باز میکنن
لطفا کمک کنید اشتباهاتم رو بگین
$regfile = "m16def.dat"
$crystal = 1000000
Config Pina.0 = Input 'S close
Config Pina.1 = Input 'S vasat
Config Pina.2 = Input 'S Open
Config Pina.3 = Input 'Z out
Config Pina.4 = Input 'Z In
Config Pina.5 = Output 'R1
Config Pina.6 = Output 'R2
Config Pina.7 = Output 'r3
Config Pinc.0 = Input 'open
Config Pinc.1 = Input 'close
Config Pinc.2 = Input '1
Config Pinc.3 = Input '2
Sc Alias Pina.0
Sv Alias Pina.1
So Alias Pina.2
Zo Alias Pina.3
Zi Alias Pina.4
R1 Alias Pina.5
R2 Alias Pina.6
R3 Alias Pina.7
Swo Alias Pinc.0
Swc Alias Pinc.1
Sw1 Alias Pinc.2
Sw2 Alias Pinc.3
Dim Sc As Bit
Dim Sv As Bit
Dim So As Bit
Dim Zo As Bit
Dim Zi As Bit
Dim R1 As Bit 'close
Dim R2 As Bit 'open
Dim R3 As Bit '12\24
Dim Swo As Bit
Dim Swc As Bit
Dim Sw1 As Bit
Dim Sw2 As Bit
Do
If Swo = 0 Then
Goto Open
If Swc = 0 Then
Goto Close
If Sw1 = 0 Then
Goto 1tarafe
If Sw2 = 0 Then
Goto 2tarafe
End If
End If
End If
End If
Loop
Close:
Set R1
Bitwait Sc , Reset
Reset R1
Bitwait Sc , Set
Set R1
If Sv = 0 Then
Set R3
Wait 3
Reset R3
End If
Goto Close
Open:
Set R2
If So = 0 Then
Reset R2
Reset R3
End If
Goto Open
1tarafe:
Set R1
If Zi = 0 Then
Reset R1
Set R2
If So = 0 Then
Reset R2
Reset R3
Wait 5
Set R1
If Sc = 0 Then
Reset R1
Reset R3
If Sv = 0 Then
Set R3
End If
End If
End If
End If
Goto 1tarafe
2tarafe:
Set R1
If Zi = 0 Then
Reset R1
Set R2
If Zo = 0 Then
Reset R1
Set R2
If So = 0 Then
Reset R2
Reset R3
Wait 5
Set R1
If Sc = 0 Then
Reset R1
Reset R3
If Sv = 0 Then
Set R3
End If
End If
End If
End If
End If
Goto 2tarafe
End$regfile = "m16def.dat"
$crystal = 1000000
Config Pina.0 = Input 'S close
Config Pina.1 = Input 'S vasat
Config Pina.2 = Input 'S Open
Config Pina.3 = Input 'Z out
Config Pina.4 = Input 'Z In
Config Pina.5 = Output 'R1
Config Pina.6 = Output 'R2
Config Pina.7 = Output 'r3
Config Pinc.0 = Input 'open
Config Pinc.1 = Input 'close
Config Pinc.2 = Input '1
Config Pinc.3 = Input '2
Sc Alias Pina.0
Sv Alias Pina.1
So Alias Pina.2
Zo Alias Pina.3
Zi Alias Pina.4
R1 Alias Pina.5
R2 Alias Pina.6
R3 Alias Pina.7
Swo Alias Pinc.0
Swc Alias Pinc.1
Sw1 Alias Pinc.2
Sw2 Alias Pinc.3
Dim Sc As Bit
Dim Sv As Bit
Dim So As Bit
Dim Zo As Bit
Dim Zi As Bit
Dim R1 As Bit 'close
Dim R2 As Bit 'open
Dim R3 As Bit '12\24
Dim Swo As Bit
Dim Swc As Bit
Dim Sw1 As Bit
Dim Sw2 As Bit
Do
If Swo = 0 Then
Goto Open
If Swc = 0 Then
Goto Close
If Sw1 = 0 Then
Goto 1tarafe
If Sw2 = 0 Then
Goto 2tarafe
End If
End If
End If
End If
Loop
Close:
Set R1
Bitwait Sc , Reset
Reset R1
Bitwait Sc , Set
Set R1
If Sv = 0 Then
Set R3
Wait 3
Reset R3
End If
Goto Close
Open:
Set R2
If So = 0 Then
Reset R2
Reset R3
End If
Goto Open
1tarafe:
Set R1
If Zi = 0 Then
Reset R1
Set R2
If So = 0 Then
Reset R2
Reset R3
Wait 5
Set R1
If Sc = 0 Then
Reset R1
Reset R3
If Sv = 0 Then
Set R3
End If
End If
End If
End If
Goto 1tarafe
2tarafe:
Set R1
If Zi = 0 Then
Reset R1
Set R2
If Zo = 0 Then
Reset R1
Set R2
If So = 0 Then
Reset R2
Reset R3
Wait 5
Set R1
If Sc = 0 Then
Reset R1
Reset R3
If Sv = 0 Then
Set R3
End If
End If
End If
End If
End If
Goto 2tarafe
End
این برنامه قراره برای درب های اتومات باشه درب های فروشگاهها البته میخوام جایگزین برد سوخته یه درب اتومات کنم
سه تا سنسور داره که اول آخر و وسط درب رو تشخیص میدهد
وسطی برای کنترل سرعت درب
دوتا زوم هم داره که درب رو باز میکنن
دیدگاه