'****************************************************************
'* Author : [Hüseyin GÜNER - ViProje] *
'* Notice : Copyright (c) 2010 *
'* Date : 16.08.2023 *
'* Version : 3.0 By RicBevi *
'* Receptor Enlace 300MHz Frecuencia mas FI 10.7MHz
'****************************************************************
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_Bus_SCL On'Declare I2C_SCLOUT On elimina la necesidad de resistencia PullUp en el Clok
Declare All_Digital = 1
Declare Xtal = 4
'---------------------------LCD--------------------------------
Declare LCD_DTPin = PORTB.0
Declare LCD_RSPin = PORTB.4
Declare LCD_ENPin = PORTA.3
Declare LCD_Interface = 4 ' 4-bit Interface
Declare LCD_Lines = 2
Declare LCD_Type = 0
CMCON = 7
'---------------------------Adresler----------------------------
Dim FREKANS_step As Word 'Frekans Onda sayý/ Parte decimal frecuencia
Dim FREKANS_Tam As Word 'Frekans Tam sayý/ Parte entera frecuencia
Dim FREKANS_Onda As Word 'Frekans stepi/ Paso de frecuencia PLL
Dim FREKANS As Word 'Frekans bilgisi deðiþkeni/ Variable con la FRECUENCIA
Dim Mostrar As Float 'Frecuencia a mostar en el display VCO menos FI (10.7MHz...214)
Dim F_KONTROL As Word 'KONTROL deðikenini tanýmladýk/ No reconocimos la palabra CONTROL
Dim LO As FREKANS.LowByte 'Frekans deðiþkeninin düþük byte'ý/ Byte bajo de variable de la FRECUENCIA
Dim HI As FREKANS.HighByte 'Frekans deðiþkeninin yüksek byte'ý/ Byte Alto de Variable de la FRECUENCIA
'--------------------------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ý
Symbol FI = 214 '10.7Mhz / step de 50Khz
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/ Lectura del valor de FRECUENCIA de EData
If FREKANS_step > 0 Then TsaYaz 'Frekans Bilgisi 0 Dan Büyük ise Tsa yaza gidiyor/ Si la información de FRECUENCIA es mayor que 0, Tsa ya fue programado
'----------------------Frekans Deðiþtir/Cambiar la frecuencia-------------------------
Frekans_set:
'FREKANS_Onda = (FREKANS_step*10/2)//100
'FREKANS_Tam = (FREKANS_step*10/2)/100
GoSub Operaciones
'Print At 1,1, "Frec: ", Dec FREKANS_Tam, ".", Dec FREKANS_Onda," MHz " 'LCD Yaz
Print At 1,1, "Frec: ", Dec2 Mostrar, " MHz " 'LCD Yaz
Print At 2,1, " Cambiar Frecuencia " 'LCD Yaz
DelayMS 100
If PORTB.5 = 1 Then Artir_frekans 'Subir Frecuencia
If PORTB.7 = 1 Then Azalt_frekans ' Bajar Frecuencia
If PORTB.6 = 1 Then Kaydet_frekans' Guardar Frecuencia
'----------------------- Tsa5511 e yaz/Escribe a tsa5511--------------------------
FREKANS = FREKANS_step
I2COut SDA,SCL,$C2, [HI,LO,$8E,$10] ' I2CWRITE SDA,SCL,$C2, [HI,LO,$8E,$10]
GoTo Frekans_set
Artir_frekans: 'Incrementa_Frecuencia
Inc FREKANS_step' = FREKANS_step + 1 'içeriði 5 artir/ el contenido aumenta en 5
If FREKANS_step > 7414 Then FREKANS_step = 6214 'içerik 10800 dan büyük ise 8750 yap/ Si el contenido es mayor a 10800, lo hace 8750
GoTo Frekans_set
Azalt_frekans: ' Decrementa_Frecuencia
Dec FREKANS_step' = FREKANS_step - 1 'içeriði 5 azalt/ reducir el contenido en 5
If FREKANS_step < 6214 Then FREKANS_step = 7414 'içerik 8750 den küçük ise 10800 yap/ si el contenido es menor a 8750 lo hace 10800
GoTo Frekans_set
'--------------------------Edataya yaz/escribir la data en la EEPROM---------------------------
Kaydet_frekans:
EWrite 02 ,[FREKANS_step] 'Frekans Bilgisini Edataya yazýyor/ Escribe la información de FRECUENCIA en el EEPROM
DelayMS 500
'----------------------- Tsa5511 e yaz/ Escribe el TSA5511--------------------------
TsaYaz: ' escribe el TSA
'FREKANS_Onda = (FREKANS_step*10/2)//100
'FREKANS_Tam = (FREKANS_step*10/2)/100
GoSub Operaciones
'Print At 1,1, "Ajustando Frec. ", Dec FREKANS_Tam, ".", Dec FREKANS_Onda, " MHz " 'lcd yaz/ escribe el LCD
Print At 1,1, "AjuFc. ", Dec2 Mostrar, "MHz " 'lcd yaz/ escribe el LCD
Print At 1,11,"."
Print At 2,1, " TRANSMISOR FM " 'LCD Yaz/ Escrie el LCD
FREKANS = FREKANS_step
I2COut SDA,SCL,$C2, [HI,LO,$8E,$00]'I2CWRITE SDA,SCL,$C2, [HI,LO,$8E,$00]
DelayMS 1000
'----------------------Tsa5511i Kontrol et----------------------
If PORTB.6 = 1 Then Frekans_set
I2CIn SDA,SCL,$C2,[F_KONTROL]'I2CREAD SDA,SCL,$C2,[F_KONTROL]
If F_KONTROL.6 = 1 Then Kitli '
GoTo TsaYaz
Kitli:
I2COut SDA,SCL,$C2, [HI,LO,$8E,$24]'I2CWRITE SDA,SCL,$C2, [HI,LO,$8E,$24]
'FREKANS_Onda = (FREKANS_step*10/2)//100
'FREKANS_Tam = (FREKANS_step*10/2)/100
GoSub Operaciones
'Print At 1,1, "Frec: ", Dec FREKANS_Tam, ".", Dec FREKANS_Onda, " ", "MHz " 'lcd Yaz
Print At 1,1, "Frec: ", Dec2 Mostrar, "MHz " 'lcd Yaz
Print At 1,10,"."
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
Operaciones:
Mostrar = (FREKANS_step - FI) * 0.05
FREKANS_Onda = (FREKANS_step * 5)//100 'FREKANS_Onda = (FREKANS_step*10/2)//100
FREKANS_Tam = FREKANS_step * 0.05 'FREKANS_Tam = (FREKANS_step*10/2)/100
Return
End