Me, again ...with something strange (at least for me) !
I try to use ADC for reading a couple of buttons. I have two situations :
- three buttons, with 82 ohms, 164 ohms, 1448 ohms resistors ; ADC reading = 1023 nothing pressed ; 78 with button 1 pressed ; 144 with button 2 ; 605 with button 3 ;
- three buttons, with 300 ohms, 1300 ohms, 3110 ohms AND 100 Kohms in parallel ; ADC reading = 1013 nothing pressed ; 236 with button 1 pressed; 575 with button 2 ; 768 with button 3.
I tried with 2 version of code (for both situations):
andCode:ADCON0.1 = 1 WHILE ADCON0.1 = 1 : WEND adval.HighByte = ADRESH adval.LowByte = ADRESL if adval > 10 and adval < 300 then gosub LED1 ...etc....
For first situation everything works fine, with both version of reading ADC !Code:ADCIN 3, adval if adval > 10 and adval < 300 then gosub LED1 ...etc...
BUT ... for second situation, NOTHING HAPPENS !!! I really not understand what I do wrong ... Can me point to the right direction ? Thanks in advance !
![]()
![]()




Bookmarks