Dear All
I replaced my own routine for ADC readings with Melanie's just to see if there would be any difference in displayed voltages.
I found out that there was always an increase in steps of 30mV(remember that I display with a resolution of two decimal digits) instead of my previous output in short bursts of gradually increasing values by 10mV.
So I came to the conclusion that my problem lies with the resistive divider that I use in order to be able to read voltages up to 30V.This is division by 6 and with the 0,004887 V / step(due to 5V max./1023 for 12F675) we arrive at apx. 30mV / new step which is unavoidable.
I think that I have to use some OPamp method(differential) to read voltage without stepping down through a ressistive divider.
I would welcome any thoughts and/or suggestions on the subject.
I thank all of you and especially Melanie(for the exceptional/disciplined programming techniques she uses) for the time you dedicated for me.
Also please forgive any grammar mistakes I make since I am only a native Greek .
Bill
Hi Bill
Take a look at this post.
http://www.picbasic.co.uk/forum/showthread.php?t=8070
You will have to extrapolate the Voltage up from the 12 Volt example given. Hope it helps….
Melanie doesn’t really make fun of grammar. We have a running joke about the difference between REAL English and American English. She was just catching a goof of mine. Your English is better than mine!
-Adam-
Ohm it's not just a good idea... it's the LAW !
Bill
You're pretty much at the limit of conventional measurement (using a potential divider). The best you can accomplish as you have discovered will be steps of...
5v/1024*6 = 0.02929 (29.2mV)
Where 6 is your Potential Divider ratio.
Adam has suggested Zener Diodes, but beware using those, as no two Zener Diodes are the same and their tollerances are quite large.
You can always use an external 12-bit ADC rather than the PICs internal 10-bit one. That will then give you a resolution of about 4.4mV which is inside your two decimal places.
Trouble is I can guarantee your 5v reference probably isn't 5.0000v (and are you using 0.1% Resistors?) so we're splitting hairs about millivolt ADC tollerances anyway.
The only software solution... which is valid for slow-moving voltages (sampling alone in the below example will probably take about 4-5mS)... just massively over-sample, but I think you're using that already... Even with older versions of PBP, you are able to take 64 samples and add them together before you spill out of a WORD.
You now have 16-bits resolution... well, not really, but the bigger the sample the better.Code:' ' Sample 64 times ' --------------- ADCValue=0 For CounterA=0 to 63 ADCON0=%00000001 ' Select Channel, Turn-On A/D ' 7=0 Unused ' 6=0 Unused ' 5=0 ) ' 4=0 ) ' 3=0 ) selects AN0 ' 2=0 ) ' 1=0 Go-done Bit ' 0=1 switch-On ADC Module Pauseus 50 ' Wait for channel to setup ADCON0.1 = 1 ' Start conversion While ADCON0.1=1:Wend ' Wait for conversion DataW.HighByte=ADRESH ' Read variable from ADC and save DataW.LowByte=ADRESL ADCValue=ADCValue+DataW Next CounterA
Need more? Just use PBP 2.50 where you can have more bits... but it will take much longer to sample - how much time do you have to spare?
Bookmarks