Never cared much for the POT command. Seems not as stable. But that is me.
I am going to look at your other option. Sounds interesting.
Thanks!
Never cared much for the POT command. Seems not as stable. But that is me.
I am going to look at your other option. Sounds interesting.
Thanks!
Dave
Always wear safety glasses while programming.
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Hi All, tried this code, its working but is there any other reliable way....
adval var byte ' Create adval to store result
TRISA = %11111111 ' Set PORTA to all input
ADCON1 = %00000010 ' Set PORTA analog
Pause 500 ' Wait .5 second
loop: ADCIN 0, adval ' Read channel 0 to adval
Lcdout $fe, 1 ' Clear LCD
Lcdout "Value: ", DEC adval ' Display the decimal value
Select case adval
CASE is <51
high porte.0
cASE 102
high porte.1
CASE 153
high portd.2
CASE 204
high portd.3
CASE is >225
low porte.0 : low porte.1 : low portd.2 : low portd.3
Pause 150
END SELECT
pause 100
Goto loop
End
* this below line is not accepting :ERROR
case >1 to <53
'do some thing
case >53 to < 102
'do some thing..
So On.....
That way looks good to me.
This part ...
Work something like this into your code, maybe before the CASE part. If the conditions are not met then the code will run to the CASE select part.Code:* this below line is not accepting :ERROR case >1 to <53 'do some thing case >53 to < 102 'do some thing.. So On.....
Code:IF (ADVAL > 1) AND (ADVAL < 53) THEN ....
Dave
Always wear safety glasses while programming.
Thanks mackrackit, IF (ADVAL > 1) AND (ADVAL < 53) THEN ... this code is working..
Since we using ADCIN for switches, should be able to TOGGLE the ports.. I have tried with WHILE..WEND also.. no luck.. Could you pls ..Thanks again.
Can we see your WHILE/WEND code? Or better yet your new and updated code.
But something like this should work
Code:ADCIN 0, adval WHILE (ADVAL > 1) AND (ADVAL < 53) do something ADCIN 0, adval WEND SELECT CASE ....
Dave
Always wear safety glasses while programming.
Hi, The debounce was the problem..Following both codes are working after adding some delay.. I didnt use CASE.. Pls suggest if it needs to be fine tuned..Thanx..
if (ADVAL > 200) AND (ADVAL < 256) THEN
toggle porte.0
pause 150
endif
-----------------------------------------------
ADCIN 0, adval
WHILE (ADVAL = 255) 'AND (ADVAL < 256)
toggle porte.0
pause 150
ADCIN 0, adval
WEND
Bookmarks