This is 2.2 portion of the PICBasic Pro lab. Read the LM35 temperature sensor da
ID: 2082916 • Letter: T
Question
This is 2.2 portion of the PICBasic Pro lab. Read the LM35 temperature sensor datasheet. Figure out how the output of the temperature sensor voltage corresponds to the actual temperature in Centigrade.
Using the program written in 2.1, add the PICBasic Pro statements need to do the following:
If the temperature sensor output voltage V0 3.33V, blink the Red LED.
If the temperature sensor output voltage is 1.67V < V0 <3.33V, blink the Green LED.
If the temperature sensor output voltage is V0 <1.67V, blink the Blue LED.
DEFINE LCD_DREG PORTC ; Set LCD Data Port C
DEFINE LCD_DBIT 4 ; Set starting bit 4
DEFINE LCD_RSREG PORTC ; Set Register Select Port C
DEFINE LCD_RSBIT 0 ; Set Register Select bit 0
DEFINE LCD_EREG PORTC ; Set Enable Port C
DEFINE LCD_EBIT 1 ; Set Enable bit 1
DEFINE LCD_LINES 2 ; Set to 2 line display
DEFINE LCD_COMMANDUS 1640 ; Set command delay time 1.64ms
DEFINE LCD_DATAUS 44 ; Set data delay time 44us
DEFINE ADC_BITS 10 ; Set number of bits in digital value
ADCON0.7=1 ; Right justify digital value
ADCON0.6=0 ; 5V is reference
TRISC=%00001100 ; Set up bit of Port C for outputs
ANSEL=%11001111 ; Set up bits for digital I/O
ANSELH=0 ; Set up bits for digital I/O
; Declare 16-bit variables
adcval VAR WORD
adcint VAR WORD
adcdec VAR WORD
PAUSE 500
loop: ADCIN 2,adcval
adcval=adcval*49/10
adcint=adcval/1000
adcded=adcval/1000
LCDOUT $FE,1
LCDOUT DEC adcint, “.”, DEC adcdec, “V”
PAUSE 1000
GOTO loop
END
16F690 Pinout
LM35 Datasheet
http://www.ti.com/lit/ds/symlink/lm35.pdf
OSC2 OUT DIG 10 U/DIG 54 00T 11U 11E +OABC_+ P IC 16F690 DCCT C-D OORFEDGDU 456789Explanation / Answer
1 Features
1
• Calibrated
Directly
in Celsius
(Centigrade)
• Linear
+ 10-mV/
°C Scale
Factor
• 0.5°C Ensured
Accuracy
(at 25°C)
• Rated
for Full
55°C to 150°C Range
• Suitable
for Remote
Applications
• Low-Cost
Due to Wafer-Level
Trimming
• Operates
from
4 V to 30 V
• Less
than
60-
A Current
Drain
• Low Self-Heating,
0.08°C in Still Air
• Non-Linearity
Only
±¼°C Typical
• Low-Impedance
Output,
0.1
for 1-mA
Load
2 Applications
• Power
Supplies
• Battery
Management
• HVAC
• Appliances
Description
The
LM35
series
are
precision
integrated-circuit
temperature
devices
with
an output
voltage
linearly-
proportional
to the
Centigrade
temperature.
The
LM35
device
has
an
advantage
over
linear
temperature
sensors
calibrated
in Kelvin,
as the user
is not required
to subtract
a large
constant
voltage
from
the output
to obtain
convenient
Centigrade
scaling.
The
LM35
device
does
not require
any
external
calibration
or trimming
to provide
typical
accuracies
of ±¼°C at room
temperature
and ±¾°C
over
a full
55°C to 150°C temperature
range.
Lower
cost
is assured
by trimming
and
calibration
at the
wafer
level.
The low-output
impedance,
linear
output,
and precise
inherent
calibration
of the LM35
device
makes
interfacing
to readout
or control
circuitry
especially
easy.
The device
is used
with single
power
supplies,
or with
plus
and
minus
supplies.
As the
LM35
device
draws
only 60
A from
the supply,
it has
very low self-heating
of less than
0.1°C in still air. The
LM35
device
is rated
to operate
over
a
55°C to
150°C temperature
range,
while
the LM35C
device
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.