I still get behaviour no matter what i change...
except with Mister-e's code that works OK
Is it just a pbp version issue or is it something else ?
If it's a version problem...is there a way to get arround it ?
.
I still get behaviour no matter what i change...
except with Mister-e's code that works OK
Is it just a pbp version issue or is it something else ?
If it's a version problem...is there a way to get arround it ?
.
Hi, Ruijc
I just re-wrote your code ... works fine ( I'm only talking of the PIC point of view - do not talk about precision ...)
Try to write carefully ( and readably) ALL your config sequence ( I know ... ~ 50 lines ! )... and it will work !!!
Just a tip:
instead of :
" temp = (va1*/500)>> 2 "
try :
" temp = val*125
temp = temp.highbyte "
Alain
************************************************** ***********************
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 " !!!
*****************************************
Mine did some averaging, not much. Read the sensor couple of time (10-16 times) then calculate the average of it, go to next channel, do the same, show the results.
I did it the 'bad' way
lost of precision and so on, now for something better, have a look at Darrel's routine.Code:for loopw = 0 to 15 ADCIN 0, TEMPW VA1=VA1 + (TEMPW>>4) NEXT pause 500 FOR LOOPW=0 TO 15 ADCIN 1, TEMPW VA2=VA2 + (TEMPW>>4) NEXT
Averaging 16 bit values without using 32 bit math?
http://www.pbpgroup.com/modules/wfse...hp?articleid=7
Last edited by mister_e; - 9th December 2007 at 18:29.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
************************************************** ***********************
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 " !!!
*****************************************
Yup i agree, an external Vref or op-amp should be used.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Hi guys
thanks for all the help.
Mister-e...you mentioned an external Vref.
I have a 12v power down to 5v for this circuit.
Can i use 12v as reference ? How can i do this ?
I'm a bit confused...can i plug it directly to my 16F88 ?
.
NO NO NO DON'T DO IT
Vref have to be lower than Vdd. Let's see you have a sensor who produce you a max of 1 volt. Then you select a Vref of ~1 Volt, then your ADC give you the full 10 bit conversion scale between 0-Vref. This is the use of it.
But yeah.. check out for the minimum Vref requirement...![]()
Last edited by mister_e; - 10th December 2007 at 18:51.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks