Sonsivri

Electronics => Pic Basic Languages => Topic started by: leemarrow on April 27, 2005, 01:07:17 13:07



Title: Picbasic pro source help
Post by: leemarrow on April 27, 2005, 01:07:17 13:07
i have write a code for 16f876 for reading a temperature from a lm35cz.
Now i must subtract a vref of 2,5 volt from ad conversion result:

ADCIN 0,AD_Raw       Place the conversion of channel0 into AD_RAW
AD_Result=(AD_Raw*10) */ Quanta      ' Quantasize the result

where Quanta is 1250 (source from EXPERIMENTING WITH THE PICBASIC PRO COMPILER).

Now i have try to subtract from AD_Raw the number 25000 (2,5 volt) but it not work correctly.
which number I must subtract from AD_Raw???
(2,5 volt is my ref voltage for negative mesure)


Title: Picbasic pro source help
Post by: nimdonia on April 27, 2005, 02:39:02 14:39
is
25000 = 2.5 volt? check tht first

proly haf u make it the proper size? WORD? instead of byte


Title: Picbasic pro source help
Post by: leemarrow on April 27, 2005, 06:32:50 18:32
Quote from: nimdonia
is
25000 = 2.5 volt? check tht first

yes, 2,5 volt is 25000

i have found my error  :D
the formula to calculate temperature is wrong  :rolleyes: