View previous topic :: View next topic |
Author |
Message |
pd5dj
Joined: 18 Dec 2008 Posts: 51 Location: Avenhorn
|
Posted: Mon Apr 27, 2015 6:49 pm Post subject: TSA5511 PLL High and Low Byte calculation |
|
|
Hi all
My issue:
1. Not knowing how to calculate the precise value to write to the TSA5511
2. Not know how to get the High and Low byte to send to the TSA5511.
1.
------------
I am using the TSA5511 PL ic that is controlled via i2c.
The PLL is used in a 23cm(1250mhz) oscillator..
the Crystal connected to the TSA5511 is 3.2Mhz.
For example I want to lock the PLL at 1240mhz.
(I have captured the data from an existing code that locks the PLL at 1240.. see attachment.)
If I look at the block diagram I see the following on page 4
(link to datasheet: http://www.pselectronic.cz/pdf/1124/11241425.pdf )
The RF signal, In my case is dived by 8.
1240/8 = 155mhz
My crystal is 3.2mhz
3200/512 = 6.25khz
What do I have to do further to get to get the correct value?
2.
-----------------------
After getting the correct value..
It must be splitted in 4 bytes..
I presume the value is a long.
So the long has to be splitted into 4 bytes..
In The bascom example I can only find the example to split a long into 2 words.
And an example of splitting a word into 2 bytes
( http://mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=10787&postdays=0&postorder=asc&highlight=tsa5511&start=0&sid=c7a8e09eb49d376d6dfc1f0e75c3ec6a )
I don quite understand how this works.
Hope someone can give my some advice how to look further.[/code]
(BASCOM-AVR version : 2.0.7.7 , Latest : 2.0.7.8 ) _________________ Gr. Björn, skype: bjorn_pd5dj |
|
Back to top |
|
|
EDC
Joined: 26 Mar 2014 Posts: 971
|
Posted: Mon Apr 27, 2015 9:55 pm Post subject: |
|
|
Hello When You type something for search in google then add magic word "bascom"
I found code and solution in "~ 7 730 matches (0,28 s)"
There is only 5 bytes to send .
First address, then two bytes Hi and Lo of Word value.
Two next bytes are almost constatnt. They are some settings for chip.
In attachment first code I found but there is many more..
Have a nice day |
|
Back to top |
|
|
kimmi
Joined: 24 Feb 2006 Posts: 1922 Location: Denmark
|
Posted: Tue Apr 28, 2015 12:41 am Post subject: |
|
|
Hi Björn
Here is my old code for pll U6205B SP5055 TSA5055/5011
simple setup via 3 buttons for freq easy to change in code for other use
I used 4Mhz 125khz
Code: | 'SP5055 TSA5055 / 5011 works OK Pll = Freq * 8 PLL lock ok
'U6205B work Pll = Freq * 16 PLL lock
'datasheet links
'SP5055 http://f5ad.free.fr/Docs_Composants/SP5055.pdf
'U6205B http://datasheets.weeqoo.com/U62/U6205B.pdf
'SDA SCL pullup 10K ohm +5V
$regfile = "ATtiny45.DAT"
$crystal = 4000000
$hwstack = 24
$swstack = 16
$framesize = 32
Config Portb.1 = Input
Config Portb.4 = Input
Config Portb.3 = Input
Portb.1 = 1
Portb.4 = 1
Portb.3 = 1
Config Sda = Portb.0
Config Scl = Portb.2
Dim K As Byte
Dim Snd_bytes As Byte
Dim Ax (4)as Byte
Dim A As Byte
Dim Pll As Word
Dim Pll_lsb As Byte
Dim Pll_msb As Byte
Dim Freq As Word
Dim Frq As Word
Dim Address_write As Byte , Charge_pump As Byte , Control_bit As Byte
Dim Sel_pll As Byte , Pll_lock As Byte
Address_write = &HC2
Const Address_read = &HC3
Charge_pump = &H8E
Control_bit = &H00
'Set start frq to 1250Mhz
Freq = 1250
A = 1
'sel_pll = 0 > U6205B
'sel_pll = 1 > SP5055
Sel_pll = 0
Do
'if we change frq via buttons go here (1250 - 1270 - 1280 - 1290 Mhz)
If A = 1 Then
A = 0
If Sel_pll = 0 Then Pll = Freq * 16 'U6205
If Sel_pll = 1 Then Pll = Freq * 8 'SP5055 TSA5055/5011
Pll_msb = High(pll )
Pll_lsb = Low(pll )
Ax (1) = Pll_msb
Ax (2) = Pll_lsb
Ax (3) = Charge_pump
'Ax(4) = Control_bit 'if ax(4) enable then Snd_bytes = 4 default is 00
Snd_bytes = 3
I2csend Address_write , Ax (1) , Snd_bytes
' If Sel_pll = 1 Then
' Waitms 100
' I2creceive Address_read , Pll_lock
' Waitms 100
' If Pll_lock = 1 Then
' Lcd "PLL locked"
' Else
' Lcd "PLL unlocked"
' End If
'End If
End If
If Pinb.1 = 0 Then
Freq = 1280 '1280 Mhz 1280/0.125
A = 1
Bitwait Pinb.1 , Set 'wait until key relase
End If
If Pinb.4 = 0 Then
Freq = 1270 '1270 Mhz
A = 1
Bitwait Pinb.4 , Set 'wait until key relase
End If
If Pinb.3 = 0 Then
Freq = 1290 '1290 Mhz
A = 1
Bitwait Pinb.3 , Set 'wait until key relase
End If
Waitms 100
Loop |
_________________ / Kim |
|
Back to top |
|
|
pd5dj
Joined: 18 Dec 2008 Posts: 51 Location: Avenhorn
|
Posted: Tue Apr 28, 2015 6:57 am Post subject: |
|
|
Hi Kimmi
Thanks for the usefull answer
And good to hear from you again,, (maybe 10 days too late, but happy birthday)
I tried to contact you via Skype, do you still use it?
About the code:
In the mean time I have figured out lots myself, and got a good working code last night..
In fact it looks a lot like your aproach.
Anyways thanks for example _________________ Gr. Björn, skype: bjorn_pd5dj |
|
Back to top |
|
|
|