'****************************************************************
'* Author : [Hüseyin GÜNER - ViProje] *
'* Notice : Copyright (c) 2010 *
'* Date : 06.05.2010 *
'* Version : 2.0 *
'****************************************************************
Device = 16F628A 'PIC'i tanýtýyoruz.
Config INTRC_OSC_CLKOUT, MCLRE_OFF, LVP_OFF, WDT_OFF, PWRTE_OFF, CP_OFF, BODEN_OFF
Declare I2C_SCLOUT On
'---------------------------LCD--------------------------------
LCD_DTPIN = PORTB.0
LCD_RSPIN = PORTB.4
LCD_ENPIN = PORTA.3
LCD_INTERFACE = 4 ' 4-bit Interface
LCD_LINES = 2
LCD_TYPE = 0
CMCON = 7
'---------------------------Adresler----------------------------
Dim FREKANS_step As Word 'Frekans Onda sayý
Dim FREKANS_Tam As Word 'Frekans Tam sayý
Dim FREKANS_Onda As Word 'Frekans stepi
Dim FREKANS As Word 'Frekans bilgisi deðiþkeni
Dim F_KONTROL As Word 'KONTROL deðikenini tanýmladýk
Dim LO As FREKANS.LowByte 'Frekans deðiþkeninin düþük byte'ý
Dim HI As FREKANS.HighByte 'Frekans deðiþkeninin yüksek byte'ý
'--------------------------Portlar------------------------------
Symbol SDA = PORTA.1 'I2C'nin SDA'sý PORTA.1'ya baðlý
Symbol SCL = PORTA.0 'I2C'nin Scl'si PORTA.0'ya baðlý
Symbol LED = PORTA.2 'LED PORTA.2'e baðlý
PORTA=0 : PORTB=0 'PORTA ve PORTB sýfýrlandý
'------------------------Eepromdan OKu--------------------------
bas:
High LED
Print At 1,1, " TRANSMISORES FM "
Print At 2,1, " JOGYWEB "
DelayMS 3000
FREKANS_step = ERead 02 'Frekans Deyerini EData dan okuyor
If FREKANS_step > 0 Then TsaYaz 'Frekans Bilgisi 0 Dan Büyük ise Tsa yaza gidiyor
'----------------------Frekans Deðiþtir-------------------------
Frekans_set:
FREKANS_Onda = (FREKANS_step*10/2)//100
FREKANS_Tam = (FREKANS_step*10/2)/100
Print At 1,1, "Frec: ", Dec FREKANS_Tam, ".", Dec FREKANS_Onda," MHz " 'LCD Yaz
Print At 2,1, " Cambiar Frecuencia " 'LCD Yaz
DelayMS 100
If PORTB.5=1 Then Artir_frekans
If PORTB.7=1 Then Azalt_frekans
If PORTB.6=1 Then Kaydet_frekans
'----------------------- Tsa5511 e yaz--------------------------
FREKANS = FREKANS_step
I2CWRITE SDA,SCL,$C2, [HI,LO,$8E,$10]
GoTo Frekans_set
Artir_frekans:
FREKANS_step=FREKANS_step + 1 'içeriði 5 artir
If FREKANS_step > 7200 Then FREKANS_step=6000 'içerik 10800 dan büyük ise 8750 yap
GoTo Frekans_set
Azalt_frekans:
FREKANS_step=FREKANS_step-1 'içeriði 5 azalt
If FREKANS_step < 6000 Then FREKANS_step=7200 'içerik 8750 den küçük ise 10800 yap
GoTo Frekans_set
'--------------------------Edataya yaz---------------------------
Kaydet_frekans:
EWrite 02 ,[FREKANS_step] 'Frekans Bilgisini Edataya yazýyor
DelayMS 500
'----------------------- Tsa5511 e yaz--------------------------
TsaYaz:
FREKANS_Onda = (FREKANS_step*10/2)//100
FREKANS_Tam = (FREKANS_step*10/2)/100
Print At 1,1, "Ajustando Frec. ", Dec FREKANS_Tam, ".", Dec FREKANS_Onda, " MHz " 'lcd yaz
Print At 2,1, " TRANSMISOR FM " 'LCD Yaz
FREKANS = FREKANS_step
I2CWRITE SDA,SCL,$C2, [HI,LO,$8E,$00]
DelayMS 1000
'----------------------Tsa5511i Kontrol et----------------------
If PORTB.6=1 Then Frekans_set
I2CREAD SDA,SCL,$C2,[F_KONTROL]
If F_KONTROL.6=1 Then Kitli
GoTo TsaYaz
Kitli:
I2CWRITE SDA,SCL,$C2, [HI,LO,$8E,$24]
FREKANS_Onda = (FREKANS_step*10/2)//100
FREKANS_Tam = (FREKANS_step*10/2)/100
Print At 1,1, "Frec: ", Dec FREKANS_Tam, ".", Dec FREKANS_Onda, " ", "MHz " 'lcd Yaz
Print At 2,1, " TRANSMISOR FM " 'LCD Yaz
K_buton:
DelayMS 100
If PORTB.5=1 Then LCD_Led_Off
If PORTB.7=1 Then LCD_Led_On
If PORTB.6=1 Then Frekans_set
GoTo K_buton
LCD_Led_On:
High LED
GoTo K_buton
LCD_Led_Off:
Low LED
GoTo K_buton
End