Dial switch diemna... need more ANalog ports


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Nov 2007
    Location
    West Covina, CA
    Posts
    219


    Did you find this post helpful? Yes | No

    Default Use only 1 A/D

    You can configure your own "switching" pot with a 7 position switch and resistors then use only 1 A/D port.
    Name:  7 Pos SW.jpg
Views: 246
Size:  43.9 KB
    The values selected were not calculated for anything special just picked something that would probably give a decent spread for a 10bit A/D setting. Then using the SELECT CASE, set the values to the level "between" each setting.
    Suppose position 1 value is 170 and position 2 is 327 then make your 1st CASE setting to 248, middle of the two values, and continue from there for the whole range.

    Sample code:
    Code:
    check_switch:     
        ADCIN #, adval    
        SELECT CASE adval
            CASE IS < xxx: do this or that   ' Lowest value
            ......
            CASE IS < xxx: do this or that   ' Highest value   
        END SELECT    
    RETURN
    I just made this a couple of months ago and works as needed!
    Louie

  2. #2
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    thats agood idea, I used a similar switch arrangment but I will drop my if then statement and use Select case, I dod not know it was in picbasic, I used it in C++ a long time ago.
    thanks

    L

Members who have read this thread : 0

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