avatar_berkerucar

PCF8563T ile (I2C) ALARM TARİH SAAT DEVRESİ.

Başlatan berkerucar, 02 Ağustos 2015, 23:07:21

berkerucar

Merhaba arkadaşlar,
Daha önce I2C ile haberleşen herhangi bir entegreyi PIC ile kullanmamış arkadaşlar için, bir süre önce yapmış olduğum bu projeyi,
yardımı olabilir diye burada paylaşmak istedim. Kodlar, şema ve proteus dosyası aşağıdadır. Herkese iyi çalışmalar.



#header
  errorlevel -306  ; Crossing page boundry
#ENDHEADER
'__________________SİGORTA AYARLARIM_____________________________
#CONFIG
  __CONFIG _XT_OSC & _WDT_OFF & _PWRTE_ON & _LVP_OFF & _CP_OFF & _BODEN_OFF
#ENDCONFIG
'__________________TANIMLAMALARIM________________________________

TRISA=%00000000 
TRISB=%00000001 ' RB0 KESMESİ İÇİN RB0 GİRİŞ YAP.
TRISC=%00011000 ' I2C PİNLERİ İÇİN.
TRISD=%00000111 ' BUTONLAR VE HOP.
PORTA=0
PORTB=0
PORTC=0
PORTD=0

DEFINE OSC 4
DEFINE LCD_DREG PORTB      ''LCD data bacakları PortB de bağlı
DEFINE LCD_DBIT 4     ''LCD data bacakları 4. bitten başlıyor
DEFINE LCD_EREG PORTB     ''LCD Enable Bacağı PortB de bağlı
DEFINE LCD_EBIT 3      ''LCD Enable Bacağı 3. bite bağlı
DEFINE LCD_RSREG PORTB    ''LCD RS Bacağı PortB de bağlı
DEFINE LCD_RSBIT 1       ''LCD RS bacağı 1. Bite bağlı
DEFINE LCD_BITS 4     ' 'LCD 4 bit olarak bağlı
DEFINE LCD_LINES 2    ''LCD 2 sıra olarak çalışıyor.

Symbol SMP = SSPSTAT.7       ' 1:enable YÜKSEK HIZ , 0: DÜŞÜK HIZ
Symbol CKE = SSPSTAT.6       ' 0 YAP
Symbol DATA_ADDR = SSPSTAT.5 ' 1: SON BİT DATAYDI, 0: SON BİT ADRESTİ.
Symbol P = SSPSTAT.4         ' I2C STOP ALGILAMA
Symbol S = SSPSTAT.3         ' I2C START ALGILAMA
Symbol R_W = SSPSTAT.2       ' 1: OKUMA 0: YAZMA
Symbol UA = SSPSTAT.1        ' 1: SSPADD UPDATE İÇİN
Symbol BF = SSPSTAT.0        ' BUFFER DURUM BAYRAĞI.
Symbol WCOL  = SSPCON.7  ' ÇAKIŞMA TESPİT PİNİ.
Symbol SSPOV = SSPCON.6  ' OVERFLOW ALGILAMA. 
Symbol SSPEN = SSPCON.5  ' MSSP ENABLE ETME PİNİ.
Symbol CKP   = SSPCON.4  ' SCK BOŞTA KONTROL PİNİ.
Symbol SSPM3 = SSPCON.3  ' BU 4 PİN HIZ AYARI İÇİN:
Symbol SSPM2 = SSPCON.2  ' 1000: MASTER'DA F/4(SSPADD+1)
Symbol SSPM1 = SSPCON.1  ' 
Symbol SSPM0 = SSPCON.0  '
Symbol GCEN    = SSPCON2.7 ' GENERAL CALL ENABLE BİTİ.
Symbol ACKSTAT = SSPCON2.6 ' 1: ACKNOWLEDGE ALINMADI. 0: ALINDI.
Symbol ACKDT   = SSPCON2.5 ' 1: ACKNOWLEDGE VAR. 0: YOK.
Symbol ACKEN   = SSPCON2.4 ' ACKNOWLEDGE SEQUENCE ENABLE BİTİ.
Symbol RCEN    = SSPCON2.3 ' 1: ALMA ENABLE BİTİ. 0: İPTAL.
Symbol PEN     = SSPCON2.2 ' STOP BİTİ ENABLE BİTİ.
Symbol RSEN    = SSPCON2.1 ' TEKRARLANAN START BİTİ. 
Symbol SEN     = SSPCON2.0 ' START BİTİ ENABLE.

SSPBUF=0   ' TAMPONU TEMİZLE :)
TXSTA.5=1 ' VERİ GÖNDERİMİNE İZİN VER.
RCSTA.7=1 ' VERİ ALMAYA İZİN VER.
RCSTA.4=1 
SSPADD  = 49     '100kHz
SSPSTAT = 0  ' DURUM BİTLETİYLE İŞİM YOK.
SSPCON2 = %00101111 ' MASTER AYARLARIM.
SSPCON = %00101000  ' MASTER AYARLARIM.

OPTION_REG.7=1 ' VARSA DAHİLİ PULL-UP DİRENÇLER İPTAL.
INTCON.7=1 ' KESMELER AKTİF.
INTCON.6=0 ' PERIPHERAL KESMELER KAPALI.
INTCON.4=1 ' RB0 KESMESİ AKTİF.
ON INTERRUPT GOTO KESME1
ADCON1=7 ' ANALOG DIJITAL CEVIRICILER IPTAL.
;CMCON=7 ' KOMPARATÖR ( ANALOG KARŞILAŞTIRICI) PİNLERİ İPTAL.

SYMBOL SET=PORTB.0
SYMBOL ASAGI=PORTD.0
SYMBOL YUKARI=PORTD.1
SYMBOL TAMAM=PORTD.2

YAZCAM VAR BYTE
OKUCAM VAR BYTE
AYAREN VAR BIT

ADR_SANIYE VAR BYTE
ADR_DAKIKA VAR BYTE
ADR_SAAT VAR BYTE
ADR_GUN VAR BYTE
ADR_GUNISIM VAR BYTE
ADR_AY VAR BYTE
ADR_YIL VAR BYTE
ADR_ALRDAKIKA VAR BYTE
ADR_ALRSAAT VAR BYTE
ADR_ALRGUN VAR BYTE
ADR_ALRGUNISIM VAR BYTE
ADR_CS1 VAR BYTE
ADR_CS2 VAR BYTE
ADR_CLKOUT VAR BYTE

SANIYE VAR BYTE
DAKIKA VAR BYTE
SAAT VAR BYTE
GUN VAR BYTE
GUNISIM VAR BYTE
AY VAR BYTE
YIL VAR BYTE
HAFTAGUNU VAR BYTE
MENUSECIM VAR BIT
MENUSESI VAR BYTE
SESSURE VAR BYTE
CLKOUT VAR BYTE

SANIYE1 VAR BYTE
DAKIKA1 VAR BYTE
SAAT1 VAR BYTE
GUN1 VAR BYTE
GUNISIM1 VAR BYTE
AY1 VAR BYTE
YIL1 VAR BYTE
ALARMSAAT VAR BYTE
ALARMDAKIKA VAR BYTE
ALARMSAAT1 VAR BYTE
ALARMDAKIKA1 VAR BYTE
ALARMGUN VAR BYTE
ALARMGUNISIM VAR BYTE
KUR VAR BIT
CONTROLSTATUS1 VAR BYTE
CONTROLSTATUS2 VAR BYTE

YAZCAM=%10100010
OKUCAM=%10100011
ADR_CS1=%00000000 ' CONTROL STATUS1 ADRESI
ADR_CS2=%00000001 ' CONTROL STATUS2 ADRESI.
ADR_CLKOUT=%00001101
ADR_SANIYE=%00000010 ' SANIYE ADRES
ADR_DAKIKA=%00000011 ' DAKIKA ADRES
ADR_SAAT=%00000100 ' SAAT.
ADR_GUN=%00000101 ' GUN
ADR_GUNISIM=%00000110 ' HAFTA GUNLERI
ADR_AY=%00000111 ' AYLAR
ADR_YIL=%00001000 ' YIL
ADR_ALRDAKIKA=%00001001 'ALARM DAKIKA
ADR_ALRSAAT=%00001010 ' ALARM SAAT
ADR_ALRGUN=%00001011 ' ALARM GUN 
ADR_ALRGUNISIM=%00001100 ' ALARM GUNISIM

AYAREN=0;        ' AYAR ENABLE PASIF.
MENUSECIM=0 ' SAAT AYARI AKTIF.
SANIYE1=0
DAKIKA1=0
SAAT1=0
GUN1=1
GUNISIM1=4
AY1=1
YIL1=%00010101
ALARMSAAT=0
ALARMDAKIKA=0
ALARMGUN=%10000000
ALARMGUNISIM=%10000000
ALARMSAAT1=0
ALARMDAKIKA1=0
KUR=0
MENUSESI=120
SESSURE=10
CLKOUT=%00000000 ' CLOCK OUT İPTAL.
CONTROLSTATUS1=%00000000 ' TEST MODU KAPALI.
CONTROLSTATUS2=%00001010 ' AF VE AIE ENABLE.

PAUSE 200

'___________________GENEL AYARLARI YAP_________________________

I2CWRITE PORTC.4,PORTC.3,YAZCAM,ADR_CLKOUT,[CLKOUT]
PAUSE 10
I2CWRITE PORTC.4,PORTC.3,YAZCAM,ADR_ALRGUN,[ALARMGUN]
PAUSE 10
I2CWRITE PORTC.4,PORTC.3,YAZCAM,ADR_ALRGUNISIM,[ALARMGUNISIM]
PAUSE 10
I2CWRITE PORTC.4,PORTC.3,YAZCAM,ADR_CS1,[CONTROLSTATUS1]
PAUSE 10
I2CWRITE PORTC.4,PORTC.3,YAZCAM,ADR_CS2,[CONTROLSTATUS2]
PAUSE 10

I2CWRITE PORTC.4,PORTC.3,OKUCAM,ADR_SANIYE,[SANIYE1]
PAUSE 10
I2CWRITE PORTC.4,PORTC.3,OKUCAM,ADR_DAKIKA,[DAKIKA1]
PAUSE 10
I2CWRITE PORTC.4,PORTC.3,OKUCAM,ADR_SAAT,[SAAT1]
PAUSE 10
I2CWRITE PORTC.4,PORTC.3,OKUCAM,ADR_GUN,[GUN1]
PAUSE 10
I2CWRITE PORTC.4,PORTC.3,OKUCAM,ADR_GUNISIM,[GUNISIM1]
PAUSE 10
I2CWRITE PORTC.4,PORTC.3,OKUCAM,ADR_AY,[AY1]
PAUSE 10
I2CWRITE PORTC.4,PORTC.3,OKUCAM,ADR_YIL,[YIL1]
PAUSE 10

'____________________ANA PROGRAMIM_____________________________

MAIN:

I2CREAD PORTC.4,PORTC.3,OKUCAM,ADR_SANIYE,[SANIYE]
PAUSE 10
SANIYE1= ((SANIYE & %01110000)>>4*10) + (SANIYE & $0F)
I2CREAD PORTC.4,PORTC.3,OKUCAM,ADR_DAKIKA,[DAKIKA]
PAUSE 10
DAKIKA1= ((DAKIKA & %01110000)>>4*10) + (DAKIKA & $0F)
I2CREAD PORTC.4,PORTC.3,OKUCAM,ADR_SAAT,[SAAT]
PAUSE 10
SAAT1= ((SAAT & %00110000)>>4*10) + (SAAT & $0F)
I2CREAD PORTC.4,PORTC.3,OKUCAM,ADR_GUN,[GUN]
PAUSE 10
GUN1= ((GUN & %00110000)>>4*10) + (GUN & $0F)
I2CREAD PORTC.4,PORTC.3,OKUCAM,ADR_GUNISIM,[GUNISIM]
PAUSE 10
GUNISIM1=GUNISIM
I2CREAD PORTC.4,PORTC.3,OKUCAM,ADR_AY,[AY]
PAUSE 10
AY1= ((AY & %00010000)>>4*10) + (AY & $0F)
I2CREAD PORTC.4,PORTC.3,OKUCAM,ADR_YIL,[YIL]
PAUSE 10
YIL1= ((YIL & %00010000)>>4*10) + (YIL & $0F)
I2CREAD PORTC.4,PORTC.3,OKUCAM,ADR_CS2,[CONTROLSTATUS2]
PAUSE 10

IF CONTROLSTATUS2.3=1 THEN
GOTO ALARMCAL
ENDIF

Select Case GUNISIM1
case 0
LCDOUT $FE,$89,"PAZAR"
case 1        
LCDOUT $FE,$89,"PZTS."
case 2
LCDOUT $FE,$89,"SALI"
case 3
LCDOUT $FE,$89,"CARS."
case 4
LCDOUT $FE,$89,"PERS."
case 5
LCDOUT $FE,$89,"CUMA"
case 6
LCDOUT $FE,$89,"CMTS."
End Select
Select Case AY1
case 1
LCDOUT $FE,$C3, "OCAK"
case 2
LCDOUT $FE,$C3, "SUB."
case 3
LCDOUT $FE,$C3, "MART"
case 4
LCDOUT $FE,$C3, "NIS."
case 5
LCDOUT $FE,$C3, "MAY."
case 6
LCDOUT $FE,$C3, "HAZ."
case 7
LCDOUT $FE,$C3, "TEM."
case 8
LCDOUT $FE,$C3, "AGU."
case 9
LCDOUT $FE,$C3, "EYL."
case 10
LCDOUT $FE,$C3, "EKIM"
case 11
LCDOUT $FE,$C3, "KAS."
case 12
LCDOUT $FE,$C3, "ARA."
End Select

LCDOUT $FE,2, DEC2 SAAT1,":",DEC2 DAKIKA1,":",DEC2 SANIYE1
LCDOUT $FE,$C0, DEC2 GUN1
LCDOUT $FE,$C8, "20", DEC2 YIL1
IF AYAREN=1 THEN
GOTO MENU
ELSE  
GOTO MAIN
ENDIF

;_____________________ALARM CAL________________________________
ALARMCAL:
LCDOUT $FE,2,"GUNAYDIN :)       "
SOUND PORTD.3, [120,15,120,15,120,15,120,25]
PAUSE 200
IF TAMAM=0 THEN
WHILE TAMAM=0
WEND
SOUND PORTD.3, [MENUSESI,SESSURE]
CONTROLSTATUS2=%00000000
PAUSE 10
I2CWRITE PORTC.4,PORTC.3,YAZCAM,ADR_CS2,[CONTROLSTATUS2]
PAUSE 10
ENDIF
I2CREAD PORTC.4,PORTC.3,OKUCAM,ADR_CS2,[CONTROLSTATUS2]
PAUSE 10
IF CONTROLSTATUS2.3=1 THEN
GOTO ALARMCAL
ENDIF
LCDOUT $FE,1
GOTO MAIN
;_____________________AYARLAMA DONGUSU_________________________
MENU:
AYAREN=0
IF MENUSECIM=0 THEN
LCDOUT $FE,2,"____ANA MENU____ "
LCDOUT $FE,$C0,"< SAAT AYARLA >  "
ENDIF 
IF MENUSECIM=1 THEN
LCDOUT $FE,2,"____ANA MENU____ "
LCDOUT $FE,$C0,"< ALARM KUR >    "
ENDIF
IF ASAGI=0 THEN
SOUND PORTD.3, [MENUSESI,SESSURE]
TOGGLE MENUSECIM
WHILE ASAGI=0
WEND
ENDIF
IF YUKARI=0 THEN
SOUND PORTD.3, [MENUSESI,SESSURE]
TOGGLE MENUSECIM
WHILE YUKARI=0
WEND
ENDIF
IF TAMAM=0 THEN
SOUND PORTD.3, [MENUSESI,SESSURE]
WHILE TAMAM=0
WEND
IF MENUSECIM=0 THEN
GOTO AYARYIL
ENDIF
IF MENUSECIM=1 THEN
GOTO AYARALARM
ENDIF
ENDIF
GOTO MENU
AYARALARM:
LCDOUT $FE,2,"ALARM SAATI:    "
LCDOUT $FE,$C0," < ",DEC2 ALARMSAAT1," >             "
PAUSEUS 10
IF ASAGI=0 THEN
SOUND PORTD.3, [MENUSESI,SESSURE]
ALARMSAAT1=ALARMSAAT1-1
WHILE ASAGI=0
WEND
ENDIF
IF YUKARI=0 THEN
SOUND PORTD.3, [MENUSESI,SESSURE]
ALARMSAAT1=ALARMSAAT1+1
WHILE YUKARI=0
WEND
ENDIF
IF ALARMSAAT1=24 THEN
ALARMSAAT1=00
ENDIF
IF ALARMSAAT1=255 THEN
ALARMSAAT1=23
ENDIF
IF TAMAM=0 THEN
SOUND PORTD.3, [MENUSESI,SESSURE]
WHILE TAMAM=0
WEND
GOTO ALARMDK
ELSE 
GOTO AYARALARM
ENDIF

ALARMDK:
LCDOUT $FE,2,"ALARM DAKIKASI:   "
LCDOUT $FE,$C0," < ",DEC2 ALARMDAKIKA1," >            "
PAUSEUS 10
IF ASAGI=0 THEN
SOUND PORTD.3, [MENUSESI,SESSURE]
ALARMDAKIKA1=ALARMDAKIKA1-1
WHILE ASAGI=0
WEND
ENDIF
IF YUKARI=0 THEN
SOUND PORTD.3, [MENUSESI,SESSURE]
ALARMDAKIKA1=ALARMDAKIKA1+1
WHILE YUKARI=0
WEND
ENDIF
IF ALARMDAKIKA1=60 THEN
ALARMDAKIKA1=00
ENDIF
IF ALARMDAKIKA1=255 THEN
ALARMDAKIKA1=59
ENDIF
IF TAMAM=0 THEN
SOUND PORTD.3, [MENUSESI,SESSURE]
WHILE TAMAM=0
WEND
GOTO ALARMAYARLA
ELSE 
GOTO ALARMDK
ENDIF

ALARMAYARLA:
LCDOUT $FE,2,DEC2 ALARMSAAT1,":",DEC2 ALARMDAKIKA1," SAATINE      "
SELECT CASE KUR
CASE 0
LCDOUT $FE,$C0,"ALR. KUR?","> EVET   "
CASE 1
LCDOUT $FE,$C0,"ALR. KUR?","> HAYIR  "
END SELECT                    
IF ASAGI=0 THEN
SOUND PORTD.3, [MENUSESI,SESSURE]
TOGGLE KUR
WHILE ASAGI=0
WEND
ENDIF
IF YUKARI=0 THEN
SOUND PORTD.3, [MENUSESI,SESSURE]
TOGGLE KUR
WHILE YUKARI=0
WEND
ENDIF
IF TAMAM=0 AND KUR=1 THEN
SOUND PORTD.3, [MENUSESI,SESSURE]
WHILE TAMAM=0
WEND
LCDOUT $FE,1
GOTO MAIN
ENDIF
IF TAMAM=0 AND KUR=0 THEN
SOUND PORTD.3, [MENUSESI,SESSURE]
WHILE TAMAM=0
WEND
GOTO ALARMAYARLA2
ENDIF
GOTO ALARMAYARLA

ALARMAYARLA2:
LCDOUT $FE,1
LCDOUT $FE,2,"ALARM KURULDU. "
PAUSE 500
ALARMSAAT=((ALARMSAAT1 / 10) << 4) + (ALARMSAAT1 // 10)
PAUSE 10
ALARMDAKIKA=((ALARMDAKIKA1 / 10) << 4) + (ALARMDAKIKA1 // 10)
PAUSE 10
I2CWRITE PORTC.4,PORTC.3,YAZCAM,ADR_ALRSAAT,[ALARMSAAT]
PAUSE 10
I2CWRITE PORTC.4,PORTC.3,YAZCAM,ADR_ALRDAKIKA,[ALARMDAKIKA]
PAUSE 10
LCDOUT $FE,1
GOTO MAIN

AYARYIL:
LCDOUT $FE,2,"YILI GIRINIZ:     "
LCDOUT $FE,$C0,"20",DEC2 YIL1,"            "
PAUSEUS 10
IF ASAGI=0 THEN
SOUND PORTD.3, [MENUSESI,SESSURE]
YIL1=YIL1-1
WHILE ASAGI=0
WEND
ENDIF
IF YUKARI=0 THEN
SOUND PORTD.3, [MENUSESI,SESSURE]
YIL1=YIL1+1
WHILE YUKARI=0
WEND
ENDIF
IF YIL1=100 THEN
YIL1=00
ENDIF
IF YIL1=255 THEN
YIL1=99
ENDIF
IF TAMAM=0 THEN
WHILE TAMAM=0
SOUND PORTD.3, [MENUSESI,SESSURE]
WEND
GOTO AYARAY
ELSE
GOTO AYARYIL
ENDIF

AYARAY:
LCDOUT $FE,2,"AYI GIRINIZ:    "
LCDOUT $FE,$C0,"< ",DEC2 AY1," >          "
PAUSEUS 10
IF ASAGI=0 THEN
SOUND PORTD.3, [MENUSESI,SESSURE]
AY1=AY1-1
WHILE ASAGI=0
WEND
ENDIF
IF YUKARI=0 THEN
SOUND PORTD.3, [MENUSESI,SESSURE]
AY1=AY1+1
WHILE YUKARI=0
WEND
ENDIF
IF AY1=13 THEN
AY1=1
ENDIF
IF AY1=0 THEN
AY1=12
ENDIF
IF TAMAM=0 THEN
SOUND PORTD.3, [MENUSESI,SESSURE]
WHILE TAMAM=0
WEND
GOTO AYARGUN
ELSE
GOTO AYARAY
ENDIF

AYARGUN:
LCDOUT $FE,2,"GUNU GIRINIZ:     "
LCDOUT $FE,$C0,"< ",DEC2 GUN1," >         "
PAUSEUS 10
IF ASAGI=0 THEN
SOUND PORTD.3, [MENUSESI,SESSURE]
GUN1=GUN1-1
WHILE ASAGI=0
WEND
ENDIF
IF YUKARI=0 THEN
SOUND PORTD.3, [MENUSESI,SESSURE]
GUN1=GUN1+1
WHILE YUKARI=0
WEND
ENDIF
IF GUN1=32 THEN
GUN1=1
ENDIF
IF GUN1=0 THEN
GUN1=31
ENDIF
IF TAMAM=0 THEN
SOUND PORTD.3, [MENUSESI,SESSURE]
WHILE TAMAM=0
WEND
GOTO AYARGUNISIM
ELSE
GOTO AYARGUN
ENDIF

AYARGUNISIM:
LCDOUT $FE,2,"HANGI GUN?      "
Select Case GUNISIM1
case 0
LCDOUT $FE,$C0,"< ","PAZAR >      "
case 1        
LCDOUT $FE,$C0,"< ","PAZARTESI >  "
case 2
LCDOUT $FE,$C0,"< ","SALI >       "
case 3
LCDOUT $FE,$C0,"< ","CARSAMBA >   "
case 4
LCDOUT $FE,$C0,"< ","PERSEMBE >   "
case 5
LCDOUT $FE,$C0,"< ","CUMA >       "
case 6
LCDOUT $FE,$C0,"< ","CUMARTESI >  "
End Select
PAUSEUS 10
IF ASAGI=0 THEN
SOUND PORTD.3, [MENUSESI,SESSURE]
GUNISIM1=GUNISIM1-1
WHILE ASAGI=0
WEND
ENDIF
IF YUKARI=0 THEN
SOUND PORTD.3, [MENUSESI,SESSURE]
GUNISIM1=GUNISIM1+1
WHILE YUKARI=0
WEND
ENDIF
IF GUNISIM1=7 THEN
GUNISIM1=0
ENDIF
IF GUNISIM1=255 THEN
GUNISIM1=6
ENDIF
GUNISIM=GUNISIM1
IF TAMAM=0 THEN
SOUND PORTD.3, [MENUSESI,SESSURE]
WHILE TAMAM=0
WEND
GOTO AYARSAAT
ELSE
GOTO AYARGUNISIM
ENDIF

AYARSAAT:
LCDOUT $FE,2,"SAATI GIRINIZ:      "
LCDOUT $FE,$C0,DEC2 SAAT1,"                 "
IF ASAGI=0 THEN
SOUND PORTD.3, [MENUSESI,SESSURE]
SAAT1=SAAT1-1
WHILE ASAGI=0
WEND
ENDIF
IF YUKARI=0 THEN
SOUND PORTD.3, [MENUSESI,SESSURE]
SAAT1=SAAT1+1
WHILE YUKARI=0
WEND
ENDIF
IF SAAT1=24 THEN
SAAT1=0
ENDIF
IF SAAT1=255 THEN
SAAT1=23
ENDIF
IF TAMAM=0 THEN
SOUND PORTD.3, [MENUSESI,SESSURE]
WHILE TAMAM=0
WEND
GOTO AYARDAKIKA
ELSE
GOTO AYARSAAT
ENDIF

AYARDAKIKA:
LCDOUT $FE,2,"DAKIKA GIRINIZ:       "
LCDOUT $FE,$C0,DEC2 DAKIKA1,"               "
IF ASAGI=0 THEN
SOUND PORTD.3, [MENUSESI,SESSURE]
DAKIKA1=DAKIKA1-1
WHILE ASAGI=0
WEND
ENDIF
IF YUKARI=0 THEN
SOUND PORTD.3, [MENUSESI,SESSURE]
DAKIKA1=DAKIKA1+1
WHILE YUKARI=0
WEND
ENDIF
IF DAKIKA1=60 THEN
DAKIKA1=00
ENDIF
IF DAKIKA1=255 THEN
DAKIKA1=59
ENDIF
IF TAMAM=0 THEN
SOUND PORTD.3, [MENUSESI,SESSURE]
WHILE TAMAM=0
WEND
GOTO AYARLA
ELSE
GOTO AYARDAKIKA
ENDIF

AYARLA:
LCDOUT $FE,1,"AYARLANIYOR."
PAUSE 200
SANIYE = %00000000
DAKIKA = ((DAKIKA1 / 10) << 4) + (DAKIKA1 // 10)
SAAT = ((SAAT1 / 10) << 4) + (SAAT1 // 10)
GUN = ((GUN1 / 10) << 4) + (GUN1 // 10)
AY = ((AY1 / 10) << 4) + (AY1 // 10)
YIL = ((YIL1 / 10) << 4) + (YIL1 // 10)
PAUSE 10
I2CWRITE PORTC.4,PORTC.3,YAZCAM,ADR_SANIYE,[SANIYE]
PAUSE 10
I2CWRITE PORTC.4,PORTC.3,YAZCAM,ADR_DAKIKA,[DAKIKA]
PAUSE 10
I2CWRITE PORTC.4,PORTC.3,YAZCAM,ADR_SAAT,[SAAT]
PAUSE 10
I2CWRITE PORTC.4,PORTC.3,YAZCAM,ADR_GUN,[GUN]
PAUSE 10
I2CWRITE PORTC.4,PORTC.3,YAZCAM,ADR_GUNISIM,[GUNISIM]
PAUSE 10
I2CWRITE PORTC.4,PORTC.3,YAZCAM,ADR_AY,[AY]
PAUSE 10
I2CWRITE PORTC.4,PORTC.3,YAZCAM,ADR_YIL,[YIL]
PAUSE 10 
LCDOUT $FE,1
goto MAIN
 
DISABLE
KESME1:
SOUND PORTD.3, [MENUSESI,SESSURE]
LCDOUT $FE,1,"AYAR YAPMAK ICIN"
LCDOUT $FE,$C0,"LUTFEN BEKLEYIN"
PAUSE 800
AYAREN=1;
INTCON.1=0  'RB0/INT BAYRAĞINI TEMİZLE.
Resume      'geldiğin yere dön. 
ENABLE
END


Dosyalar : http://s2.dosya.tc/server3/3qv4mf/PCF8563.rar.html

er-da

eline sağlık .. proteus sim  dahil butün dosyaları  tek paket halinde yüklersen  iyi olur...

Cesar35

Hello, how are you
About your project posted here on the forum
Watch with PCF8563 could you send me the complete one I really liked your code .I will be grateful .A hug

ete

Proje dosyaları yüklenen yerden kaldırılmış.
Bu arkadaşa yardım edelim.Önceden yüklemiş birisi var ise yeniden buraya koyuversin lütfen.

Ete

ete

#4
Gerek Kalmadı, Programı yeniden derledim. Ayrıca programa bakarak şemayı yeniden çizdim.

Dosyalar ilişiktedir.

Cesar , I compiled the program and prepared new schema by looking to the program.
I tried also in simulation is working.
Ete


Cesar35

Thanks for the help I think there is something missing in the simulation I can not see the current time on the display here the full file

Powered by EzPortal