How To Use An Lcd To Monitor Temperature From A Ds1620 Digital Thermometer/Thermostat Chip



Similar documents
DS1621 Digital Thermometer and Thermostat

PACKAGE OUTLINE DALLAS DS2434 DS2434 GND. PR 35 PACKAGE See Mech. Drawings Section

DS1621 Digital Thermometer and Thermostat

Kit Watt Audio Amplifier

Ocean Controls RC Servo Motor Controller

DS1821 Programmable Digital Thermostat and Thermometer

CHAPTER 11: Flip Flops

DS18B20 Programmable Resolution 1-Wire Digital Thermometer

A+ Guide to Managing and Maintaining Your PC, 7e. Chapter 1 Introducing Hardware

DS Wire Digital Thermometer and Thermostat

PolyBot Board. User's Guide V1.11 9/20/08

8051 Flash Microcontroller. Application Note. A Digital Thermometer Using the Atmel AT89LP2052 Microcontroller

AXE033 SERIAL/I2C LCD

GLOLAB Universal Telephone Hold

K128. USB PICmicro Programmer. DIY Electronics (HK) Ltd PO Box 88458, Sham Shui Po, Hong Kong. mailto:

ECEN 1400, Introduction to Analog and Digital Electronics

BUILDING INSTRUCTIONS

Troubleshooting and Diagnostics

NTE2053 Integrated Circuit 8 Bit MPU Compatible A/D Converter

Data Acquisition Module with I2C interface «I2C-FLEXEL» User s Guide

- 35mA Standby, mA Speaking pre-defined phrases with up to 1925 total characters.

LCM NHD-12032BZ-FSW-GBW. User s Guide. (Liquid Crystal Display Graphic Module) RoHS Compliant. For product support, contact

Cumbria Designs T-1. SSB/CW Filter kit (4.9152MHz) User Manual

ET-BASE AVR ATmega64/128

Web Site: Forums: forums.parallax.com Sales: Technical:

ARDUINO SEVERINO SERIAL SINGLE SIDED VERSION 3 S3v3 (REVISION 2) USER MANUAL

How to connect to a Class II router using a mobile-phone data cable specifically for Solwise & Safecom routers

The $25 Son of a cheap timer This is not suitable for a beginner. You must have soldering skills in order to build this kit.

LMB162ABC LCD Module User Manual

!Operation:!1. Connect an external power source to J1 (+ and - IN terminals). The

CENTRONICS interface and Parallel Printer Port LPT

MODULE BOUSSOLE ÉLECTRONIQUE CMPS03 Référence :

Designing VM2 Application Boards

8-Bit Microcontroller with Flash. Application Note. Using a Personal Computer to Program the AT89C51/C52/LV51/LV52/C1051/C2051

Advanced Data Capture and Control Systems

The Programming Interface

Joule Thief 3.0 Kit. June 2012, Rev Joule Thief 3.0

RS232/DB9 An RS232 to TTL Level Converter

SYSTEM 4C. C R H Electronics Design

DS1307ZN. 64 x 8 Serial Real-Time Clock

Serial Communications

MICROPROCESSOR AND MICROCOMPUTER BASICS

GLOLAB Two Wire Stepper Motor Positioner

FM75 Low-Voltage Two-Wire Digital Temperature Sensor with Thermal Alarm

Interfacing To Alphanumeric Displays

PICAXE RF CONNECT KIT (AXE213)

AXE114S BINARY CLOCK. revolution Revolution Education Ltd. Web: Version /09/08 AXE114.PMD.

PROGRAMMABLE LOGIC CONTROLLERS Unit code: A/601/1625 QCF level: 4 Credit value: 15 TUTORIAL OUTCOME 2 Part 1

DDS VFO CONSTRUCTION MANUAL. DDS VFO Construction Manual Issue 1 Page 1

REPAIRING ROWE/AMI R84 - R88

Electronic Rotary Table Divider V2.1 Construction

Develop a Dallas 1-Wire Master Using the Z8F1680 Series of MCUs

User Guide Reflow Toaster Oven Controller

css Custom Silicon Solutions, Inc.

SIMPLE EPROM PROGRAMMER. EPROM Programmer Design. Hardware

Micro-Step Driving for Stepper Motors: A Case Study

MICROPROCESSOR. Exclusive for IACE Students iacehyd.blogspot.in Ph: /422 Page 1

NC-12 Modbus Application

AUTOMATIC CALL RECORDER JAMECO PART NO

TEST CHAPTERS 1 & 2 OPERATING SYSTEMS

0832 Dot Matrix Green Display Information Board User s Guide

The CW Machine Hardware

DS2438EVKIT+ Smart Battery Monitor Evaluation Kit

TraceTek TTDM Series Leak Detection and Location Modules Replacement Parts Installation Instructions

AUTOMATIC NIGHT LAMP WITH MORNING ALARM USING MICROPROCESSOR

XBee USB Adapter Board (#32400)

The I2C Bus. NXP Semiconductors: UM10204 I2C-bus specification and user manual HAW - Arduino 1

Electronic Circuit Construction:

[F/T] [5] [KHz] [AMP] [3] [V] 4 ) To set DC offset to -2.5V press the following keys [OFS] [+/-] [2] [.] [5] [V]

Thermostat Application Module Kit

Optical Sensor Interface for AFX Digital LED Timer/Counter by George Warner, Jan

Introduction the Serial Communications Huang Sections 9.2, 10.2 SCI Block User Guide SPI Block User Guide

2 ASCII TABLE (DOS) 3 ASCII TABLE (Window)

DS12885, DS12885Q, DS12885T. Real Time Clock FEATURES PIN ASSIGNMENT

SDN INSTRUCTIONS 07/10, Ver 1.2. Somfy Digital Network (SDN) Installation and Programming

UMBC. ISA is the oldest of all these and today s computers still have a ISA bus interface. in form of an ISA slot (connection) on the main board.

Physical Specifications (Custom design available.)

Fiber Optic Monitor and Control Evaluation Kit

EVAL-UFDC-1/UFDC-1M-16

7-SEGMENT DIGITAL CLOCK

CT-1024 Terminal System Kit (TV Typewriter II)

TS5010 TeraTune Programmable Bandpass Filter

A PIC16F628 controlled FLL (Frequency Locked Loop) VFO for HF

Microtronics technologies Mobile:

Modification of an AOR AR-8600 receiver to tune it with a ACECO FC-3002 frequency finder

The modular concept of the MPA-3 system is designed to enable easy accommodation to a huge variety of experimental requirements.

HD44780U (LCD-II) (Dot Matrix Liquid Crystal Display Controller/Driver)

The components. E3: Digital electronics. Goals:

FTDI VCP DRIVER (free) (WIN/MAC/LINUX)

SYSTEM 45. C R H Electronics Design

Chapter 4 System Unit Components. Discovering Computers Your Interactive Guide to the Digital World

USB to serial chip CH340

TEECES DOME LIGHTING SYSTEMS

LCD MODULE DEM SYH-LY

MIDECO 64-outputs MIDI note decoder USER MANUAL. Roman Sowa 2012

UPS PIco. to be used with. Raspberry Pi B+, A+, B, and A. HAT Compliant. Raspberry Pi is a trademark of the Raspberry Pi Foundation

GSM Autodialer Professional GJD700 Speech & Text Autodialer

PICNet 1. PICNet 1 PIC18 Network & SD/MMC Development Board. Features. Applications. Description

AutoRanging Digital MultiMeter

ELECTRONIC THERMOSTAT AND THERMOMETER With SPEED CONTROL

Transcription:

The aim of this kit is to show how to use a 16x2 alphanumeric Liquid Crystal Display (LCD) with a PC. First we show how to connect it to the parallel port and echo and handle keyboard input. Then we show how to use the LCD to display temperature from a DS1620 Digital Thermometer/Thermostat chip and set the HI & LO triggerpoints in it. All C source code is provided. There are certain minimum timing requirements that must be followed when writing to the LCD, such as data setup times and Enable signal pulse width. These are in the order of tens and hundreds of nanoseconds. Extra timing delays are also introduced by the cable capacitance used to connect the kit to the PC printer port. Delay routines may be needed when using fast PCs to meet these timing requirements. The software supplied include these delay routines. LCD displays have a busy flag that is set while it is executing a control command. This flag is not accessible because the R/W line has been tied low (write). This is not such a problem because all commands have a maximum execution time. We simply wait for this time to pass before accessing the LCD again, eliminating the need to check the flag and thereby saving on an I/O line! LIQUID CRYSTAL DISPLAYS LCDs have become very popular over recent years for information display in many smart appliances. They are usually controlled by microcontrollers. They make complicated equipment easier to operate. LCDs come in many shapes and sizes but the most common is the 16 character x 2 line display. It requires only 11 connections eight bits for data (which can be reduced to four if necessary) and three control lines (we have only used two here). It runs off a 5V DC supply and only needs about 1mA of current. The display contrast can be varied by changing the voltage into pin 3 of the display, usually with a trimpot. To get the display working requires eight bits of data, a register select line (RS) and a strobe line (E). These are supplied from the PC printer port (refer to schematic). A third input, R/W, is used to read or write data to/from the LCD. In this kit the R/W line is tied low so only writes to the LCD are possible (more on this later). The eight bits of data are supplied from the printer port data lines and two printer port control lines are used for RS ( auto ) and E ( strobe ). Basically the LCD has two registers, a data register and a control register. Data is written into the control register when RS is low and into the data register when RS is high. Data is latched into the LCD register on the falling edge of Enable. The sequence for writing to the LCD is: 1. To begin, E is low 2. Select the register to write to by setting RS high (data) or low (control) 3. Write the eight bits of data to the LCD 4. Set the Enable signal high then low again. Eg. The Clear Display command has an execution time of approx. 1.6mS. After sending this command to the LCD we simply wait 2mS before continuing on. This ensures that the command has finished. Characters to be displayed are written into the LCD s data RAM memory. The amount of RAM available depends on the type of LCD. The LCD used in this kit has 80 bytes of RAM. An internal address counter holds the address of the next byte to write to. These 80 bytes are broken up into two blocks of 40 bytes. The address range of the first block is from 00h to 27h and the second block from 40h to 67h. After power up and initialization address 00h is the first character of the top line and address 40h is the first character of the bottom line. The address counter is set to address 00h and is automatically incremented after each byte is written. Only the first 16 bytes of each line are visible. If we now start writing data to the LCD it will be stored from address 00h on but only the first 16 characters will be visible. To display the rest of the characters we need to scroll the display. Scrolling simply means changing the start address of each line. If we scroll left one position address 01h becomes the first character of the top line and address 41h the first character of the bottom line. Scrolling right does the opposite addresses 27h and 67h become the first characters of the top and bottom lines. As you can see, each block of addresses wrap around in a circular manner. The next address after 27h is 00h; the next address after 67h is 40h. If we scroll left 40 times we will bring address 00h back into view as the last character on the top line. PAGE 1

As you can see the address ranges of each block are not continuous. There is a gap of 24 bytes between the end of the first block (27h) and the start of the second (40h). So, if we keep writing characters to the display the first 40 will be stored in addresses 00h to 27h, the next 24 will be lost and the next 40 will be stored at addresses 40h to 67h. The internal address counter is directly accessible so we can set the next address to write to. This is how the characters are written to the second line of the LCD. For example, we can send 5 characters to the first line, set the address counter to 40h and then start writing characters to the second line. DS1620 The DS1620 is a Digital Thermometer/Thermostat IC from Dallas Semiconductor. The chip measures temperatures from -55 to +125 C (-67 to +257 F) in 0.5 C increments and has three alarm outputs. It requires no calibration or external components. The three alarm outputs, designated T HIGH, T LOW and T COM function as follows: T HIGH goes high when the measured temperature is greater than or equal to a user-defined upper limit (TH). T LOW goes high when the measured temperature is less than or equal to a user-defined lower limit (TL). T COM goes high when the temperature exceeds the upper limit and stays high until the temperature falls below the lower limit. These three outputs can be used to directly control heating and cooling appliances via suitable drive circuitry (eg. Relays and optocouplers). Data is read from and written to the DS1620 via a 3-wire serial interface (DQ, CLK and RST). The user-defined upper and lower trip points are stored in the IC in nonvolatile memory. This means that the trip points are remembered even when the power is removed. The DS1620 can be used in two modes Three-Wire mode for interface to a computer or Stand-Alone mode. This last mode does not require a computer interface. With RST and CLK low, the chip will continuously monitor the temperature and set the alarm outputs accordingly. Temperature registers in the DS1620 are nine bits long and can be positive or negative values. Each reading has a resolution of 0.5 C. For positive temperatures, the most significant bit (bit 8) = 0 and bits 1-7 hold the integer value. Bit 0, is set, adds 0.5. For negative temperatures, bit 8 = 1 and bits 7-0 represent the two s complement of the temperature. To get the actual value, invert bits 7-0 then add 1. The DS1620 is controlled via a set of 8-bit instructions. Depending on the instruction an 8 or 9 bit data value is either read from or written to the chip. All instructions and data are transferred serially starting with the least significant bit D0. To read or write a value to the DS1620: 1. To begin, RST is low and CLK high. 2. RST high 3. CLK low 4. Set DQ equal to Bit 0 of instruction 5. CLK high 6. Repeat steps 3, 4 and 5 for remaining instruction bits To write to the chip: 7. Repeat steps 3, 4 and 5 for Bits 0-7 or 0-8 of the data to be written 8. RST low for at least 5ms To read from the chip do Steps 1 through 6 above then: 7. Set the AUTO signal high so that data can be read from the DS1620 8. CLK low. DQ now outputs the data to be read (LSB first) 9. Read and store DQ 10. CLK high 11. Repeat steps 8, 9 and 10 for the remaining bits of data to be read 12. RST low As with the LCD, certain minimum timing requirements must be observed between each of these steps. In particular, RST must remain low for at least 5ms after writing data to the DS1620 (step 8). This gives the chip s internal EEPROM time to store the data. Also, the DS1620 needs 1 second to execute a start-convert instruction. So, after starting a temperature conversion, you must wait 1 second before reading the result. This means that once you have programmed the upper and lower trip points the kit can be disconnected from the PC and you can use the alarm outputs for monitoring or control functions. You can even remove the chip from its socket and put it in your own temperature controller, using the kit simply as a DS1620 programmer. PAGE 2

THE PC PARALLEL PORT There are three common address ranges used for parallel port interfaces, as follows: 3BCh - 3BFh Parallel interface on monochrome or TTL video card 378h - 37Fh Parallel interface 1 278h - 27Fh Parallel interface 2 Table 1 The standard PC parallel port consists of three registers, each referred to by their functional name. These registers occupy the first three addresses in the range. The first address in the range is referred to as the base address. Data register Base address Read/Write Status register Base address + 1 Read only Control register Base address + 2 Read/Write For example, for parallel interface 1, the data register would be at address 378h, status register at address 379h and control register at address 37Ah. Note that the data and control registers can be written to and read from. This does not mean that they are bidirectional. It means that the outputs of these registers can be read back to check their status. During the system boot-up sequence, the BIOS tests for the presence of parallel ports in order, according to Table 1. The first port found becomes LPT1, the second LPT2, and so on. The BIOS stores the base address of each port found in a table in the BIOS variable segment of memory, as follows: Address Contents 0040:0008H Base address of LPT1 0040:000AH Base address of LPT2 0040:000CH Base address of LPT3 0040:000EH Base address of LPT4 (If address=0 then there is no port for that LPT number.) Every signal line on the port, whether it is used for read/input or write/output, is allocated one particular bit at one of the three addresses Base, Base+1 or Base+2. The logic state of the bit indicates the state of the wire (0V or 5V.) The following table shows each printer port signal used by the kit and the register, address and bit position associated with it. The last three signal names are preceeded by a minus sign. This means that the signal is active low. Writing a high to the bit causes the signal to go low. Signal Reg. Addr. Bit Direction D0 D7 Data Base 0-7 Output ACK Status Base+1 6 Input -STROBE Control Base+2 0 Output -AUTO Control Base+2 1 Output INIT Control Base+2 2 Output -SLCTIN Control Base+2 3 Output ASSEMBLY INSTRUCTIONS Use the component overlay on the PCB to place the components, in the following order: Resistors and diodes Wire link. Use one of the resistor offcuts Monobloc capacitor C3 and IC socket Trimpot, voltage regulator and X3 header pins Electrolytic capacitors. Make sure the electrolytics are inserted the right way around LCD socket, power jack and D25 connector. Fit and solder the 14-way male header strip to the underside of the LCD, keeping it at right angles to the LCD. The header strip is inserted in the leftmost 14 holes (looking from front) on the LCD. The LCD is held in place by the socket pins on the top and two screws on the bottom. Fit the two screws to the bottom mounting holes of the LCD and secure with nuts. Add a second nut to each screw about half way up. See the jpg photos on the floppy disk. Insert the LCD into its socket on the PCB with the screws protruding through the matching mounting holes. Adjust the nuts so that the LCD is parallel to the PCB. Fit and tighten the last two nuts to secure the LCD to the PCB. CIRCUIT DESCRIPTION The circuit is quite straightforward. IC2 is a 5V regulator the powers the kit. Diode D2 protects the kit against reverse polarity on the DC input jack. The trimpot is used to adjust the contrast and viewing angle of the LCD. Resistors R2 and R3 hold the DS1620 CLK and RST inputs low when the kit is disconnected from the PC. This allows the chip to work in stand-alone mode. Resistor R1 and diode D1 convert the separate data input and output lines from the PC to the single bidirectional data line on the DS1620. When writing to the chip, R1 pulls DQ high when AUTO is high. DQ is pulled low via D1 when AUTO is low. When reading from the DS1620, AUTO must be set high first. This high is blocked by D1 so that the DQ output can drive ACK. Connection to the DS1620 alarm outputs is via connector X3. The DC input voltage also appears on PAGE 3

CK108 INTRODUCTION TO LCD S this connector as does ground. This is useful for powering devices driven by the alarm outputs directly from the kit. TESTING Do not insert the LCD or the DS1620 IC. Connect a DC supply to the power jack. A 12V DC plug pack will do nicely. Measure the 5V output from the regulator. The easiest place to measure is between pins 4 and 8 on the IC socket. If all is well, remove power and insert the IC and LCD. Apply power again. There should be a series of black squares on the LCD. If not then adjust the trimpot until visible. You are now ready to connect to a PC and run the software. SOFTWARE DESCRIPTION As mentioned previously, there are two programs supplied. Both are written using Borland Turbo C for DOS. They will run quite happily in a DOS box under Windows 95/98. Note: Both programs assume you are using printer port LPT1 at address 378h. This address is defined in the source code and can be changed if necessary. The source code would then need to be re-compile. 1. K134LCD.EXE A simple program that allows the user to enter a message to be displayed on the LCD. The message can be up to 40 characters long. The message can be scrolled left or right and the scrolling rate can be varied. After running the program a menu is displayed on the PC from which you choose the required function. The message is only displayed on the top line of the display. If scrolling and the message is less than 40 characters long then a number of spaces will be displayed before the message starts again. 2. K134TEMP.EXE A program that displays the current temperature as well as the upper (TH) and lower (TL) temperature trip points. The value of the trip points can be changed. The user can choose between Celsius or Fahrenheit display. The DS1620 is configured to perform continuous temperature conversions. Current temperature and trip point data is continually read from the DS1620 and compared with the previous reading. If any of the three values have changed then the display is updated. IF IT DOES NOT WORK Poor soldering ( dry joints ) is the most common reason for the circuit not working. Check all soldered joints carefully under a good light. Re-solder any that look suspicious. Check that all components are in their correct position. Are the electrolytic capacitors and diodes the right way round? REFERENCES The Internet is the place today to get information. But here are some magazine References on LCD s: Rick Walters, A liquid crystal display driven from a PC printer port, Silicon Chip March 1998. Mark Roberts, A PC-controlled thermometer/thermostat, Silicon Chip June 1997. Jan Axelson, Temperature Monitoring With a Synchronous Serial Link, MicroComputer Journal March/April 1995. Web Address & Email You can email us at sales@electronickits.com if you have any problems or requests. Information on other kits in the range is available from our Web page at: www.electronickits.com PARTS LIST - KIT 134 Resistors (0.25W carbon) 10K... R1-4...4 10K trimpot... VR1...1 Capacitors 100nF monobloc... C3...1 10uF 25V electrolytic... C2...1 100uF 25V electrolytic... C1...1 Semiconductors 1N4004... D2...1 1N4148... D1...1 78L05... IC2...1 +5V regulator, TO-92 package DS1620... IC1...1 Digital Thermometer and Thermostat Liquid Crystal Display... LCD...1 16 characters x 2 lines Miscellaneous 2.5mm DC jack... X2...1 PCB mounting D25 connector... X1...1 PCB mounting, right-angle, male 5-pin SIL header... X3...1 8-pin IC socket... for IC1...1 14-pin SIL socket... for LCD...1 14-pin SIL header... for LCD...1 Screw, 2.6mm x 18mm long... 2 Nut, 2.6mm...6 PCB, K134... PAGE 4

CK108 - PC CONTROLLED LCD & THERMOSTAT PAGE 5