FIGnition FUZE Hardware Reference Manual page 62

Table of Contents

Advertisement

: analogDemo ( tks port)
dup adInit
begin
begin
over sample? until
dup sample .
inkey until
drop drop
;
The demonstration program expects you to type
will start displaying samples from the port every
10 $45 analogDemo <exe>
displays the output from analog port 5 every 0.2s seconds until you press a key.
The AtMega168 and AtMega328 both support an internal temperature sensor on analog
port 8 (there's no input pin for this, it's purely internal). Using the internal temperature sen-
sor requires you to also use the internal 1.1v reference (you will still benefit from connect-
ing AVREF to GND using a capacitor (e.g. 100nF))
You can read the current raw temperature conversion voltages using, for example:
50 $C8 analogDemo <exe>
But we can convert this directly to a temperature. The AtMega328 Manual, section 24.7
says:
Rearranging, this becomes:
And Vin in mV is related to the temperature according to:
: degC
267 - 704 u* swap drop
10 /
;
: tempDemo
$C8 adInit
begin
50 pause
$C8 sample degC .
inkey until
;
tks port analogDemo <exe>
tks
/50ths of a second. For example:
and it

Advertisement

Table of Contents
loading

Table of Contents