Does this work? (I know it's not formatted like you had it, just see if it works)
Code:
DEFINE OSC 20 'Now works at 20 MHz
DEFINE LCD_DREG PORTD 'Define PIC port used for LCD Data lines
DEFINE LCD_DBIT 4 'Define first pin of portb connected to LCD DB4
DEFINE LCD_RSREG PORTD 'Define PIC port used for RS line of LCD
DEFINE LCD_RSBIT 2 'Define Portb pin used for RS connection
DEFINE LCD_EREG PORTD 'Define PIC prot used for E line of LCD
DEFINE LCD_EBIT 3 'Define PortB pin used for E connection
DEFINE LCD_BITS 4 'Define the 4 bit communication mode to LCD
DEFINE LCD_LINES 2 'Define using a 2 line LCD
DEFINE LCD_COMMANDUS 2000 'Define delay time between sending LCD commands
DEFINE LCD_DATAUS 50 'Define delay time between data
sda var portc.4:scl var portc.3:min var byte:hour var byte:day var byte:month var byte
time var byte[3]:dtime var byte[3]:units var byte:tens var byte:control var byte
loopcounter var word:loopcnt1 var loopcounter.lowbyte:loopcnt2 var loopcounter.highbyte
j var byte:loopcnt1=0:loopcnt2=0:j=0:control=$a0
Start: lcdout $fe,1,"Test Program":Pause 1000:i2cwrite sda,scl,control,0,[8]
i2cwrite sda,scl,control,2,[0,$59,$23,$30,$11]
run: i2cread sda,scl,control,3,[Time[0],Time[1],Time[2],Time[3]]:Pause 20
for J=0 to 3:tens=((time[J] & $f0)>>4)*10:units=time[j] & $f:dtime[j]=tens+units:next j
lcdout $fe,1,"Mth: ",dec dtime[3]," Day: ",dec dtime[2]
lcdout $fe,$c0,"Hrs: ",dec dtime[1]," Min: ",dec dtime[0]:pause 1000
lcdout $fe,1,"Loop Ctr:",dec5 loopcounter:pause 1000 'might want to knock this down so the program runs a bit faster eh?
loopcnt1=loopcnt1+1:if loopcnt1 = 0 then loopcnt2=loopcnt2+1
goto run
END
(HCM strikes again!)
Bookmarks