باسلام من روی یک پروژه ی فاصله یاب آلتراسونیک کار می کنم اما هنگامی که ولتاژ تغذیع 5ولت را وصل میکنم فقط روی ال سی دی در سطر پایین مربع های سیاهی دیده می شود در ضمن پتانسیو متر مربوط به تنظیم کنتراست را نیز گذاشتم حالا فکر میکنم که مشکل از تنظیمات فیوز بیت ها وپروگرام میکرو باشه در ادامه من برنامه ی میکرو را با شماتیک می گذارم اگه میشه دوستان راهنمایی کنید در برنامه ریزی وتنظیم فیوز بیت ها که مثلا بعد از تنظیم فیوز بیت ها باید کدوم دکمه را بزنم تا تنظیمات اعمال بشه من از نرم افزار progisp دارم استفاده میکنم
در ضمن دوستان در سایت هم خیلی در این مورد جست وجو کردم به جایی نرسیدم
لطفا اگه کسی می تونه کمک کنه که عیب این مدار را که گفتم فقط مربع سیاه روی ال سی دی نشون میده را بر طرف کنم
'Ultrasonic Range Finder
'-----------------------
$regfile = "attiny2313.dat"
$crystal = 8000000
Config Lcdpin = Pin , Db4 = Portb.4 , Db5 = Portb.5 , Db6 = _
Portb.6 , Db7 = Portb.7 , E = Portb.2 , Rs = Portb.0
Config Lcd = 16 * 2
Config Timer0 = Timer , Prescale = 8
Config Timer1 = Timer , Prescale = 8
Config Int0 = Falling
Config Pind.3 = Output
Config Pind.4 = Output
Config Pind.5 = Output
Declare Sub Lcd_show(byval Hex_val As Integer)
Enable Interrupts
Disable Int0
Enable Ovf0
Enable Ovf1
On Int0 Ex0_rut
On Ovf0 T0_rut
On Ovf1 T1_rut
Clkpr = &H80
Clkpr = &H00
Out1 Alias Portd.4
Out2 Alias Portd.5
Trigger Alias Portd.3
Dim Lcd_show_flag As Bit
Dim Dip_switch As Byte
Dim Timer_val As Integer
Cursor Off : Cls : Lcd "start" : Waitms 1000
Out1 = 0 : Out2 = 0
'---------------------------
Do
Disable Int0
Timer0 = &HF4
Timer1 = &H0000
Trigger = 0
Waitms 10
'-----------------
Start Timer0
Start Timer1
Waitus 100
Stop Timer0
Out1 = 0
Out2 = 0
Trigger = 1
Waitus 150
'----------------
Enable Int0
Dip_switch = Pind And &H03
Select Case Dip_switch
Case 0:
Waitms 200
Case 1:
Waitms 500
Case 2:
Waitms 1000
Case 3:
Waitms 2000
End Select
If Lcd_show_flag = 1 Then
Call Lcd_show(timer_val)
Lcd_show_flag = 0
End If
Loop
End
'---------------------------
Ex0_rut:
Timer_val = Timer1
Waitus 20
If Pind.2 = 0 Then
Disable Int0
Stop Timer1
Lcd_show_flag = 1
End If
Return
'---------------------------
T0_rut:
Timer0 = &HF4
Out1 = Not Out1
Out2 = Not Out1
Return
'---------------------------
T1_rut:
Stop Timer1
Cls
Lcd "Over range"
Return
'---------------------------
Sub Lcd_show(byval Hex_val As Integer)
Dim D As Long
Dim Distance As Integer
D = Hex_val / 2
D = D * 343
D = D / 10000
Distance = D
Cls
Lcd "Range> " ; Distance ; "cm"
End Sub
واین هم لینک شماتیک
http://www.eca.ir/forum2/index.php?topic=49408.msg283888#msg283888
:cry2: :angry: :cry:
در ضمن دوستان در سایت هم خیلی در این مورد جست وجو کردم به جایی نرسیدم
لطفا اگه کسی می تونه کمک کنه که عیب این مدار را که گفتم فقط مربع سیاه روی ال سی دی نشون میده را بر طرف کنم
'Ultrasonic Range Finder
'-----------------------
$regfile = "attiny2313.dat"
$crystal = 8000000
Config Lcdpin = Pin , Db4 = Portb.4 , Db5 = Portb.5 , Db6 = _
Portb.6 , Db7 = Portb.7 , E = Portb.2 , Rs = Portb.0
Config Lcd = 16 * 2
Config Timer0 = Timer , Prescale = 8
Config Timer1 = Timer , Prescale = 8
Config Int0 = Falling
Config Pind.3 = Output
Config Pind.4 = Output
Config Pind.5 = Output
Declare Sub Lcd_show(byval Hex_val As Integer)
Enable Interrupts
Disable Int0
Enable Ovf0
Enable Ovf1
On Int0 Ex0_rut
On Ovf0 T0_rut
On Ovf1 T1_rut
Clkpr = &H80
Clkpr = &H00
Out1 Alias Portd.4
Out2 Alias Portd.5
Trigger Alias Portd.3
Dim Lcd_show_flag As Bit
Dim Dip_switch As Byte
Dim Timer_val As Integer
Cursor Off : Cls : Lcd "start" : Waitms 1000
Out1 = 0 : Out2 = 0
'---------------------------
Do
Disable Int0
Timer0 = &HF4
Timer1 = &H0000
Trigger = 0
Waitms 10
'-----------------
Start Timer0
Start Timer1
Waitus 100
Stop Timer0
Out1 = 0
Out2 = 0
Trigger = 1
Waitus 150
'----------------
Enable Int0
Dip_switch = Pind And &H03
Select Case Dip_switch
Case 0:
Waitms 200
Case 1:
Waitms 500
Case 2:
Waitms 1000
Case 3:
Waitms 2000
End Select
If Lcd_show_flag = 1 Then
Call Lcd_show(timer_val)
Lcd_show_flag = 0
End If
Loop
End
'---------------------------
Ex0_rut:
Timer_val = Timer1
Waitus 20
If Pind.2 = 0 Then
Disable Int0
Stop Timer1
Lcd_show_flag = 1
End If
Return
'---------------------------
T0_rut:
Timer0 = &HF4
Out1 = Not Out1
Out2 = Not Out1
Return
'---------------------------
T1_rut:
Stop Timer1
Cls
Lcd "Over range"
Return
'---------------------------
Sub Lcd_show(byval Hex_val As Integer)
Dim D As Long
Dim Distance As Integer
D = Hex_val / 2
D = D * 343
D = D / 10000
Distance = D
Cls
Lcd "Range> " ; Distance ; "cm"
End Sub
واین هم لینک شماتیک
http://www.eca.ir/forum2/index.php?topic=49408.msg283888#msg283888
:cry2: :angry: :cry:
دیدگاه