PDA

View Full Version : Button



savnik
- 3rd July 2006, 00:19
a)how i can to go fast when push the button of below code:

Button UP,1,10,2,b1,1,MONTE ' button UP
Button DOWN,1,10,2,b2,1,DESCEND 'button DOWN

b)how i can to write this code which is for 50

F3=50*(F1//16) 'this work

to make for 62,5 , like this :

F3=62,5*(F1//16) 'this don't work

paul borgmeier
- 3rd July 2006, 04:37
a) not clear to me what you want??
b)

F3=62,5*(F1//16) 'this don't work
PBP supports integers only...
try
F3=125*(F1//16)/2
or
F3=(125*(F1//16))>>2

check your answers to make sure you can live with the roundoff (e.g., if F1=17 then F3 will be 62 not 62,5.)

Paul Borgmeier
Salt Lake City, Utah
USA

mister_e
- 3rd July 2006, 13:15
50? Msec, Microsecond? hours? Days? Is this the rate, the debounce or what? if so, as i remind of button 'cause i don't use it, you can tackle 'round some DEFINE.

savnik
- 3rd July 2006, 19:00
a) not clear to me what you want??
b)

PBP supports integers only...
try
F3=125*(F1//16)/2
or
F3=(125*(F1//16))>>2

check your answers to make sure you can live with the roundoff (e.g., if F1=17 then F3 will be 62 not 62,5.)

Paul Borgmeier
Salt Lake City, Utah
USA
i change the code:

' ** CALCULATION OF THE FREQUENCY

F1=PLL
F2=F1/16 'give them MHz
F3=125*(F1//16)/2 'give them kHz

and it's work.
Only have one problem . All frecuencies-step show corect(125,250,500,1000), but the 62,5 show only 62
i.e. for PLL FM ,62,5KHZ is the step.when i choose 62,5 show on LCD 62 ,while i choose 125,250,500,1000 show corect

mister_e
- 3rd July 2006, 19:04
multiply by 10 or get the remainder with R2 predefined variable
http://www.picbasic.co.uk/forum/showthread.php?t=48&highlight=remainder

savnik
- 3rd July 2006, 19:11
a)how i can to go fast when push the button of below code:

Button UP,1,10,2,b1,1,MONTE ' button UP
Button DOWN,1,10,2,b2,1,DESCEND 'button DOWN
When push the button Up the frequency of PLL go to up with the same rhythm.Iwant to change the code so when push the button Up the frequency of PLL to increase little by little.
Sorry for my bad english.

mister_e
- 3rd July 2006, 19:15
When you say you want to change PLL frequency.. is it the PIC one or an external one?

arrete de t'en faire pour ton anglais.. il y a pire que ca ;)

savnik
- 3rd July 2006, 19:25
When you say you want to change PLL frequency.. is it the PIC one or an external one?

arrete de t'en faire pour ton anglais.. il y a pire que ca ;)
I can change the frequency.
I want as long as push the button to change the speed .In the beginning is slow and to go fast as push the button.

savnik
- 4th July 2006, 22:47
how i can to go fast when push the button of below code:

Button UP,1,10,2,b1,1,MONTE ' button UP
Button DOWN,1,10,2,b2,1,DESCEND 'button DOWN


any help ;

Pic_User
- 4th July 2006, 23:20
Helping with the meaning.


I want as long as push the button to change the speed .In the beginning is slow and to go fast as push the button.;
You would like:
When you press the "up button" the frequency increases a certain amount, a "step".
If you hold the "up button" in, the frequency increases, by small amounts, "steps", slowly.
If you continue holding the "up button" in, the frequency increases, by larger amounts, faster.
Of course, the same with the "down button".

Like setting the time on some clocks.
Hold the button and the clock changes faster as the button is held down.

Question:
When holding the button.
Would you want the SIZE of the steps to increase, or the SPEED of selections to increase?

-Adam-

savnik
- 4th July 2006, 23:32
Question:
When holding the button.
Would you want the SIZE of the steps to increase, or the SPEED of selections to increase?
The first