PDA

View Full Version : Jump and return



savnik
- 14th July 2006, 13:09
I want to change following code:

MAIN:

PLL = PLLBASE + TMP

RXPLL=PLL + 622 '38.9 MHZ

If PLL=>2804 and PLL<=3588 then band=$50 'Mid range = 175,25 -> 224,25 MHz.
If PLL=>7540 and PLL<=13796 then band=$30 'High range = 471,25 -> 862,250 MHz.

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



GoSub CALCUL 'calculate the frequency for posting
GoSub AFFICHAGE 'post the frequency
PAUSE 200

'*** PRINCIPAL LOOP ***

BOUCLE:

Button UP,1,10,2,b1,1,MONTE 'supervise(εποπτεύστε) the button UP
Button DOWN,1,10,2,b2,1,DESCEND 'supervise the button DOWN
Button CH_PAS,1,255,0,b3,1,CHOIX
PAUSE 100 'pause of 0.1s
I2CREAD SDA,SCL,ADDR2,[LOCK] 'check if pll is lock
GoSub AFFICHAGE
WRITE 0, TMP_LO 'Store the 8 bits of weak weight of TMP in the EEPROM with address 0
WRITE 1, TMP_HI 'Store the 8 bits of strong weight of TMP in the EEPROM with address 1
GoTo BOUCLE

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

TMP = TMP + PAS
If TMP > 784 Then TMP = 0 'Fmax = 224,25 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=784
GoTo MAIN

RAZ_TMP:

TMP = 0
GoTo MAIN

I want when it measures up to the 3588 it jumps to 7540 and it continues it measures and when it reaches to 13796 it goes again to the beginning, that is to say in 3588