Select case function


+ Reply to Thread
Results 1 to 17 of 17

Hybrid View

  1. #1
    Join Date
    Feb 2022
    Posts
    78


    Did you find this post helpful? Yes | No

    Default Re: Select case function

    Hello Richard

    by inverting portb / portc I found no duplicate

    If I may ask, how to know the time it took from the start to end of a for/next loop or select case in a program


    Many thanks for your support.

    Code:
          key = ncd portb  'row    look for a 1
          key = key + (ncd portc )<<4
    Last edited by jackberg1; - 15th February 2025 at 17:05.

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default Re: Select case function

    If I may ask, how to know the time it took from the start to end of a for/next loop or select case in a program
    Depends on what's available. I usually just set a pin high at the start and low again at the end of the routine I want to measure and then look at the pin using a scope or logic analyzer. Another option is to use one of the hardware timers and send the result to the PC using whatever serial connection is available (DEBUG, SEROUT, HSEROUT) but for longer routines one has to be little bit careful as to not overflow the timer and therefor get misleading values.

    /Henrik.

  3. #3
    Join Date
    Feb 2022
    Posts
    78


    Did you find this post helpful? Yes | No

    Default Re: Select case function

    Thank you HenrikOlsson

    This is a very usefull solution since I got on hand a logic analyzer + scope.



  4. #4
    Join Date
    Feb 2022
    Posts
    78


    Did you find this post helpful? Yes | No

    Default Re: Select case function

    Hello HenrikOlsson,

    I did some timing test for the 'Select case' for key # 1 ~ key # 64

    case # 1 : 3.48us and the last of the case key # 64 : 134.9us

    Thanks again for this clever trick.





Similar Threads

  1. Select Case Weirdness
    By rocket_troy in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 19th June 2014, 01:33
  2. Changing from If..Then to Select Case
    By BobK in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 27th March 2013, 12:06
  3. About Select Case
    By polymer52 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 28th February 2010, 12:54
  4. Select case...Just wondering....
    By muddy0409 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 30th December 2006, 00:23
  5. Select Case
    By Srigopal007 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 20th June 2005, 20:18

Members who have read this thread : 14

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