Button


Closed Thread
Results 1 to 11 of 11

Thread: Button

  1. #1
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302

    Default Button

    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

  2. #2
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    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

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    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.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by paul borgmeier
    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

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    multiply by 10 or get the remainder with R2 predefined variable
    http://www.picbasic.co.uk/forum/show...ight=remainder
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by savnik
    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.

  7. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    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
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  8. #8
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e
    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.

  9. #9
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by savnik
    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 ;

  10. #10
    Join Date
    Apr 2006
    Location
    New Hampshire USA
    Posts
    298


    Did you find this post helpful? Yes | No

    Smile Helping with the meaning.

    Helping with the meaning.

    Quote Originally Posted by savnik
    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-
    Ohm it's not just a good idea... it's the LAW !

  11. #11
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Pic_User
    Question:
    When holding the button.
    Would you want the SIZE of the steps to increase, or the SPEED of selections to increase?
    The first

Similar Threads

  1. Sony SIRC IR Issue
    By Ryan7777 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 8th August 2015, 08:10
  2. 3 HPWM channels
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 4th April 2006, 02:43
  3. Code check -- button not working
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 2nd March 2006, 22:43
  4. Button Push within 3 second Window
    By Tissy in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 22nd December 2005, 10:06
  5. Button subfunction 16F628
    By Jųan in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 19th August 2005, 16:44

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts