PIC16F877 za TSA5511 PLL i SSA5055

Rasprava o PIC mikrokontrolerima, PIC projekti i drugo vezano za PIC-eve...

Moderators: pedja089, stojke369, [eDo], trax

Post Reply
Marin (Kemija)
Posts: 8
Joined: 04-08-2007, 09:06

PIC16F877 za TSA5511 PLL i SSA5055

Post by Marin (Kemija) »

Ok, ovako....imam kod koji dotjerivam ali ima i problemčić ;-))

Sve radi i vrti od 87-108MHz na LCD-u....ali problem je u tome što ide ovako....recimo za primjer 100MHz...i kad stisnem UP ide 100,1 100,2 100,3 100,4 100,5 100,6 100,7 108,0...znači direktno skoči na iduču na 0,7...falu koraci 100,8 100,9....neznam zašto...evo koda pa ako tko zna da nabaci koji komentar bilo bi super....inače kod je rađen u picbasic pro...



DEFINE LCD_DREG PORTD
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTD
DEFINE LCD_RSBIT 1
DEFINE LCD_EREG PORTD
DEFINE LCD_EBIT 0
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50



DEFINE I2C_SCLOUT 1 'Set serial clock to bipolar instead of open-collector




' definition I2C communication
SCL var PORTB.1 ' SCL on RB1
SDA var PORTB.0 ' SDA on RB0

'press:
MEMO var PORTB.3 '
UP var PORTB.4 ' press for FREQ UP RB.4
DOWN var PORTB.5 ' press for FREQ DOWN RB.5



INPUT UP 'Up et Down sont des entrées
INPUT DOWN
INPUT MEMO





'Fmin =88 MHz, F max= 108 MHz
' ** DECLARATION OF THE VARIABLES

b1 var BYTE
b2 var BYTE
b3 var BYTE
b5 var BYTE

F1 var WORD
F2 var WORD
F3 var WORD


ADDR1 VAR BYTE
TMP VAR WORD
TMP_LO VAR TMP.LOWBYTE
TMP_HI VAR TMP.HIGHBYTE
PLLBASE VAR WORD
PLL VAR WORD
LO VAR PLL.LOWBYTE
HI VAR PLL.HIGHBYTE
PAS VAR BYTE '1=125kHz, 2=250kHz, 4=500kHz, 8=1MHz

'*** INITIAL DATA ***

ADDR1=$C2 'adress I2C of SDA5055 (ADDR1=$C0 , adress I2C of TSA5511)
PLLBASE=696 'beginning with 87 MHz : 87 / 0,125 = 696
PAS = 1 'step of 0.125 MHZ by default ?????
PAUSE 100
LCDOUT $FE, 1 ' Clear LCD screen
LCDOUT " PLL FM 88-108" ' post text during 1 second
LCDOUT $FE,$C0
LCDOUT " BT-20"
PAUSE 1000

EEPROM 0,[$90,$01] 'initial data TMP = PLLBASE corresponds to F = 88 MHz


'The starting point is 88 MHz given by PLLBASE. One adds a shift of 125kHz * TMP
'TMP is on 16 bits, therefore 65535 possible frequencies.
'
'*** READING OF THE DECALAGE TMP ***

READ 0,TMP_LO 'reads the 8 bits of weak weight
READ 1,TMP_HI 'reads the 8 bits of strong weight


' *** BEGINNING OF THE PROGRAM***

MAIN:
PLL = PLLBASE + TMP

I2CWRITE SDA,SCL,ADDR1,[HI,LO,$8E] 'Sending of the data to the module

GOSUB CALCUL 'calculate the frequency for posting
GOSUB AFFICHAGE 'post the frequency
PAUSE 500


'*** press routine ***

BOUCLE:
BUTTON UP,0,10,2,b1,1,MONTE 'supervise the button UP
BUTTON DOWN,0,10,2,b2,1,DESCEND 'supervise the button DOWN
BUTTON MEMO,0,255,0,b5,1,STORE 'supervise the button MEMO
' only step size of 125KHz is handled
' BUTTON CH_PAS,1,255,0,b3,1, CHOIX 'supervise the button PAS
PAUSE 100 'pauses of 0.1s
GOTO BOUCLE


MONTE: '** INCREASE THE FREQUENCY OF 1 PAS (STEP)

TMP = TMP + PAS
IF TMP > 168 THEN TMP = 0 'Fmax = 108 MHz ---> (Fmax - Fmin) / 0,125 -> (108-87)/0,125 = 168
GOTO MAIN

DESCEND: '** DECREASE THE FREQUENCY OF 1 PAS (STEP)

IF TMP = 0 THEN TOP
TMP = TMP - PAS
GOTO MAIN

TOP: TMP=168 ' max reading in Tmp
GOTO MAIN

RAZ_TMP: TMP = 0
GOTO MAIN

CHOIX: '** CHOICE OF THE PAS (STEP)

IF PAS = 8 THEN SAUTE
PAS = PAS*2

GOSUB AFFICHAGE 'post the frequency
GOTO BOUCLE

SAUTE: PAS = 1

GOTO BOUCLE

CALCUL: ' ** CALCULATION OF THE FREQUENCY

F1 = PLL 'cut off 1GHz
F2 = F1/8 'give them MHz
F3 = 100*(F1//8)

RETURN

AFFICHAGE:
LCDOUT $FE, 1 'Clear LCD screen
'LCDOUT #1 'post the 1 of Giga we don't need this because we only have 100 of MHz!!!
LCDOUT #F2 'post the other digits
LCDOUT "." 'post the comma
LCDOUT #F3 'post the Khz
LCDOUT " MHz "

STORE:
WRITE 0, TMP_LO
WRITE 1, TMP_HI
GOTO BOUCLE
User avatar
phoenix
Posts: 10
Joined: 25-08-2007, 10:00
Contact:

Post by phoenix »

Pozdrav ,
Mislim da pokusavas da napravis difuzni predajnik (sobzirom na frekvenciju) PLL-a.
Ja sam radio mnogo sa tim PLL-om i mnogim drugim...

Evo malecka pomoc:

Izvod P6 na PLL-u = ( fREF/512 )

Izvod P7 na PLL-u = ( fVCO/8 )

STEP=(fREF/R)*P

fVCO=N*STEP


PRIMER:

STEP = 50 khz
STEP = (3200 khz/512)*8 "u khz"
fVCO = N*P*(fREF/R)=N*STEP=25600(delitelj)*0.025=1280 Mhz


"OBRATI PAZNJU PRI PROJEKTOVANJU DA TI DELITELJ NE IZADJE IZ DOZVOLJENIH GRANICA)"

Potrudi se malo sam jer nije dobro koristiti gotova resenja.

Primer koji sam ti naveo je za TV link na 1.2 Ghz
Poslao sam ti Email i nadam se da ti je primer posluzio da malo bolje shvatis kako da napravis to sto zelis.U primeru koji si dobio Email-om je sve za frekvencije za 2m band - radioamatersko podrucije (144-146 Mhz).

Ja sam davno napustio te PLL-love i sad radim sa DDS-ovima i DSP-ovima.

Puno srece u daljnjem radu.
PHOENIX
rigmo
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 212
Joined: 02-10-2017, 21:17

Re: PIC16F877 za TSA5511 PLL i SSA5055

Post by rigmo »

molim imam problem kako se moze rijesiti
TSA5511 sa PIC16F628A kristal 4mhz
zelim postici vecu tocnost ako je moguce. odaberem frekvenciju 144.9000 a meni daje na frekveciometrimai provjereno na spectrumu 144.891666mhz

Hvala unaprijed
rigmo
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 212
Joined: 02-10-2017, 21:17

Re: PIC16F877 za TSA5511 PLL i SSA5055

Post by rigmo »

Marin (Kemija) wrote: 06-09-2007, 10:50 Ok, ovako....imam kod koji dotjerivam ali ima i problemčić ;-))

Sve radi i vrti od 87-108MHz na LCD-u....ali problem je u tome što ide ovako....recimo za primjer 100MHz...i kad stisnem UP ide 100,1 100,2 100,3 100,4 100,5 100,6 100,7 108,0...znači direktno skoči na iduču na 0,7...falu koraci 100,8 100,9....neznam zašto...evo koda pa ako tko zna da nabaci koji komentar bilo bi super....inače kod je rađen u picbasic pro...
jer koristis 4mhz a trebas 3.2 kristal na tsa5511
rigmo
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 212
Joined: 02-10-2017, 21:17

Re: PIC16F877 za TSA5511 PLL i SSA5055

Post by rigmo »

Da li se tko razumije u asm file i kao ga editirati za pic16F628?
User avatar
trax
Administrator sajta
Administrator sajta
Posts: 3509
Joined: 08-01-2005, 18:04
Location: 75k, BA
Contact:

Re: PIC16F877 za TSA5511 PLL i SSA5055

Post by trax »

Nesto mi pade na pamet, probaj da uploadujes fajl na ChatGPT ili Gemini, pa pitaj da ti ga preradi za drugi PIC :-)
Post Reply