Thanks.

What is the best method ?

i have another problem with program for conversion.
Hello,
i made this to programm ADC

bmf_comm1 VAR PORTB.0
bmf_comm2 VAR PORTB.1
'Variables
bmfsD VAR WORD
bmfs1D VAR WORD
iled var byte
blink1 var byte 'pour clignotement 1ère led
blink2 var byte 'pour clignotement 2ème led
'configuration du port pour lire l'entrée analogique
TRISA = %00000011 ' RA0 et RA1 en entrée
TRISB = %11111100 ' RB0 et RB1 en sortie
ADCON1 = $10000010 'RA0 à RA3

test_depart:
Low bmf_comm1
Low bmf_comm2
High bmf_comm1
high bmf_comm2
pause 2000
goto mainloop
'lecture de la valeur
getad:
PAUSEUS 50 ' Wait for A/D channel acquisition time
ADCON0.2 = 1 ' Start conversion
WHILE ADCON0.2 ' Wait for it to complete
WEND
Return

' Subroutine to get pot x value
getx:
ADCON0 = $41 ' Set A/D to Fosc/8, Channel 0, On
Gosub getad
bmfsD = ADRESL + (ADRESH*256)
Return

' Subroutine to get pot y value
gety:
ADCON0 = $49 ' Set A/D to Fosc/8, Channel 1, On
Gosub getad
bmfs1D = (ADRESH*256) + ADRESL
Return
val_leds:
low bmfs_comm1
low bmfs_comm2
gosub getx
gosub gety

if (bmfsD > 1000) Then Goto val_leds
if (bmfsD > 750) Then Goto boucle_led
if (bmfsD > 500) Then Goto boucle1_led
if (bmfsD > 250) Then Goto boucle2_led

High bmf_comm1
High bmf_comm2
pause 1500
goto val_leds
boucle_led:
iled = 0
while iled < 5
if iled = 1 or 3 or 5 then high blink1:low blink2
if iled = 0 or 2 or 4 then low blink1:high blink2
iled = iled + 1
pause 1000
wend
goto val_leds
boucle1_led:
High bmf_comm1
low bmf_comm2
pause 3000
goto val_leds
boucle2_led:
low bmf_comm1
high bmf_comm2
Goto val_leds
End

The leds works but always lightning , action on button (RB0 only for the moment) don't change anything.
No blinking ,no high , no low when i push different button
I don't know what .
thanks.