Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
April 18, 2024, 05:47:05 17:47


Login with username, password and session length


Pages: [1]
Print
Author Topic: I2C Error Code PIC16F628A - Need Help  (Read 7286 times)
0 Members and 1 Guest are viewing this topic.
galee
Newbie
*
Offline Offline

Posts: 11

Thank You
-Given: 0
-Receive: 0


« on: April 15, 2020, 03:03:38 15:03 »

Dear every member,
I am new member here.
I want to start discussing about FM PLL Transmitter, as  I know i found this code few year ago from other forum, and i never build this project.

Now I want to build the FM PLL Transmitter.

Well, I already trying to compiled this code under Proton and  I have and error some into I2C, and after disabled and changing some delay, i got much better to control the UP/DOWN/SET, but I still need to fixed that I2C code, because that will control a prescaller (IC).

Here are the code :
Code:
 
'****************************************************************
'*  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--------------------------------
        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ı
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ı
'DelayMS 3000
'------------------------Eepromdan OKu--------------------------

bas:
High LED
Print At 1,1, " FM TRANSMITTER "
Print At 2,1, "  Test RDVV  "
DelayMS 33000
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, " FRE SET ", Dec FREKANS_Tam, ",", Dec FREKANS_Onda,"  " 'LCD Yaz
Print  At 2,1, " RDVV 8Watt PLL " 'LCD Yaz
DelayMS 8550 '28
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, adres ,[HI,LO,$8e,$10]
'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 > 2160 Then FREKANS_step=1750 '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 < 1750 Then FREKANS_step=2160 '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 5350 '50
'----------------------- Tsa5511 e yaz--------------------------
TsaYaz:
FREKANS_Onda = (FREKANS_step*10/2)//100
FREKANS_Tam =  (FREKANS_step*10/2)/100
Print  At 1,1, " UnLock ", Dec FREKANS_Tam, ",", Dec FREKANS_Onda, "  " 'lcd yaz
Print  At 2,1, " RDVV 8Watt PLL " 'LCD Yaz
FREKANS = FREKANS_step

'i2cwrite SDA , SCL, adres ,[HI,LO,$8e,$00]
'I2CWRITE SDA,SCL,$C2, [HI,LO,$8E,$00]

DelayMS 5350 '150

'----------------------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, adres ,[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
Print  At 1,1, "   Lock ", Dec FREKANS_Tam, ",", Dec FREKANS_Onda, "  " 'lcd Yaz
Print  At 2,1, " RDVV 8Watt PLL " 'LCD Yaz
K_buton:
DelayMS 150'20
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
 

And here are the main problem :

'Declare I2C_SCLOUT On
'i2cwrite SDA , SCL, adres ,[HI,LO,$8e,$10]
'I2CWRITE SDA,SCL,$C2, [HI,LO,$8E,$10]
'i2cwrite SDA , SCL, adres ,[HI,LO,$8e,$00]
'I2CWRITE SDA,SCL,$C2, [HI,LO,$8E,$00]
'i2cwrite sda , scl, adres ,[hi,lo,$8e,$24]
'I2CWRITE SDA,SCL,$C2, [HI,LO,$8E,$24]

If those code inactivated then I2C connection doesn't produce to send register to prescaller and doesn't control the frequency.

Cheer,
 Cry
Galee.

Logged
towlerg
Senior Member
****
Offline Offline

Posts: 263

Thank You
-Given: 474
-Receive: 104

What is this for?


« Reply #1 on: April 16, 2020, 03:42:51 15:42 »

I'm guessing that your code is Proton. Suggest you join the board http://www.protonbasic.co.uk/forum.php
Logged

Win 7 Ult x64 SP1 on HP2570p
galee
Newbie
*
Offline Offline

Posts: 11

Thank You
-Given: 0
-Receive: 0


« Reply #2 on: April 16, 2020, 04:49:20 16:49 »

Towlerg,
Yes you right it code written under Proton Basic, but my Kaspersky indicate warning when i open that official website and doesn't open that page,  look like spammer into their website.

Galee.
Logged
TucoRamirez
Senior Member
****
Offline Offline

Posts: 307

Thank You
-Given: 257
-Receive: 115


Tuco ... dead or Alive


« Reply #3 on: April 17, 2020, 02:56:23 14:56 »

maybe check this one?

http://f6csx.free.fr/ATV/I2C/PILOTAGE_I2C.htm
Logged

Whoever double crosses me and leaves me alive... he understands nothing about Tuco.
galee
Newbie
*
Offline Offline

Posts: 11

Thank You
-Given: 0
-Receive: 0


« Reply #4 on: April 17, 2020, 10:06:07 22:06 »

Tuco Ramirez,
Thanks for your link.
As I know that code in PIC Basic and that for a receiver not for transmitter, that based on tuner as an oscillator, I wish to build FM PLL Transmitter not a receiver.

Once again thank you so much to try help me.

Galee.
Logged
Ahmad_k
SCG Moderator
Hero Member
*****
Offline Offline

Posts: 747

Thank You
-Given: 169
-Receive: 1288



« Reply #5 on: April 18, 2020, 07:03:45 07:03 »

Dear every member,
I am new member here.
I want to start discussing about FM PLL Transmitter, as  I know i found this code few year ago from other forum, and i never build this project.

Now I want to build the FM PLL Transmitter.

Well, I already trying to compiled this code under Proton and  I have and error some into I2C, and after disabled and changing some delay, i got much better to control the UP/DOWN/SET, but I still need to fixed that I2C code, because that will control a prescaller (IC).

Here are the code :
Code:
 
'****************************************************************
'*  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--------------------------------
        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ı
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ı
'DelayMS 3000
'------------------------Eepromdan OKu--------------------------

bas:
High LED
Print At 1,1, " FM TRANSMITTER "
Print At 2,1, "  Test RDVV  "
DelayMS 33000
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, " FRE SET ", Dec FREKANS_Tam, ",", Dec FREKANS_Onda,"  " 'LCD Yaz
Print  At 2,1, " RDVV 8Watt PLL " 'LCD Yaz
DelayMS 8550 '28
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, adres ,[HI,LO,$8e,$10]
'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 > 2160 Then FREKANS_step=1750 '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 < 1750 Then FREKANS_step=2160 '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 5350 '50
'----------------------- Tsa5511 e yaz--------------------------
TsaYaz:
FREKANS_Onda = (FREKANS_step*10/2)//100
FREKANS_Tam =  (FREKANS_step*10/2)/100
Print  At 1,1, " UnLock ", Dec FREKANS_Tam, ",", Dec FREKANS_Onda, "  " 'lcd yaz
Print  At 2,1, " RDVV 8Watt PLL " 'LCD Yaz
FREKANS = FREKANS_step

'i2cwrite SDA , SCL, adres ,[HI,LO,$8e,$00]
'I2CWRITE SDA,SCL,$C2, [HI,LO,$8E,$00]

DelayMS 5350 '150

'----------------------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, adres ,[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
Print  At 1,1, "   Lock ", Dec FREKANS_Tam, ",", Dec FREKANS_Onda, "  " 'lcd Yaz
Print  At 2,1, " RDVV 8Watt PLL " 'LCD Yaz
K_buton:
DelayMS 150'20
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
 

And here are the main problem :

'Declare I2C_SCLOUT On
'i2cwrite SDA , SCL, adres ,[HI,LO,$8e,$10]
'I2CWRITE SDA,SCL,$C2, [HI,LO,$8E,$10]
'i2cwrite SDA , SCL, adres ,[HI,LO,$8e,$00]
'I2CWRITE SDA,SCL,$C2, [HI,LO,$8E,$00]
'i2cwrite sda , scl, adres ,[hi,lo,$8e,$24]
'I2CWRITE SDA,SCL,$C2, [HI,LO,$8E,$24]

If those code inactivated then I2C connection doesn't produce to send register to prescaller and doesn't control the frequency.

Cheer,
 Cry
Galee.



We need more informations. what is the error produced ? what is the chip used in transmitter ? what version of proton you have ?
Logged
galee
Newbie
*
Offline Offline

Posts: 11

Thank You
-Given: 0
-Receive: 0


« Reply #6 on: April 18, 2020, 05:46:50 17:46 »

AhmadK,
That the error produced are :
Code:
  'Declare I2C_SCLOUT On
'i2cwrite SDA , SCL, adres ,[HI,LO,$8e,$10]
'I2CWRITE SDA,SCL,$C2, [HI,LO,$8E,$10]
'i2cwrite SDA , SCL, adres ,[HI,LO,$8e,$00]
'I2CWRITE SDA,SCL,$C2, [HI,LO,$8E,$00]
'i2cwrite sda , scl, adres ,[hi,lo,$8e,$24]
'I2CWRITE SDA,SCL,$C2, [HI,LO,$8E,$24]

My processor is PIC16F628A.
My Proton Basic Compiler are :
  Proton IDE, Version 2.0.3.3
  Loader Version 3.5.2.7
  Compiler Version 3.7.3.7

That above version I used to compiled to previous code.

Galee.
Logged
Ahmad_k
SCG Moderator
Hero Member
*****
Offline Offline

Posts: 747

Thank You
-Given: 169
-Receive: 1288



« Reply #7 on: April 18, 2020, 06:11:46 18:11 »

AhmadK,
That the error produced are :
Code:
  'Declare I2C_SCLOUT On
'i2cwrite SDA , SCL, adres ,[HI,LO,$8e,$10]
'I2CWRITE SDA,SCL,$C2, [HI,LO,$8E,$10]
'i2cwrite SDA , SCL, adres ,[HI,LO,$8e,$00]
'I2CWRITE SDA,SCL,$C2, [HI,LO,$8E,$00]
'i2cwrite sda , scl, adres ,[hi,lo,$8e,$24]
'I2CWRITE SDA,SCL,$C2, [HI,LO,$8E,$24]

My processor is PIC16F628A.
My Proton Basic Compiler are :
  Proton IDE, Version 2.0.3.3
  Loader Version 3.5.2.7
  Compiler Version 3.7.3.7

That above version I used to compiled to previous code.

Galee.

Show me the output error produced by proton ide and not the code

Posted on: April 18, 2020, 06:00:20 18:00 - Automerged

As i remember, there is no I2CWRITE in proton, it is an internal command and you cannot use it.

You should use I2CIN and I2COUT, or if you are more familiar with I2C you can use BUSOUT and BUSIN
Logged
galee
Newbie
*
Offline Offline

Posts: 11

Thank You
-Given: 0
-Receive: 0


« Reply #8 on: April 18, 2020, 07:38:20 19:38 »

AhmadK,
I am not really familiar with those, hope you can give me a sample for those, without that I2C not include then i can't put register or control TSA5511 as a prescaller for charge pump and lock, something like these :
&H8E = binary 10001110

Charge-pump
and test bits
1 CP T1 T0 1 1 1 OS
1 0 0 0 1 1 1 0 (&H8E)

CP charge-pump current
CP = 0 50 µA
CP = 1 220 µA
P3 to P0 = 1 limited-current output is active
P7 to P4 = 1 open-collector output is active
P7 to P0 = 0 outputs are in high impedance state
T1, T0, OS = 0 0 0 normal operation
T1 = 1 P6 = fref, P7 = fDIV
T0 = 1 3-state charge-pump
OS =1 operational ampli?er output is switched off (varicap drive disable)

Hope you can help me to how to adding that on write.

As well as your asking me for an error, please seen my attachment pictures below.


Galee
Logged
Ahmad_k
SCG Moderator
Hero Member
*****
Offline Offline

Posts: 747

Thank You
-Given: 169
-Receive: 1288



« Reply #9 on: April 19, 2020, 06:30:02 06:30 »

As i said you cannot use I2CWRITE use I2COUT instead, read the manual. Almost same syntax as I2CWRITE
Logged
galee
Newbie
*
Offline Offline

Posts: 11

Thank You
-Given: 0
-Receive: 0


« Reply #10 on: April 19, 2020, 07:30:02 07:30 »

AhmadK,
I know that you mean on previous explanation, but as my previous i can't visit they website to see the manual.
I trying to shutdown my Kaspersky Internet Security then I download the manual, i see that my version compiler is higher then the code, so i think I need to use something like these, please correction me if I did wrong, AhmadK.
Code:
   
Declare I2C_SCLOUT On => How about this declaration to changes, something like this I2COut On
'i2cwrite SDA , SCL, adres ,[HI,LO,$8e,$10] -> changes to I2Cin SDA , SCL, adres ,[HI,LO,$8e,$10]


What is correct this code
Code:

I2Cin SDA,SCL,$C2, [HI,LO,$8E,$10]

Or

Code:
I2Cin SDA , SCL, adres ,[HI,LO,$8e,$10]

What is difference both $C2 and adres, please let me know.

Galee

Logged
galee
Newbie
*
Offline Offline

Posts: 11

Thank You
-Given: 0
-Receive: 0


« Reply #11 on: April 19, 2020, 08:50:57 08:50 »

AhmadK,
I trying to compiled, these :

Not work,
Code:
I2CIn SDA , SCL, adres ,[HI,LO,$8e,$00]

Work,
Code:
I2CIn SDA,SCL,$C2, [HI,LO,$8E,$00]
Can you please explain me refer to reading TSA5511.


What is substitute for this,
Code:
I2CREAD
I used this, i get an error.


Galee
Logged
Ahmad_k
SCG Moderator
Hero Member
*****
Offline Offline

Posts: 747

Thank You
-Given: 169
-Receive: 1288



« Reply #12 on: April 19, 2020, 09:02:18 09:02 »


What is correct this code
Code:

I2Cin SDA,SCL,$C2, [HI,LO,$8E,$10]

Or

Code:
I2Cin SDA , SCL, adres ,[HI,LO,$8e,$10]

What is difference both $C2 and adres, please let me know.

Galee


Seriously !!! if you don't know what is a VIARIABLE and what $ means then you should not touch any programing language. Open the manual and start learning from the begining, i cannot help you anymore.
Logged
pickit2
Moderator
Hero Member
*****
Offline Offline

Posts: 4647

Thank You
-Given: 826
-Receive: 4207


There is no evidence that I muted SoNsIvRi


« Reply #13 on: April 19, 2020, 09:43:50 09:43 »

Ahmad_k nailed it early on

Error was displayed, as shown below.

PDS has a good help key too.
Logged

Note: I stoped Muteing bad members OK I now put thier account in sleep mode
galee
Newbie
*
Offline Offline

Posts: 11

Thank You
-Given: 0
-Receive: 0


« Reply #14 on: April 19, 2020, 01:23:05 13:23 »

AhmadK,
I know that.
But for TSA5511 i not very able to read that function, so why i submit that problem here for discuss topic.
Many people just tell like this then this, but no guidance right way, no showing how to do, if I know it, i am not here.
Why forum they create, it mean to help someone.

Time go sleep, i close this session.

Galee
Logged
titi
Active Member
***
Offline Offline

Posts: 229

Thank You
-Given: 3696
-Receive: 834



« Reply #15 on: April 19, 2020, 02:43:54 14:43 »

Galee,

this code is compilling well with Proton Basic, it is a bit different of yours but seams very close, I hope this is what you are seaching for ?

Best regard.
Logged
galee
Newbie
*
Offline Offline

Posts: 11

Thank You
-Given: 0
-Receive: 0


« Reply #16 on: April 19, 2020, 04:12:15 16:12 »

Titi,
I compiled your test code, i got an error, then I try to a bit change refer to the other codes, after change then the code can compiled full without any error, could you please correction.
Code:
'************************************************* ***************
'* Author : [Hüseyin GÜNER - ViProje] *
'* Notice : Copyright (c) 2010 *
'* Date : 06.05.2010 *
'* Version : 2.0 *
'* Version : 2.01 traduccion del turco by RicBevi 25/10/14*
'************************************************* ***************
Device = 16F628A 'PIC usado
Config INTRC_OSC_CLKOUT, MCLRE_OFF, LVP_OFF, WDT_OFF, PWRTE_OFF, CP_OFF, BODEN_OFF
Declare Bus_SCL On
'---------------------------LCD--------------------------------
'Symbol LCD_DTPin = PORTB.0
'Symbol LCD_RSPin = PORTB.4
'Symbol LCD_ENPin = PORTA.3
'Symbol LCD_Interface = 4 ' 4-bit Interface
'Symbol LCD_Lines = 2
'Symbol LCD_Type = 0

    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
    Declare LCD_CommandUs = 2000
    Declare LCD_DataUs = 50

CMCON = 7
'---------------------------Variables----------------------------
Dim Frecuencia_step As Word 'Variable paso de frecuencia
Dim Frecuencia_Entera As Word ' Variable Frecuencia parte entera
Dim Frecuencia_Decimal As Word ' Variable Frecuencia parte decimal
Dim Frecuencia As Word ' Variable Frecuencia
Dim F_CONTROL As Word 'Variable CONTROL definida

Dim LO As Frecuencia.LowByte 'parte baja Frecuencia
Dim HI As Frecuencia.HighByte 'parte alta Frecuencia

'--------------------------Puertos------------------------------
Symbol SDA = PORTA.1 'I2C pin SDA
Symbol SCL = PORTA.0 'I2C pin SCL
Symbol LED = PORTA.2 'LED en PORTA.2

PORTA=0 : PORTB=0 ' limpia PORTA  PORTB

'------------------------Lectura EEProm--------------------------


        High LED
        Print At 1,1, " FM TRANSMITTER "
        Print At 2,1, " Rdvv ViProje "
        DelayMS 300
        Frecuencia_step = ERead 02 'Frecuencia de inicio
        If Frecuencia_step > 0 Then ComPLL



'---------------------- Frecuencia-------------------------
Frecuencia_set:
                Frecuencia_Decimal = (Frecuencia_step*10/2)//100
                Frecuencia_Entera = (Frecuencia_step*10/2)/100
                Print At 1,1, " FRE SET ", Dec Frecuencia_Entera, ",", Dec Frecuencia_Decimal," "
                Print At 2,1, " RDVV 8Watt PLL "
                DelayMS 28
                If PORTB.5 = 1 Then Subir_Frecuencia  'Subir
                If PORTB.7 = 1 Then Bajar_Frecuencia  'Bajar Frecuencia
                If PORTB.6 = 1 Then Guarda_Frecuencia 'Guardar frecuencia


'-----------------------manda hacia el Tsa5511--------------------------

                Frecuencia = Frecuencia_step
                I2COut SDA,SCL,$C2, [HI,LO,$8E,$10]
                GoTo Frecuencia_set

Subir_Frecuencia:
                    Frecuencia_step = Frecuencia_step + 1 ' Incrementa
                    If Frecuencia_step > 2160 Then Frecuencia_step=1750 'Si llega a 10800 entonces cambia a 8750
                    GoTo Frecuencia_set

Bajar_Frecuencia:
                    Frecuencia_step = Frecuencia_step-1 ' Decrementa
                    If Frecuencia_step < 1750 Then Frecuencia_step=2160 'Si llega a 8750 entonces cambia a 10800
                    GoTo Frecuencia_set


Guarda_Frecuencia: '--------------------------Escribe Datos Eprom---------------------------
                    EWrite 02 ,[Frecuencia_step] 'Guarda el Paso en la EEprom
                    DelayMS 50


ComPLL: '----------------------- Escribe en el Tsa5511 --------------------------
        Frecuencia_Decimal = (Frecuencia_step*10/2)//100
        Frecuencia_Entera = (Frecuencia_step*10/2)/100
        Print At 1,1, " UnLock ", Dec Frecuencia_Entera, ",", Dec Frecuencia_Decimal, " "
        Print At 2,1, " RDVV 8Watt PLL "
        Frecuencia = Frecuencia_step
        I2COut SDA,SCL,$C2, [HI,LO,$8E,$00]
        DelayMS 150

'----------------------Verifica estatus Tsa5511i ----------------------
        If PORTB.6 = 1 Then Frecuencia_set 'Si esta pulsado PORTB.6 va al principio
        'I2CREAD SDA,SCL,$C2,[F_CONTROL]
         I2CIn SDA,SCL,$C2,[F_CONTROL]
        If F_CONTROL.6 = 1 Then Bloqueo ' Si el bit 6 de F_CONTROL esta a 1 entonces el PLL esta enganchado LOCK
        GoTo ComPLL

Bloqueo:
        I2COut SDA,SCL,$C2, [HI,LO,$8E,$24]
        Frecuencia_Decimal = (Frecuencia_step*10/2)//100
        Frecuencia_Entera = (Frecuencia_step*10/2)/100
        Print At 1,1, " Lock ", Dec Frecuencia_Entera, ",", Dec Frecuencia_Decimal, " "
        Print At 2,1, " RDVV 8Watt PLL "


K_buton:
        DelayMS 20
        If PORTB.5= 1 Then LCD_Led_Off ' Si se pulsa Subir apaga el led
        If PORTB.7=1 Then LCD_Led_On  ' Si se pulsa Bajar prende el led
        If PORTB.6=1 Then Frecuencia_set ' Si se pulsa Guardar va al comienzo
        GoTo K_buton

LCD_Led_On:
            High LED
            GoTo K_buton

LCD_Led_Off:
            Low LED
            GoTo K_buton

End

Here are the error :
Code:
'Symbol LCD_DTPin = PORTB.0
'Symbol LCD_RSPin = PORTB.4
'Symbol LCD_ENPin = PORTA.3
'Symbol LCD_Interface = 4 ' 4-bit Interface
'Symbol LCD_Lines = 2
'Symbol LCD_Type = 0

And this :
----- Verifica estatus Tsa5511i-----

Code:
'I2CREAD SDA,SCL,$C2,[F_CONTROL]

Once those is changes then working on compiled.

Galee
Logged
pickit2
Moderator
Hero Member
*****
Offline Offline

Posts: 4647

Thank You
-Given: 826
-Receive: 4207


There is no evidence that I muted SoNsIvRi


« Reply #17 on: April 19, 2020, 04:29:24 16:29 »

Titi,
I compiled your test code, i got an error, then I try to a bit change refer to the other codes, after change then the code can compiled full without any error, could you please correction.
Code:
'************************************************* ***************
'* Author : [Hüseyin GÜNER - ViProje] *
'* Notice : Copyright (c) 2010 *
'* Date : 06.05.2010 *
'* Version : 2.0 *
'* Version : 2.01 traduccion del turco by RicBevi 25/10/14*
'************************************************* ***************
Device = 16F628A 'PIC usado
Config INTRC_OSC_CLKOUT, MCLRE_OFF, LVP_OFF, WDT_OFF, PWRTE_OFF, CP_OFF, BODEN_OFF
Declare Bus_SCL On
'---------------------------LCD--------------------------------
'Symbol LCD_DTPin = PORTB.0
'Symbol LCD_RSPin = PORTB.4
'Symbol LCD_ENPin = PORTA.3
'Symbol LCD_Interface = 4 ' 4-bit Interface
'Symbol LCD_Lines = 2
'Symbol LCD_Type = 0

    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
    Declare LCD_CommandUs = 2000
    Declare LCD_DataUs = 50

CMCON = 7
'---------------------------Variables----------------------------
Dim Frecuencia_step As Word 'Variable paso de frecuencia
Dim Frecuencia_Entera As Word ' Variable Frecuencia parte entera
Dim Frecuencia_Decimal As Word ' Variable Frecuencia parte decimal
Dim Frecuencia As Word ' Variable Frecuencia
Dim F_CONTROL As Word 'Variable CONTROL definida

Dim LO As Frecuencia.LowByte 'parte baja Frecuencia
Dim HI As Frecuencia.HighByte 'parte alta Frecuencia

'--------------------------Puertos------------------------------
Symbol SDA = PORTA.1 'I2C pin SDA
Symbol SCL = PORTA.0 'I2C pin SCL
Symbol LED = PORTA.2 'LED en PORTA.2

PORTA=0 : PORTB=0 ' limpia PORTA  PORTB

'------------------------Lectura EEProm--------------------------


        High LED
        Print At 1,1, " FM TRANSMITTER "
        Print At 2,1, " Rdvv ViProje "
        DelayMS 300
        Frecuencia_step = ERead 02 'Frecuencia de inicio
        If Frecuencia_step > 0 Then ComPLL



'---------------------- Frecuencia-------------------------
Frecuencia_set:
                Frecuencia_Decimal = (Frecuencia_step*10/2)//100
                Frecuencia_Entera = (Frecuencia_step*10/2)/100
                Print At 1,1, " FRE SET ", Dec Frecuencia_Entera, ",", Dec Frecuencia_Decimal," "
                Print At 2,1, " RDVV 8Watt PLL "
                DelayMS 28
                If PORTB.5 = 1 Then Subir_Frecuencia  'Subir
                If PORTB.7 = 1 Then Bajar_Frecuencia  'Bajar Frecuencia
                If PORTB.6 = 1 Then Guarda_Frecuencia 'Guardar frecuencia


'-----------------------manda hacia el Tsa5511--------------------------

                Frecuencia = Frecuencia_step
                I2COut SDA,SCL,$C2, [HI,LO,$8E,$10]
                GoTo Frecuencia_set

Subir_Frecuencia:
                    Frecuencia_step = Frecuencia_step + 1 ' Incrementa
                    If Frecuencia_step > 2160 Then Frecuencia_step=1750 'Si llega a 10800 entonces cambia a 8750
                    GoTo Frecuencia_set

Bajar_Frecuencia:
                    Frecuencia_step = Frecuencia_step-1 ' Decrementa
                    If Frecuencia_step < 1750 Then Frecuencia_step=2160 'Si llega a 8750 entonces cambia a 10800
                    GoTo Frecuencia_set


Guarda_Frecuencia: '--------------------------Escribe Datos Eprom---------------------------
                    EWrite 02 ,[Frecuencia_step] 'Guarda el Paso en la EEprom
                    DelayMS 50


ComPLL: '----------------------- Escribe en el Tsa5511 --------------------------
        Frecuencia_Decimal = (Frecuencia_step*10/2)//100
        Frecuencia_Entera = (Frecuencia_step*10/2)/100
        Print At 1,1, " UnLock ", Dec Frecuencia_Entera, ",", Dec Frecuencia_Decimal, " "
        Print At 2,1, " RDVV 8Watt PLL "
        Frecuencia = Frecuencia_step
        I2COut SDA,SCL,$C2, [HI,LO,$8E,$00]
        DelayMS 150

'----------------------Verifica estatus Tsa5511i ----------------------
        If PORTB.6 = 1 Then Frecuencia_set 'Si esta pulsado PORTB.6 va al principio
        'I2CREAD SDA,SCL,$C2,[F_CONTROL]
         I2CIn SDA,SCL,$C2,[F_CONTROL]
        If F_CONTROL.6 = 1 Then Bloqueo ' Si el bit 6 de F_CONTROL esta a 1 entonces el PLL esta enganchado LOCK
        GoTo ComPLL

Bloqueo:
        I2COut SDA,SCL,$C2, [HI,LO,$8E,$24]
        Frecuencia_Decimal = (Frecuencia_step*10/2)//100
        Frecuencia_Entera = (Frecuencia_step*10/2)/100
        Print At 1,1, " Lock ", Dec Frecuencia_Entera, ",", Dec Frecuencia_Decimal, " "
        Print At 2,1, " RDVV 8Watt PLL "


K_buton:
        DelayMS 20
        If PORTB.5= 1 Then LCD_Led_Off ' Si se pulsa Subir apaga el led
        If PORTB.7=1 Then LCD_Led_On  ' Si se pulsa Bajar prende el led
        If PORTB.6=1 Then Frecuencia_set ' Si se pulsa Guardar va al comienzo
        GoTo K_buton

LCD_Led_On:
            High LED
            GoTo K_buton

LCD_Led_Off:
            Low LED
            GoTo K_buton

End

Here are the error :
Code:
'Symbol LCD_DTPin = PORTB.0
'Symbol LCD_RSPin = PORTB.4
'Symbol LCD_ENPin = PORTA.3
'Symbol LCD_Interface = 4 ' 4-bit Interface
'Symbol LCD_Lines = 2
'Symbol LCD_Type = 0

And this :
----- Verifica estatus Tsa5511i-----

Code:
'I2CREAD SDA,SCL,$C2,[F_CONTROL]

Once those is changes then working on compiled.

Galee

If titi said the code complied = then the problem is at your end.
and yes we do try to help, but the person who is asking should also read the reply.
Logged

Note: I stoped Muteing bad members OK I now put thier account in sleep mode
Ahmad_k
SCG Moderator
Hero Member
*****
Offline Offline

Posts: 747

Thank You
-Given: 169
-Receive: 1288



« Reply #18 on: April 19, 2020, 06:03:02 18:03 »

Titi,
I compiled your test code, i got an error, then I try to a bit change refer to the other codes, after change then the code can compiled full without any error, could you please correction.


Code compiled without any problem. As Pickit2 said, the problem is at your end.
Logged
pickit2
Moderator
Hero Member
*****
Offline Offline

Posts: 4647

Thank You
-Given: 826
-Receive: 4207


There is no evidence that I muted SoNsIvRi


« Reply #19 on: April 19, 2020, 07:36:05 19:36 »

Just booted up my laptop with Proton installed.
Did you even try the Built in Help?

There are 547 pages.

but you want baby feeding.
Logged

Note: I stoped Muteing bad members OK I now put thier account in sleep mode
titi
Active Member
***
Offline Offline

Posts: 229

Thank You
-Given: 3696
-Receive: 834



« Reply #20 on: April 19, 2020, 09:27:33 21:27 »

Galee,

I just compiled your code and I have no errors at all.

I used this version "Proton Basic v3.5.9.3 of Proton and version 1.0.3.8 of Proton24" to compile the code.

So, may be your Proton Basic is not working well.

Try the version I use or reinstall yours.

Best regards.
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC