interfacing sensors to the ibm pc

HIGHER TECHNICAL INTITUTE
ACAD. YEAR 1991-1992
ELECTRICAL ENGINEERING DEPARTMENT
DIPLOMA PROJECT
INTERFACING SENSORS
TO THE IBM PC
NEOKLEOUS NEOKLIS
E /827
SUPERVISOR: Mr. SOTIRIS HADJIOANNOU
EXTERNAL ASSESSOR: Mr. FALAS ANASTASIOS
This
project
interfacing
present
hardware
and
software
a variety of sensors to the
design
IBM PC. The aim of this
project is to enable the IBM PC to read physical quantities. Also
some
output devices
information
which
are
attached. So
take
from
the
the
PC it
input
analyze
sensors
and
the
drive
accordingly the output devices.
Many sensors
understand only
IBM
PC can
provide analog voltage levels:
The computer can
digital signals, 8-bit, 16-bit,
understand only
8-bit signals
32-bit etc. The
as all
the external
signals are 8-bit while the processor instructions are 16-bit. An
Analog
to Digital Converter, ADC, was used to perform the change
of the analog voltage to digital signal.
To interface
to the IBM
card was design and
These
two
PC system bus an
Input Output, I/O,
constructed providing 24 lines for
8-bits and
two 4-bit
address in the memory of
ports are
occupy
the PC. Each one of the
I/O use.
a certain
four ports can
be controlled by software and can be either input or output port.
Also the ports can
set to work in handshaking
mode by software.
All signals at the IBM PC system slot are explained.
Temperature, optical, displacement and other sensors were used
as
input sensors. The TRIAC
with zero voltage switching action,
the stepper motor, the DC motor, the relay and other devices were
used for output purpose.
By making combinations of the input sensors and output devices
different applications were achieved. 1) The control of the power
of a heater in accordance to the temperature of the
room and the
temperature outside the room that the heater is installed. 2) The
illumination of
the
power of
an incandescent lamp was
the lamp. This
project can
regulated by adjusting
also be
used as DATA
acquisition system.
The
ready
software was
made
Programming,
units
developed
and
OOP. The
in TURBO
pascal
PASCAL language
objects,
program is
graphic mode for displaying graphs.
friendly
in
using
Object
Oriented
user and
uses the
CHAPTER 1
A COMPUTER SYSTEM
1.1 General
2
1.2 Central Processing Unit . . . . . . . . . . . . . . . . . . . . . . . .
2
1 . 3 Memory .
4
III
It
.....
1.4 Peripherals
It
It
It
It
It
III
••
It
..
It
"
It
"
It
It
It
••
"
"
III
It
It
It
It
....
It
......
It
It
....
,.
It
"
,
....
It
It
..
.,
..
It
•
It
It
It
It
It
III
"
It
..
It
It
•
..
It
It
..
"
•
•
•
1.5 Software
CHAPTER 2
6
7
INTERFACING TO THE IBM PC
2.1 Introduction
It
•••
It
It
••
It
It
....
.,
....
It
•
It
It
••
"
"
...
III
It
•
,.
It
It
It
•
It
2.2 The IBM PC system slot . . . . . . . . . . . . . . . . . . . . . . . .
2 • 3 The 8255 PP I
It
It
•••
It
.........
It
.,
...
..
III
•
It
......
It
It
•
It
•
It
It
•
It
••
1
1
14
2.4 Parallel I/O ports design . . . . . . . . . . . . . . . . . . . . . 18
2.5 PCB design ..
2 6 Testing
It
CHAPTER 3
It
...
It
It
It" •••
••••
It
III
11
••
It.
.........
11
It
It
••
•••••
It
....
It. It. It".
It
•
It
•
It
•
It
It
•
III
It
•
It
..
It
It
•
"
••••
•
It
"
It
It
It
It
It
It
It
It
It
It
It
It
"
•••
It
It
22
23
ANALOG INPUT INTERFACE
3.1 General ......
It
.........
III
It
It
It
It
.......
26
3.2 Characteristics of ADC . . . . . . . . . . . . . . . . . . . . . . . . 26
3 3 Signals of ADC
It
.
It
•
It
"
It
..
It
It
.......
It
It
...
............
It
•
".
30
3.4 ADC Conversion technic's . . . . . . . . . . . . . . . . . . . . . . 31
3.4.1 Counter type .....
It
••
It
......
It
......
It
•
It
••
It
It
•
..
•
••
32
3.4.2 Dual slope ADC . . . . . . . . . . . . . . . . . . . . . . . . . • 33
3.4.3 Voltage to Frequency Converter type ..... 35
3.4.4 Successive approximation technic ........ 37
3.4.5 Flush type ADC . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3.4.6 Shaft encoder type . . . . . . . . . . . . . . . . . . . . . . 40
3.5 Design of the Analog input interfacing card ... 41
3.5.1 The ADC0804 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
3.5.2 Analog multiplexing .....•............... 44
3.5.3 Design of the circuit •.................. 45
3.6 Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
3.7 Conclusions .... " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
CHAPTER 4
INTERFACING SENSORS
4.1 Transducer and sensors . . . . . . . . . . . . . . . . . . . . . . . . 52
4.2 Characteristics of a measurement system . . . . . . . 52
4.2.1 Dynamic performance . . . . . . . . . . . . . . . . . . . . . 53
4.2.2 Static performance . . . . . . . . . . . . . . . . . . . . . . 54
4.3 Temperature sensors . . . . . . . . . . . . . . . . . . . . . . . . . . 55
4.3~1
Platinum resistance . . . . . . . . . . . . . . . . . . . . . 55
4.3" 2 Thermocouples . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
4.3.3 Thermistors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
4.3.4 Temperature measurement system . . . . . . . . . . 58
4.4 Optical sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
4.5 Displacement sensors . . . . . . . . . . . . . . . . . . . . . . . . . 69
4.6 Conclusions
CHAPTER 5
.f • • • • • • • • • • • • • , • • • • • • • • • • • • • • • • • •
71
INTERFACING OUTPUT DEVICES
5.1 General ." ...
I'
•••••••••••••
III
.....................
74
5.2 Interfacing a stepper motor . . . . . . . . . . . . . . . . . . . . 74
5.3 Interfacing a DC motor . . . . . . . . . . . . . . . . . . . . . . ".. 78
5.4 Relay control
..................................
5 . 5 TRIAC control
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
80
5.6 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
CHAPTER 6 APPLICATIONS
6.1 General ......
It
..
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
••
88
6.2 Temperature control . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
6.3 Illumination indication system . . . . . . . . . . . . . . . . . 90
CHAPTER 7 SOFTWARE
7.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
7.2 Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
.
7.3 Llsting
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . JOt'!. . .
APPENDIX A
DATA SHEETS