Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Ghange code picbasic

Status
Not open for further replies.

savnik

Member
I have the below code and it's work
I want to change to work for FM 88-108MHZ
How i can change it;

'Fmin =1200 MHz, F max= 1650 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=9600 'beginning with 1200 MHz : 1200 / 0,125 = 9600
PAS = 1 'pas of 0.125 MHZ by defect
PAUSE 100
LCDOUT $FE, 1 ' Clear LCD screen
LCDOUT " PLL FM 88-108" ' post text during 1 second
LCDOUT $FE,$C0
LCDOUT " NIKOS"
PAUSE 1000

EEPROM 0,[$90,$01] 'initial data TMP = 400 ($190) corresponds to F = 1250 MHz





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

TMP = TMP + PAS
IF TMP > 3600 THEN TMP = 0 'Fmax = 1600 MHz
GOTO MAIN

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

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

TOP: TMP=3600
GOTO MAIN

RAZ_TMP: TMP = 0
GOTO MAIN

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

IF PAS = 8 THEN SAUTE
PAS = PAS*2
GOSUB AFFICHE_PAS
GOSUB AFFICHAGE 'post the frequency
GOTO BOUCLE

SAUTE: PAS = 1
GOSUB AFFICHE_PAS
GOTO BOUCLE

CALCUL: ' ** CALCULATION OF THE FREQUENCY

F1= PLL-800 'cut off 1GHz
F2=F1/8 'give them MHz
F3=125*(F1//8) 'give them kHz
RETURN

AFFICHAGE:
LCDOUT $FE, 1 'Clear LCD screen
LCDOUT #1 'post the 1 of Giga
LCDOUT #F2 'post the other digits
LCDOUT "." 'post the comma
LCDOUT #F3 'post the Khz
LCDOUT " MHz "
 
Last edited:
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top