من با m8 می خواستم یک ساعت درست کنم اما وقتی برنامه ی زیر را روی آن پروگرام می کنم، روی LCD حروف های عجیب و غریب می نویسه ! ؟
کد:
$regfile = "m8def.dat"
$crystal = 1000000
Config Lcdpin = Pin , Db7 = Portd.0 , Db6 = Portd.1 , Db5 = Portd.2 , _
Db4 = Portd.3 , Rs = Portd.4 , E = Portd.5
Config Lcd = 16 * 2
Config Debounce = 15
Config Clock = Soft
Config Date = Ymd , Separator = /
Dim T As Byte , D As Byte
T = 0
D = 0
Enable Interrupts
Time$ = "23:59:50"
Date$ = "85/12/3"
Cursor Off
Cls
Do
Home
Lcd "Time: " ; Time$
Lowerline
Lcd "Date: " ; Date$
Debounce Pinb.0 , 0 , Menu
Repeat:
Loop
End 'end program
'******************************************************************************
Menu:
T = 0
D = 0
Cls
Lcd "1-Time Setting"
Do
Debounce Pinb.0 , 0 , Labeld
Debounce Pinb.1 , 0 , Timeset
Loop
Labeld:
Cls
Lcd "2-Date Setting"
Do
Debounce Pinb.0 , 0 , Repeat
Debounce Pinb.1 , 0 , Dateset
Loop
'----------------------------------------
Timeset:
Cls
Incr T
Lcd "Hour: " ; _hour
Do
Debounce Pinb.1 , 0 , Inctime , Sub
Debounce Pinb.0 , 0 , Labelmi
Loop
Labelmi:
Cls
Incr T
Lcd "Min: " ; _min
Do
Debounce Pinb.1 , 0 , Inctime , Sub
Debounce Pinb.0 , 0 , Labeld
Loop
'----------------------------------------
Dateset:
Cls
Incr D
Lcd "Day: " ; _day
Do
Debounce Pinb.1 , 0 , Incdate , Sub
Debounce Pinb.0 , 0 , Labelmo
Loop
Labelmo:
Cls
Incr D
Lcd "Month: " ; _month
Do
Debounce Pinb.1 , 0 , Incdate , Sub
Debounce Pinb.0 , 0 , Labely
Loop
Labely:
Cls
Incr D
Lcd "Year: " ; _year
Do
Debounce Pinb.1 , 0 , Incdate , Sub
Debounce Pinb.0 , 0 , Repeat
Loop
'-------------------------------------
Inctime:
If T = 1 Then
Incr _hour
If _hour = 24 Then
_hour = 0
End If
Cls
Lcd "Hour: " ; _hour
Else
If T = 2 Then
Incr _min
If _min = 60 Then
_min = 0
End If
Cls
Lcd "Min: " ; _min
End If
End If
Return
'-------------------------------------
Incdate:
If D = 1 Then
Incr _day
If _day > 31 Then
_day = 1
End If
Cls
Lcd "Day: " ; _day
Else
If D = 2 Then
Incr _month
If _month > 12 Then
_month = 1
End If
Cls
Lcd "Month: " ; _month
Else
If D = 3 Then
Incr _year
If _year > 100 Then
_year = 0
End If
Cls
Lcd "Year: " ; _year
End If
End If
End If
Return