سلام دوستان.من بعضی اوقات که کار میکنم تو برنامه نویسی بسکام ،بعر از اینکه برنامه نوشتم و کارهای ال سی دی کاراکتری رو نوشتم و پروگرام میکنم تو میکرو و یا پرتیوس .بعد از مدتی کار میبینم که اصلا اون چیزی که من میخاستم نشون نمیده <یک شکل هایی نشون میده که اصلا با مغز سازگار نیست و جایی ندیدم ،همش نگاش میکنم فک میکنم خط میخی هست :redface: :biggrin:،گردالی و عجیب قریب بعد تازه از راست به چپ حرکت میکنن،حالا میخاستم ببینم که چرا بعد از مدتی کار این شکل ها رو نشون میده؟چطوری میتونم درستش کنم؟آیا نویز داره؟فک نکنم تو برنامش مشکلی باشه ولی باز دوستان شاید بخوان با پرتیوس ببینن میزارم.باید دکمه های ست رو که با دیبانس مشخص شده بزنید تا تنظیم شه بعد خودش کم کم خراب میشه ،شما بعد از اینکه دکمه pinb.5 زدین فقط نیگاه کنین 

$regfile = "m16def.dat"
$crystal = 8000000
Config Lcdpin = Pin , Db4 = Portc.1 , Db5 = Portc.2 , Db6 = Portc.3 , Db7 = Portc.4 , E = Portc.5 , Rs = Portc.6
Config Lcd = 16 * 2
Cursor Off
Config Portb = Input
Enable Interrupts
Config Date = Ymd , Separator = .
Config Clock = Soft , Gosub = Sectic
_sec = 57 : _min = 59 : _hour = 23 : _day = 32 : _month = 11 : _year = 99
Goto W
Set_ok:
Locate 1 , 10 : Lcd "set ok"
Wait 2 : Locate 1 , 10 : Lcd" "
W:
Do
Debounce Pinb.5 , 1 , Incr_sec
Loop
Incr_sec:
Do
Locate 1 , 10 : Lcd "set sec"
Debounce Pinb.5 , 1 , Incr_min : Waitms 10
If Pinb.6 = 1 Then : _sec = 0 : Waitms 30 : End If
If Pinb.7 = 1 Then : _sec = 30 : Waitms 30 : End If
Loop
Incr_min:
Do
Locate 1 , 10 : Lcd "set min" : Waitms 10
Debounce Pinb.5 , 1 , Incr_hour
If Pinb.6 = 1 Then : Incr _min : Waitms 30 : End If
If Pinb.7 = 1 Then : Decr _min : Waitms 30 : End If
Loop
Incr_hour:
Do
Locate 1 , 10 : Lcd "set hou"
Debounce Pinb.5 , 1 , Incr_day : Waitms 10
If Pinb.6 = 1 Then : Incr _hour : Waitms 30 : End If
If Pinb.7 = 1 Then : Decr _hour : Waitms 30 : End If
Loop
Incr_day:
Do
Locate 1 , 10 : Lcd "set day"
Debounce Pinb.5 , 1 , Incr_month : Waitms 10
If Pinb.6 = 1 Then : Incr _day : Waitms 30 : End If
If Pinb.7 = 1 Then : Decr _day : Waitms 30 : End If
Loop
Incr_month:
Do
Locate 1 , 10 : Lcd "set mon"
Debounce Pinb.5 , 1 , Incr_year : Waitms 10
If Pinb.6 = 1then : Incr _month : Waitms 30 : End If
If Pinb.7 = 1 Then : Decr _month : Waitms 30 : End If
Loop
Incr_year:
Do
Locate 1 , 10 : Lcd "set yea"
Debounce Pinb.5 , 1 , Set_ok : Waitms 10
If Pinb.6 = 1 Then : Incr _year : Waitms 30 : End If
If Pinb.7 = 1 Then : Decr _year : Waitms 30 : End If
Loop
End
Sectic:
Locate 1 , 1 : Lcd Date$ : Locate 2 , 1 : Lcd Time$
Return
$crystal = 8000000
Config Lcdpin = Pin , Db4 = Portc.1 , Db5 = Portc.2 , Db6 = Portc.3 , Db7 = Portc.4 , E = Portc.5 , Rs = Portc.6
Config Lcd = 16 * 2
Cursor Off
Config Portb = Input
Enable Interrupts
Config Date = Ymd , Separator = .
Config Clock = Soft , Gosub = Sectic
_sec = 57 : _min = 59 : _hour = 23 : _day = 32 : _month = 11 : _year = 99
Goto W
Set_ok:
Locate 1 , 10 : Lcd "set ok"
Wait 2 : Locate 1 , 10 : Lcd" "
W:
Do
Debounce Pinb.5 , 1 , Incr_sec
Loop
Incr_sec:
Do
Locate 1 , 10 : Lcd "set sec"
Debounce Pinb.5 , 1 , Incr_min : Waitms 10
If Pinb.6 = 1 Then : _sec = 0 : Waitms 30 : End If
If Pinb.7 = 1 Then : _sec = 30 : Waitms 30 : End If
Loop
Incr_min:
Do
Locate 1 , 10 : Lcd "set min" : Waitms 10
Debounce Pinb.5 , 1 , Incr_hour
If Pinb.6 = 1 Then : Incr _min : Waitms 30 : End If
If Pinb.7 = 1 Then : Decr _min : Waitms 30 : End If
Loop
Incr_hour:
Do
Locate 1 , 10 : Lcd "set hou"
Debounce Pinb.5 , 1 , Incr_day : Waitms 10
If Pinb.6 = 1 Then : Incr _hour : Waitms 30 : End If
If Pinb.7 = 1 Then : Decr _hour : Waitms 30 : End If
Loop
Incr_day:
Do
Locate 1 , 10 : Lcd "set day"
Debounce Pinb.5 , 1 , Incr_month : Waitms 10
If Pinb.6 = 1 Then : Incr _day : Waitms 30 : End If
If Pinb.7 = 1 Then : Decr _day : Waitms 30 : End If
Loop
Incr_month:
Do
Locate 1 , 10 : Lcd "set mon"
Debounce Pinb.5 , 1 , Incr_year : Waitms 10
If Pinb.6 = 1then : Incr _month : Waitms 30 : End If
If Pinb.7 = 1 Then : Decr _month : Waitms 30 : End If
Loop
Incr_year:
Do
Locate 1 , 10 : Lcd "set yea"
Debounce Pinb.5 , 1 , Set_ok : Waitms 10
If Pinb.6 = 1 Then : Incr _year : Waitms 30 : End If
If Pinb.7 = 1 Then : Decr _year : Waitms 30 : End If
Loop
End
Sectic:
Locate 1 , 1 : Lcd Date$ : Locate 2 , 1 : Lcd Time$
Return
دیدگاه