| This application note
describes a method of interfacing the FT-100 to
the Dallas Semiconductor DS1820 Digital
Thermometer. This is one of the simplest and
least expensive methods of temperature
measurement using the FT-100, plus the DS1820 is
pre-calibrated and accurate to +/-0.5 deg C and
operates from -55 to +125 deg C. Temperature
conversion takes about one second, typically.
Only two of the
digital I/O lines are used, and the FT-100
supplies all power for the DS1820. The DS1820
cost around $5.00 or less and the necessary
circuitry consists of only one resistor and one
diode. Because the output from the DS1820 is
digital serial data, and not a voltage or
current, the interface cable can be relatively
long and not overly susceptible to voltage drop
or noise. Twisted wire cable should provide
sufficient noise immunity. If there is any doubt,
experiment extensively with different cable
lengths and types. The location of the resistor
and diode in the interface is not critical. If
you do not have access to a DS1820 or data
sheets, contact Y-tek.
This subroutine
uses digital lines LA1 (output) and LA41 (input)
for the interface. These I/O lines cannot be
changed very easily since they are specified in
the assembly routine. If you must use other
lines, contact the factory for help.

SCHEMATIC
OF DS1820 INTERFACE
Temperature
Read Software
This
routine is very simple, and you should have no
trouble customizing it for your particular
applications. Be very careful to copy all
commands and data statements exactly. The
comments are only to clarify the routine and may
be omitted.
TEMP_RD
'
PROG_LEN=124
'Number of bytes in assembly program
'
'--- Test for enough memory to load in assembly
routine ---
LAB_BEG=PEEK 45+(PEEK
46*256)+((PEEK 47+(PEEK 48*256))*16)
STR_BEG=PEEK 59+(PEEK
60*256)+((PEEK 61+(PEEK 62*256))*16)
IF
LAB_BEG<(STR_BEG+PROG_LEN)+16 THEN
BEEP:CLS:DISP "NOT ENOUGH":DISP "
MEMORY!":END
'
PROG_SEG=INT
(STR_BEG/16)+1:PROG_OFF=0:ADDR=PROG_SEG*16 'Addr
of assembly routine
'
FOR I=0 TO PROG_LEN:READ
X:POKE (I+ADDR),X:NEXT
'Load in assembly
routine
'
'--------------------------------- Assembly
Program --------------------------------
DATA
0E8H,4AH,00,0B2H,0CCH,0E8H,57H,00,0B2H,44H,0E8H,52H,00,0E4H,00,0D0H
DATA
0E8H,73H,0FAH,0E8H,37H,00H,0B2H,0CCH,0E8H,44H,00H,0B2H,0BEH,0E8H,3FH,00
DATA
0B4H,10H,0E8H,20H,00H,0CH,01,0E6H,00,2BH,0C9H,2BH,0C9H,0E4H,00,0B9H
DATA
28H,00,0E2H,0FEH,0D0H,0E8H,0D1H,0DAH,0FEH,0CCH,75H,0E6H,0E8H,0EH,00,0BBH
DATA
7EH,01,89H,17H,0CBH,0A0H,7BH,00,24H,0FEH,0E6H,00,0C3H,0E8H,0F5H,0FFH
DATA
0B9H,27H,01,0E2H,0FEH,0CH,01,0E6H,00,0B9H,27H,01,0E2H,0FEH,0C3H,0B4H
DATA
08,0E8H,0E1H,0FFH,8AH,0F2H,80H,0E6H,01,0AH,0C6H,0E6H,00,0B9H,32H,00
DATA
0E2H,0FEH,0CH,01,0E6H,00,0D0H,0EAH,0FEH,0CCH,75H,0E5H,0C3H
'-----------------------------------------------------------------------------------
'
' This is a simple program to display the
temperature on the LCD display and
' is only for demonstration purposes. You would
probably want to call the
' subroutine and use the temperature reading in
other ways.
'
CLS:DISP "Temp:
";CHR$ 0DFH;"C":DISP TAB 14;CHR$
0DFH;"F" 'Set up LCD
display
'
L0: CALL READ_T
'Call subroutine to get a temperature reading
IF TEMP=OLD_T THEN GOTO
L0
'If temperature has not changed, keep reading
CURSOR 1,7:DISP "
":CURSOR 1,7:DISP TEMP
'Display degrees C.
DISP "
":CURSOR 2,7:DISP TEMP*1.8+32
'Display degrees F.
OLD_T=TEMP:GOTO L0
'Save temp reading to compare with next reading
'
'
'------------ Subroutine to read temperature
--------------
' Subroutine will take one reading of the
temperature and return the
' value in the variable TEMP. TEMP is in degrees
C.
'
READ_T: SYS
PROG_SEG,PROG_OFF 'Read
Remote Temperature Sensor
IF (PEEK 17FH)=0 THEN TEMP=(PEEK
17EH)/2:RETURN 'Positive
Temperature?
TEMP=-(256-(PEEK 17EH)/2)
'Negative Temperature
RETURN
/
NOTICE: Every effort has
been made to insure the accuracy of the
information contained in this document, however
Y-tek is not responsible for any consequences
resulting from erroneous or inaccurate
information.
|