Page 295 - Making PIC Microcontroller Instruments and Controllers
P. 295
BEMOTE INHIBIT CAPABILITY
296 SIIICLE SET POIII COI{TBOLLENW|TH
reading is a voltage. Knowing the range of lhe signal we will be reading allows us
to design a suitable electronic nctwork to givc us the rangc we need to feed into the
micrccontroller.
The input does not have to be a voltage or a resistance either' lt can be a f-requency
that we can read with the COLD,IT and PU LSIN conmands Similarly' the output does
not have to be an on-off signal.It canjust as easily be a pulse width modulated (PWM)
signal or a frequcncy if thal is desired.
Wjth the precedingin mind, wcwill develoP the thermostatic contoller based on (1)
the LM34 sensor because we already have the scnsor and (2) discuss a &emistor-based
conlroller because thermistors arc inexpensive and give us an oppotunity to read rn a
sigDal another way.
THE L|u34-BASED COI'ITROLLER
The code development for using the LM34 is shown in Programs 2l.1 and 21 2. The
coale uses the same nomenclatLrre as was used lor the dual thermostat instrument' but
it modifies the code that was dcveloped. The specific code for reading the two inputs
does not have to be modified because in either case we arc reading the equivalent of
two potcntiometers. We need to add code ir the main loop to
l. Read rhe inhibit signal
2. Read the two inputs
3. Make the necessary comparisons
process as discussed earlier
4. Output the result ofthe decision-making
lilPjfiiF!!,(gtilil Inhibit code (single'point programmable controller)
IF INSIBIT=1 THEN if rhe inhibir switch is oN
turn OFF Lhe signal
E',SE
IF VAI,1 > VA'.2 THEN nake conparison of the Lqo walues
PORTB.l=0 lurn OFF signaL
EI]SE
PORTB.l=t turn ON the signal
EIIDIF end of conparison
ENDTF end of inhibit conparison
THERMISTOR.BASED CONTROLLER COI{SIDERATIO S
In oriler to use a thermistor, wc need to add some hardware to make it easier to rcad the
thenni stor. The goal is to get a usable range of read ings from the thermistor in the tem_
perature range we are interesied in. Thermistors with a high resistance and a high rate
are easier to use because we need a minimum resistance of thc total network to be
2k ohms or higher across the 5 volts we are using across the b dge.

