Quantcast
Channel: MCS Electronics Forum
Viewing all articles
Browse latest Browse all 20636

BASCOM-AVR : TSA5511 PLL High and Low Byte calculation : REPLY

$
0
0
Hi pd5dj 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 cant remember if I used 4Mhz or 3.2Mhz for this [code:1:ead83ca346]'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 = 1 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[/code:1:ead83ca346]

Viewing all articles
Browse latest Browse all 20636


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>