#### Do you have a question? Post it now! No Registration Necessary

**posted on**

January 2, 2004, 8:22 pm

Can anyone help with a problem I have

with a file from:

http://www.avrfreaks.com/Tools/showtools.php?ToolID39%1

It's in the temperature.c file and the statement is:

Temperature = (Beta / ((log(V

(Beta/T

But I can find no reference to "

I am using ICCAVR and this was written for IAR EWAAVR 2.27b.

Anyone help?

Thanks

Phil

with a file from:

http://www.avrfreaks.com/Tools/showtools.php?ToolID39%1

It's in the temperature.c file and the statement is:

Temperature = (Beta / ((log(V

___ADC/(V___ref-V___ADC))/log(____E)) +(Beta/T

___amb))) - T___zero;But I can find no reference to "

______E" in any of the files?I am using ICCAVR and this was written for IAR EWAAVR 2.27b.

Anyone help?

Thanks

Phil

Re: AVR Atmega169 help

Since it starts with two underscores, it is defined by the implementation

(compiler vendor or library author). Look in the library or compiler

documentation for '

______E'. Developers are not supposed to name variables

with leading underscores (even in assy. if you want to mix C and assy)

unless you are writing a compiler. Well there are some exceptions but why

risk it?

--

- Mark ->

- Mark ->

--

Re: AVR Atmega169 help

This is just a guess as my math is rusty. According to the app note, you want

ln(V

___ADC/(V___REF-V_ADC)

ln() is not the same as log(). I believe ln (natural log) is the log with

respect to the mathematical constant e. So, I assume the extra /log(

______E) is to

adjust log to be a natural log. So, I believe

______E is supposed to represent the

math constant e. I just don't remember what the value of e is.

Re: AVR Atmega169 help

Hold right there.... Since it's a C source we appear to be talking

about here, that had better be false. The C standard library function

log()

___is___the natural logarithm. If you want the log10(), you can

get that too, but that would be pretty pointless in the circumstances.

I'm saying this under the assumption that the compiler makers at least

tried to act reasonably regarding ISO C standard compliance, where it

makes sense to do so. I.e. if your C compiler has a function named

log() in declared in <math.h>, and that computes anything else but the

natural logarithm, that's IMHO sufficient grounds for immediately

firing whoever bought it (and never talking to its maker again until

they fix that error).

--

Hans-Bernhard Broeker ( snipped-for-privacy@physik.rwth-aachen.de)

Even if all the snow were burnt, ashes would remain.

Hans-Bernhard Broeker ( snipped-for-privacy@physik.rwth-aachen.de)

Even if all the snow were burnt, ashes would remain.

Re: AVR Atmega169 help

The original formula calls for a ln() function (natural log) and it was

written using log() function (base 10). In order to convert to base 'e' you

need to divide by log(e).

Somewhere 'e' must be defined. If you can't find it just define it as

2.718281828. That should get you going.

Randy Ott

written using log() function (base 10). In order to convert to base 'e' you

need to divide by log(e).

Somewhere 'e' must be defined. If you can't find it just define it as

2.718281828. That should get you going.

Randy Ott

#### Site Timeline

- » Powering a LPC2114 ARM7
- — Next thread in » Embedded Programming

- » Your opinions please on possible 89LPC901FN programmer product
- — Previous thread in » Embedded Programming

- » Interesting review of $1 microcontrollers
- — Newest thread in » Embedded Programming

- » OT: Oops
- — The site's Newest Thread. Posted in » Electronics Design