Code:
#config
CONFIG RETEN = OFF
CONFIG INTOSCSEL = HIGH
CONFIG SOSCSEL = DIG
CONFIG XINST = OFF ;Enabled
CONFIG FOSC = INTIO1
CONFIG PLLCFG = OFF
CONFIG FCMEN = OFF ;Disabled
CONFIG PWRTEN = OFF ;Disabled
CONFIG BOREN = OFF ;Disabled in hardware, SBOREN disabled
CONFIG WDTEN = OFF ;WDT disabled in hardware; SWDTEN bit disabled
CONFIG CANMX = PORTB
CONFIG MCLRE = OFF
#endconfig
OSCTUNE.6 = 1 ; Enable 4x PLL
OSCCON = %01110000
ANCON1=0 'DISABLE ADC D3-D2-D1-D0-
ANCON0=0
ADCON0=0
TRISC=%11110000 'set PORTC as output first 4
TRISD=%00000000 'set PORTD as output all
TRISB=%00000000 'set PORTB as output all
TRISA=%00000000 'set PORTA 2 as input, others as output
TRISE=%0000000 'set PORTE as output all
define OSC 64
DEFINE LCD_DREG PORTD
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTB
DEFINE LCD_RSBIT 5
DEFINE LCD_EREG PORTA
DEFINE LCD_EBIT 3
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 850
DEFINE LCD_DATAUS 30
'i var byte
high portb.4 'enable LCD backlight
'digits
data $3E, $67, $6F, $7B, $73, $63, $3E, $00 'NOLI
data $1C, $3C, $6C, $0C, $0C, $0C, $7F, $00 'ERTI
data $3E, $63, $03, $3E, $60, $60, $7F, $00 'ORI
data $3E, $63, $03, $0E, $63, $63, $3E, $00 'SAMI
data $63, $63, $63, $3F, $03, $03, $03, $00 'OTXI
data $7F, $60, $60, $7E, $03, $63, $3E, $00 'XUTI
data $3E, $63, $60, $7E, $63, $63, $3E, $00 'EQVSI
data $7F, $63, $03, $06, $0C, $0C, $0C, $00 'SHVIDI
data $3E, $63, $63, $3E, $63, $63, $3E, $00 'RVA
data $3E, $63, $63, $3F, $03, $63, $3E, $00 'CXRA
'SYMBOLS
data $00, $00, $18, $18, $00, $18, $18, $00 'orcertili
data $00, $00, $18, $18, $00, $18, $18, $30 'certilmdzime
data $06, $0c, $18, $30, $18, $0c, $06, $00 'aket
data $00, $00, $7e, $7e, $00, $7e, $7e, $00 'tolia
data $30, $18, $0C, $06, $0C, $18, $30, $00 'iket
data $3E, $63, $63, $06, $0C, $00, $0C, $00 'KITXVA
data $7C, $C6, $DE, $F6, $DC, $C0, $7E, $00 'LOKOKINA
'font georgian alphabet without squeek door
data $0C, $0C, $06, $03, $63, $63, $3E, $00' data ' Char 048 (0)
data $38, $0C, $0C, $3E, $63, $63, $3E, $00'data ' Char 049 (1)
data $26, $63, $66, $63, $63, $63, $3E, $00'data ' Char 050 (2)
data $3E, $63, $63, $7E, $60, $60, $3E, $00'data ' Char 051 (3)
data $3E, $63, $03, $03, $63, $63, $3E, $00'data ' Char 052 (4)
data $36, $6B, $6B, $36, $03, $63, $3E, $00'data ' Char 053 (5)
data $3E, $63, $03, $1E, $33, $63, $3E, $00'data ' Char 054 (6)
data $1E, $03, $0E, $03, $0E, $63, $3E, $00'data ' Char 055 (7)
data $3E, $63, $63, $63, $63, $63, $22, $00'data ' Char 056 (8)
data $0C, $3F, $0C, $06, $63, $63, $3E, $00'data ' Char 057 (9)
data $06, $03, $0E, $03, $63, $63, $3E, $00'data ' Char 058 (:)
data $3E, $63, $63, $62, $60, $60, $3E, $00'data ' Char 059 (;)
data $3E, $63, $03, $3F, $63, $63, $3E, $00'data ' Char 060 (<)
data $7F, $60, $60, $7E, $63, $63, $3E, $00'data ' Char 061 (=)
data $3E, $6B, $6B, $6B, $63, $63, $22, $00'data ' Char 062 (>)
data $0C, $06, $03, $06, $63, $63, $3E, $00'data ' Char 063 (?)
data $03, $03, $0F, $1B, $03, $63, $3E, $00'data ' Char 064 (@)
data $60, $60, $60, $7E, $63, $63, $63, $00'data ' Char 065 (A)
data $60, $60, $60, $63, $63, $63, $3E, $00'data ' Char 066 (B)
data $2E, $6B, $6B, $63, $63, $63, $3E, $00'data ' Char 067 (C)
data $36, $6B, $4B, $03, $63, $63, $3E, $00'data ' Char 068 (D)
data $3E, $63, $03, $06, $63, $63, $3E, $00'data ' Char 069 (E)
data $3E, $6B, $60, $7E, $63, $63, $3E, $00'data ' Char 070 (F)
data $60, $60, $60, $7E, $63, $63, $3E, $00'data ' Char 071 (G)
data $63, $63, $63, $3F, $03, $63, $3E, $00'data ' Char 072 (H)
data $38, $6C, $6C, $3E, $1B, $1B, $0E, $00'data ' Char 073 (I)
data $3E, $6B, $6B, $6B, $6B, $6B, $32, $0 'data for TH [
data $07, $4F, $5B, $33, $03, $63, $3E, $00 '\ jh
data $3E, $6B, $6B, $62, $60, $60, $3E, $00 '] RR
data $36, $5B, $03, $3F, $63, $63, $3E, $00 '^sh
data $3C, $66, $6C, $7E, $63, $63, $63, $00 '_ ch
data $03, $03, $03, $3F, $63, $63, $3E, $00 '` dz
'indicators CORRESPOND SMALL LETTERS
data $EC, $A4, $A4, $A4, $A4, $A4, $EE, $00 '01
data $EE, $AA, $A2, $AE, $A8, $A8, $EE, $00 '02
data $EE, $A2, $A2, $AE, $A2, $A2, $EE, $00 '03
data $EA, $AA, $AA, $AE, $A2, $A2, $E2, $00 '04
data $EE, $A8, $A8, $AE, $A2, $AA, $EE, $00 '05
data $EE, $AA, $A8, $AE, $AA, $AA, $EE, $00 '06
data $EE, $AA, $A2, $A2, $A2, $A2, $E2, $00 '07
data $EE, $AA, $AA, $AE, $AA, $AA, $EE, $00 '08
data $EE, $AA, $AA, $AE, $A2, $AA, $EE, $00 '09
data $CE, $4A, $4A, $4A, $4A, $4A, $EE, $00 '10
data $CC, $44, $44, $44, $44, $44, $EE, $00 '11
data $CE, $42, $42, $4E, $48, $48, $EE, $00 '12
data $CE, $42, $42, $4E, $42, $42, $EE, $00 '13
data $CA, $4A, $4A, $4E, $42, $42, $E2, $00 '14
data $CE, $48, $48, $4E, $42, $4A, $EE, $00 '15
data $CE, $48, $48, $4E, $4A, $4A, $EE, $00 '16
data $CE, $4A, $42, $42, $42, $42, $E2, $00 '17
data $CE, $4A, $4A, $4E, $4A, $4A, $EE, $00 '18
data $CE, $4A, $4A, $4E, $42, $4A, $EE, $00 '19
data $EE, $AA, $2A, $EA, $8A, $8A, $EE, $00 '20
data $EC, $A4, $24, $E4, $84, $84, $EE, $00 '21
data $EE, $AA, $22, $EE, $88, $88, $EE, $00 '22
data $EE, $A2, $22, $EE, $82, $82, $EE, $00 '23
data $EA, $AA, $2A, $EE, $82, $82, $E2, $00 '24
data $10, $28, $48, $48, $48, $28, $10, $00 'light oFF
data $20, $56, $90, $96, $90, $56, $20, $00 'LIGHT ON
data $01, $03, $06, $0C, $18, $30, $60, $00 '/ side line { this char
'''''''LCD HANDLER VARIABLES
x var byte ' counter variable
z var WORD ' temp variable
y var WORD 'eeprom reader var
i var byte 'counter
a var byte
b var byte 'temps
c var byte
astart var byte 'inversion atribute start
aend var byte 'inversion end
separ var byte 'dual dot separator
'----------- RTC
RTCYear Var Byte: RTCMonth Var Byte: RTCDate Var Byte: RTCDay Var Byte: RTCHour Var Byte
RTCMin Var Byte: RTCSec Var Byte: RTCCtrl Var Byte
SDA VAR PORTB.3
SCL VAR PORTB.2
SAATI VAR BYTE
CUTI VAR BYTE
'CELI VAR BYTE
TVE VAR BYTE
RICXVI VAR BYTE
DGE VAR BYTE
CAMI VAR BYTE
dro var byte
cvlileba var byte 'clock trigger set
'------------- PCF IO
padr var byte
PSDA var portd.0
PSCL var portd.1
'-----GLOBAL VARIABLES
ABSTIME VAR WORD 'CURRENT ABSOLUTE TIME, HOURS*60+MINUTES FROM RTC
MENUITEM VAR BYTE 'CURRENT MENU POSITION VARIABLE
time var bit[24]
'INPUTS
UPBT VAR PORTC.5 'UP BUTTON
DNBT VAR PORTC.4 'DOWN BUTTON
LBUT VAR PORTC.7 'LEFT/BACK BUTTON
RBUT VAR PORTC.6 'RIGHT/OK BUTTON
sdao var portd.0
sclo var portc.3
'OUTPUTS PCF - 66 CON EDGE, 64 MIDDLE, 78 BUTTON SIDE
adr var byte 'OUTPUT PCF ADDRESS
adr=78
'[\]`^_ th zh R dz sh ch
topline var byte [32] 'top part of the screen array
botline var byte [32] 'bottom part of screen
lcdout $fe, $20 'enable text mode - this is required to fix issue of 18F
LCDOUT $FE,$2, "TEST"
pause 100
LCDOUT $FE,$2, " "
pause 500
LCDOUT $FE,$2E 'enable graphic mode
pause 500
'z=0
gosub gpt 'clear screen
astart=0
aend=0 '1234567890ABCDEF
arraywrite topline, [" "]
arraywrite botline, [" "]
for c=0 to 24 step 8
gosub gcoder
next
drk:
gosub gettime
if CAMi.0=1 then 'blink the dots each second
separ=58
else
separ=32
endif
arraywrite TOPLINE, [dec saati dig 1,dec saati dig 0,32, dec cuti dig 1, dec cuti dig 0,32, dec cami dig 1, dec cami dig 0,32, dec TVE DIG 1, DEC TVE DIG 0,"{", DEC ricxvi DIG 1, DEC ricxvi dig 0]
C=0
'astart=1+16
'aend=2+16
if cvlileba=1 then GOSUB GCODER
pause 50
goto drk
stop
GCODER:
FOR X=0 TO 30 step 2 'READ ARRAY INTO VARIABLE, ARRAY MEMBER CHAR=EEPROM OFFSET
if X<15 then
Y=(topline[x]-48)*8
Z=(topline[x+1]-48)*8 'READ INTO VARIABLE AS TWINS
endif
if x>15 then
Y=(botline[x-16]-48)*8
Z=(botline[x-15]-48)*8 'READ INTO VARIABLE AS TWINS
endif
FOR I=0 TO 7 'HELPER LOOP FOR CHARACTER READING
LCDOUT $FE,$80+c+i 'UPDATE Y POSITION
LCDOUT $FE,$80+x/2 'UPDATE X POSITION
READ Y+I,A 'READ EEPROM BYTES INTO VAR
READ Z+I,B
if topline[x]=32 or botline[x-16]=32 then a=0
if topline[x+1]=32 or botline[x-15]=32 then b=0 'blanker
if X=>astart and x<=aend and astart<>aend then
a=A^%11111111
b=b^%11111111
endif
if a=$FE then a=0
if b=$fe then b=0
LCDOUT a
LCDOUT b 'WRITE TO SCREEN
NEXT I
NEXT X
return
GPT:
for y=0 to 30 step 2
LCDOUT $FE,$80+y
LCDOUT $FE,$80
FOR x=1 TO 16
LCDOUT 0
NEXT
next
return
gettime:
I2CRead SDA, SCL, $D0, $00, [RTCSec, RTCMin, RTCHour, RTCDay, RTCDate, RTCMonth, RTCYear, RTCCtrl]
CAMI=(RTCSEC >> 4)*10+RTCSEC // 16
CUTI=(RTCmin >> 4)*10+RTCmin // 16 'decode seconds
SAATI=(RTCHour >> 4)*10+RTCHour // 16 'decode hours
TVE=(RTCmonth >> 4)*10+RTCmonth // 16 'decode month
RICXVI=(RTCdate >> 4)*10+RTCdate // 16 'decode month
DGE=RTCday
if DRO<>rtcsec then 'check for time changes, so display only is refreshed when time is changed
cvlileba=1
else
cvlileba=0
endif
DRO=rtcmin
Return
Bookmarks