Kampi
21.01.2010, 21:14
Hallo
Ich hab hier ein Programm welches eine RTC + ein EEPROM im I²C ansteuert.
Jedesmal wenn ich den Code kompilieren will schreibt Bascom allerdings:
Error: 1 Line: 82 Label not fount [GETDATETIME ]
Woran liegt das?
Achja hier der Code
$regfile = "m32def.dat"
$crystal = 16000000
Const Ds1307w = &HD0
Const Ds1307r = &HD1
Dim Zeit As String * 10
Dim Datum As String * 10
Dim Eingabe As String * 2
Config Clock = User
Dim Weekday As Byte
Start:
Input "Zeit und Datum stellen? (y/n):" , Eingabe
If Eingabe = "y" Then
Input "Time hh:mm:ss: " , Zeit
Input "Date mm-dd-yy" , Datum
Time$ = Zeit
Date$ = Datum
End If
Do
Print "Date Time :" ; Date$ ; "" ; Time$
Wait 1
Loop
Sub_getdatetime
I2cstart
I2cwbyte Ds1307w
I2cwbyte 0
I2cstart
I2cwbyte Ds1307r
I2crbyte _sec , Ack
I2crbyte _min , Ack
I2crbyte _hour , Ack
I2crbyte Weekday , Ack
I2crbyte _day , Ack
I2crbyte _month , Ack
I2crbyte _year , Ack
I2cstop
_sec = Makedec(_sec) : _min = Makedec(_min) : _hour = Makedec(_hour)
_day = Makedec(_day) : _month = Makedec(_month) : _year = Makedec(_year)
Return
Setdate:
_day = Makebcd(_day) : _month = Makebcd(_month) : _year = Makebcd(_year)
I2cstart
I2cwbyte Ds1307w
I2cwbyte 4
I2cwbyte _day
I2cwbyte _month
I2cwbyte _year
I2cstop
Return
Settime:
_sec = Makebcd(_sec) : _min = Makebcd(_min) : _hour = Makebcd(_hour)
I2cstart
I2cwbyte Ds1307w
I2cwbyte 0
I2cwbyte _sec
I2cwbyte _min
I2cwbyte _hour
I2cstop
Return
Ich hab hier ein Programm welches eine RTC + ein EEPROM im I²C ansteuert.
Jedesmal wenn ich den Code kompilieren will schreibt Bascom allerdings:
Error: 1 Line: 82 Label not fount [GETDATETIME ]
Woran liegt das?
Achja hier der Code
$regfile = "m32def.dat"
$crystal = 16000000
Const Ds1307w = &HD0
Const Ds1307r = &HD1
Dim Zeit As String * 10
Dim Datum As String * 10
Dim Eingabe As String * 2
Config Clock = User
Dim Weekday As Byte
Start:
Input "Zeit und Datum stellen? (y/n):" , Eingabe
If Eingabe = "y" Then
Input "Time hh:mm:ss: " , Zeit
Input "Date mm-dd-yy" , Datum
Time$ = Zeit
Date$ = Datum
End If
Do
Print "Date Time :" ; Date$ ; "" ; Time$
Wait 1
Loop
Sub_getdatetime
I2cstart
I2cwbyte Ds1307w
I2cwbyte 0
I2cstart
I2cwbyte Ds1307r
I2crbyte _sec , Ack
I2crbyte _min , Ack
I2crbyte _hour , Ack
I2crbyte Weekday , Ack
I2crbyte _day , Ack
I2crbyte _month , Ack
I2crbyte _year , Ack
I2cstop
_sec = Makedec(_sec) : _min = Makedec(_min) : _hour = Makedec(_hour)
_day = Makedec(_day) : _month = Makedec(_month) : _year = Makedec(_year)
Return
Setdate:
_day = Makebcd(_day) : _month = Makebcd(_month) : _year = Makebcd(_year)
I2cstart
I2cwbyte Ds1307w
I2cwbyte 4
I2cwbyte _day
I2cwbyte _month
I2cwbyte _year
I2cstop
Return
Settime:
_sec = Makebcd(_sec) : _min = Makebcd(_min) : _hour = Makebcd(_hour)
I2cstart
I2cwbyte Ds1307w
I2cwbyte 0
I2cwbyte _sec
I2cwbyte _min
I2cwbyte _hour
I2cstop
Return