xplor
Newbie level 3
Hey guys,
I need a little help displaying the time on a HD44780 lcd.
Compiling on PIC basic Pro.
There are two of us having the same issue.
Below is the code I used.
The display is
Time=00:00:00
Date=00:00:00
Any suggestions would be helpful, not very good at these things.
I will owe you a burrito if we can get her running.
' Define configuration settings (different from defaults)
#CONFIG
__CONFIG _CONFIG1, _INTRC_IO & _PWRTE_ON & _MCLR_OFF & _LVP_OFF
#ENDCONFIG
' Set the internal oscillator frequency to 8 MHz
DEFINE OSC 8
OSCCON.4 = 1
OSCCON.5 = 1
OSCCON.6 = 1
' in the textbook for an example of how to configure and use A/D conversion
ansel = 0
SDA var PORTB.1 ' RTC data
SCL var PORTB.2 ' RTC clock
DB0 var byte[8]
CMCON = %00000111 ' Comparators = off
read_1307: ' Read time Secs,Mins,Hours,Day,Date,Month,Year,Control
I2CREAD SDA,SCL,$D1,$00,[STR DB0\8] ' Read 8 bytes from DS1307
lcdout $fe,$94,"Time=",hex2 DB0[2],":",hex2 DB0[1],":",hex2 DB0[0] 'bit 0=sec, bit 1=min, bit 2=hrs
lcdout $fe,$D4,"Date=",hex2 DB0[4],":",hex2 DB0[5],":",hex2 db0[6] 'bit 4=day, bit 5=month, bit 6=year
goto read_1307
end
I need a little help displaying the time on a HD44780 lcd.
Compiling on PIC basic Pro.
There are two of us having the same issue.
Below is the code I used.
The display is
Time=00:00:00
Date=00:00:00
Any suggestions would be helpful, not very good at these things.
I will owe you a burrito if we can get her running.
' Define configuration settings (different from defaults)
#CONFIG
__CONFIG _CONFIG1, _INTRC_IO & _PWRTE_ON & _MCLR_OFF & _LVP_OFF
#ENDCONFIG
' Set the internal oscillator frequency to 8 MHz
DEFINE OSC 8
OSCCON.4 = 1
OSCCON.5 = 1
OSCCON.6 = 1
' in the textbook for an example of how to configure and use A/D conversion
ansel = 0
SDA var PORTB.1 ' RTC data
SCL var PORTB.2 ' RTC clock
DB0 var byte[8]
CMCON = %00000111 ' Comparators = off
read_1307: ' Read time Secs,Mins,Hours,Day,Date,Month,Year,Control
I2CREAD SDA,SCL,$D1,$00,[STR DB0\8] ' Read 8 bytes from DS1307
lcdout $fe,$94,"Time=",hex2 DB0[2],":",hex2 DB0[1],":",hex2 DB0[0] 'bit 0=sec, bit 1=min, bit 2=hrs
lcdout $fe,$D4,"Date=",hex2 DB0[4],":",hex2 DB0[5],":",hex2 db0[6] 'bit 4=day, bit 5=month, bit 6=year
goto read_1307
end