Hi Fratello,
1) Do you have two PCB with different resistor values?
or
2) Have you changed resistors to same board and tested with two SW settings?
In case
1) there must be some other differences on PCB
2) resistors are not with correct values
Hi Fratello,
1) Do you have two PCB with different resistor values?
or
2) Have you changed resistors to same board and tested with two SW settings?
In case
1) there must be some other differences on PCB
2) resistors are not with correct values
Thanks, Mr. Gusse, for support !
I have only one PCB, without the resistors from chain (just R2=1k is soldered on PCB, between +5V and ADC_IN).
I put the resistors from chain 1 from R2/ADC_IN to ground ; in first case works perfect.
Then I soldered the R9=100k from R2/ADC_IN to ground ; I put resistors from chain 2 into circuit (in parallel with R9). In this case nothing happens.
All the resistors are measured, look to be OK (this was my first concern too ...).
Tomorrow I'm going to try to set some debounce ...
Last edited by fratello; - 3rd April 2015 at 21:35.
SOLVED !!!
In first case the code is :
"If adval > 419 and adval < 536 then gosub LED" = working fine.
In second case :
"If adval > 450 and adval < 600 then gosub LED" = NOT working.
So I tried this :
"If adval < 600 and adval > 450 then gosub LED"
And VOILA, IT'S WORKING !!!
Thanks for support ! Regards !
I don't get it. That looks identical to me.
Robert
For me too ... But I can prove it (by video) !
Maybe because when no button is pressed, ADC reading is NOT 1023 ?!
I do not know what version of PICBasic you are using or what version of MPASM either.
I compiled and ran the following code in the MPASM Simulator and it works fine for all (3) IF/THEN statements in main.
If adval <= 419 then myLED does not increment.
If adval > 419 and <= 450 then myLED only increments 1 time for each loop (IF/THEN #1 : Not #2 and #3)
if adval > 450 and < 536, then myLED increments 3 times for each loop (IF/THEN #1, #2 and #3)
if adval => 536 and < 600 then myLED increments 2 times for each loop (IF/THEN #2 and #3 : Not #1)
if adval => 600 then myLED does not increment.
Code:'MCU = 12F675 'PBP v3.0.7.4 'MPASM v8.90 DEFINE OSC 4 DEFINE ADC_BITS 10 DEFINE ADC_CLOCK 3 DEFINE ADC_SAMPLEUS 50 CMCON = 7 OPTION_REG = %10000110 TRISIO = %00001100 GPIO = %00000001 ANSEL = %00010100 ADCON0 = %10001001 adval var word myLED var word adval = 0 myLed = 0 goto main LED: myLED = myLEd + 1 return main: for adval = 0 to 700 If adval > 419 and adval < 536 then gosub LED 'Works If adval > 450 and adval < 600 then gosub LED 'Works If adval < 600 and adval > 450 then gosub LED 'Works next myLed = 0 goto main
Regards,
TABSoft
Bookmarks