Applying fiberoptic data links to instrumentation by Michael Steven Beer

advertisement
Applying fiberoptic data links to instrumentation
by Michael Steven Beer
A thesis sumitted in partial fulfillment of the requirements for the degree of MASTER OF SCIENCE in
Electrical Engineering
Montana State University
© Copyright by Michael Steven Beer (1980)
Abstract:
The subject of this thesis is the application of a fiber optic data link for use in instrumentation
applications where conventional information transmission techniques cannot be used due to excessive
electrical noise. A technique was developed for converting a direct current voltage to a pulse string
whose frequency was proportional to the voltage and transmitting this pulse string over the data link.
This technique also allowed recovery of the information at the receiving end in digital form using a
microprocessor-based data acquisition system. As a demonstration of the validity of this technique,
sensors were constructed to enable use of the data link to measure alternating currents, direct currents,
and temperature. Mathematical transfer functions were developed for each of these sensors to aid the
microprocessor-based system in providing accurate measurements. STATEMENT OF PERMISSION TO COPY
In presenting th is thesis in p a rtia l fu lfillm e n t o f the require­
ments fo r an advanced degree at Montana State U n ive rsity, I agree"that
the Libra ry shall make i t fre e ly available fo r inspection.
I fu rth e r
agree that permission fo r extensive .copying of th is thesis fo r scholarly
purposes may be granted by my major professor, or, in his absence, by
the D irector o f L ib ra rie s.
I t is understood th a t any copying or pub­
lic a tio n o f th is thesis fo r fin a n c ia l gain shall not be allowed without
my w ritte n permission.
Si qnature
f
L z2l
APPLYING FIBEROPTIC DATA LINKS TO INSTRUMENTATION
by
MICHAEL STEVEN BEER
A thesis sumitted in p a rtia l fu lfillm e n t
of the requirements fo r the degree
of
MASTER OF SCIENCE
in
E lectrical Engineering
Approved:
Jr). a . ( f ?
Head, Major Department
Chairman^ Ex^mirpfng Comm^tfee
Graduate Dean
MONTANA STATE UNIVERSITY
Bozeman, Montana
July, 1980
iii
ACKNOWLEDGMENT
The development and application of the fib e ro p tic data lin k draws on
information learned through several other data acquisition projects
developed at Montana State U niversity.
The author extends appreciation
and thanks to Dr. Daniel N. March, who contributed the fib e ro p tics used
to build the data lin k , and Western Telecomputing Corporation, that has
provided assistance with hardware and it s support.
Of course, the author
is especially grateful to Dr. Donald K. Weaver fo r his assistance and
support of the pro je ct.
Michael S. Beer
iv
TABLE OF CONTENTS
Chapter '
Page
I.
INTRODUCTION ................................................................
I
II.
THE FIBEROPTIC DATA LINK .........................................
7
. The Fiberoptic Transmitter .....................................
The Fiberoptic Receiver ................................. ' ........
9
9
THE INTERFACE CIRCUITS AND TRANSDUCERS ................
14
The
■The
The
The
14
16
19
22
III.
IV.
Voltage-to-Frequency Converter ......................
Current Transducers ..........................................
R e c tifie r and F ilte r .'...•........... .....................■
Temperature Transducer ; ....................-.............
SOFTWARE DEVELOPMENT.......... .....................................
24
Software Routines -----•............. .................................
The Coordinating Program..............
The Hardware Drivers .................' .............................
The Teletype Driver ............................................
The Frequency Board Driver ...............................
The A -to -D Converter Driver ..............................
25
28
31
31
33
35
V. EXPERIMENTAL RESULTS ...................................................
VI. SUMMARY .............................................
.
37
49
BIBLIOGRAPHY ............. ....................'............................
55
APPENDIX ..................
58
Appendix A: ................................................................
Analysis of F ilte r/R e c tifie r Stage..
59
60
. ■Appendix B: .....................■............: .............................
Interfacing PLM/80 and Assembly
Language Programs ......... .;............ .......
63
Appendix C: .................................
Program fo r Determining Minimum
Software Delay .....................................
65
64
66
V
Appendix D: ............. ..................................................
Coordinating Program PLM/89 L istin g .
Coordinating Program PL'M/80 Listing
with Assembly Mnemonics ........'............
68
69
Appendix E: ........................................ .......................
Parameter Passing Specifications
■ fo r Teletype Drivers ..........................
Teletype Drivers PLM/80 Listing ----Teletype Drivers Assembly Listin g ..
Teletype Drivers PLM/80 Listing
with AssemblyMnemonics ................
88
Appendix F: .........................
Parameter Passing Specifications
fo r Frequency BoardDrivers ................
Frequency Board Drivers Assembly
L isting .............................
74
89
91
96.
100
113
114
116
Appendix G: ........................................
123
Parameter Passing Specifications
' fo r'A -to -D Drivers ............................. 124
A -to -D Drivers - Assembly L is t in g -----■ 125
'
vi
• LIST OF TABLES
Table
Page
1.
.Hall E ffect Device Coefficients ..................................
41
2.
Current Transformer Coefficients ..............................
42
3.
Temperature Sensor C oefficients ................................
4.
Coefficients fo r Voltage-to-Frequency Converter..
44
48
vi i
LIST OF FIGURES
Figure
Page
1.
System Signal Flow ................... ............................................
2.
Transmitter ......................................... .......................................
10
3.
Fiberoptic R e ce ive r...
11
4.
Voltage-to-Frequency
C o nve rte r...........................................
15
5.
R e c tifie r/F iT te r ..................... .............................................. .
21
6.
Temperature S ensor.
23
7.
Software/Hardware Interface ................
26.
8.
WTC 520 Board ........................ .......................................... ■........
34
9.
Transfer Function fo r Hall E ffect Device &Data Link . . . .
40
10.
Transfer Function fo r Current Transformer & Data Link . . .
40
11.
Transfer Function fo r Temperature Sensor............. ...............
43
12.
Transfer Function fo r Voltage-to-FrequencyConverter . . . .
47-
1A.
R e c tifie r/Fi I te r ..................................................................... . "61
.................. .
...................
4
v iii
ABSTRACT
.
"
The subject of th is thesis is the 'a pp lication of a fib e r optic
data lin k fo r use in instrumentation applications where conventional
information transmission techniques cannot be used due to excessive
e le c tric a l noise. A technique was developed fo r converting a d ire ct
current voltage to a pulse s trin g whose frequency was proportional to
the voltage and transm itting th is pulse strin g over the data lin k .
This technique also allowed recovery of the information at the receiv­
ing end in d ig ita l form using a microprocessor-based data acquisition
system. As a demonstration o f the v a lid ity of th is technique, sensors
were constructed to enable use of the data lin k to measure alternating
currents, d ire c t currents, and temperature. Mathematical transfer
functions were developed fo r each o f these sensors to aid the micro­
processor-based system in providing accurate measurements.
CHAPTER I
This thesis describes" a research a c tiv ity directed towards apply­
ing fib e ro p tic data lin ks to instrumentation.
The in te n t o f this
thesis is to describe the equipment necessary to achieve th is , and
v e rify th a t the instrumentation/data lin k combination operates
properly.
There w ill be no attempt to compare th is method with other
instrumentation techniques, and no e ffo rts w ill be made to optimize
the results presented here with respect to a certain set of conditions.
The techniques advanced in th is thesis have application in areas where
high voltages and electromagnetic interference make e le c tric a l methods
o f information transmission impossible or im p ractica l.
Fiberoptic data lin ks have been much publicized by Bell Labora­
to rie s because of the large quantity of information th a t they can.
carry.
Fiberoptics have useful properties other than large bandwidth.
The properties o f fib e ro p tics that th is research exploits involve
e le c tric a l noise immunity and e le c tric a l is o la tio n .
Another benefit
th a t the methods developed have is th a t they d ig ita lly encode the
inform ation.that is to be transm itted.
As a consequence, these methods
work p a rtic u la rly well in , but are not lim ite d to , systems that employ
microprocessors and other d ig ita l equipment.
Fiberoptics involves the transmission of signals using v is ib le
and near-visible lig h t in transparent waveguides.
Due to the short
wave-length o f lig h t re la tiv e to the other forms of electromagnetic
2
ra d ia tio n , these waveguides are much smaller than conventional wave­
guides.
Typical fib e ro p tic fib e rs have cross-sections approaching
that of a human h a ir.
Because of th is , the cables encasing the fib e rs
are small diameter (1/4") and very fle x ib le .
The fib e ro p tics fibe rs
themselves are constructed o f e ith e r glasses or p la s tic s , with glasses
being preferred over plastics due to th e ir lower attenuation.
The
fib e rs themselves are usually encased in several' layers o f p la s tic to
form the fib e ro p tic cable.
Since both glass and p la s tic are excellent
in su la to rs, the resu ltin g fib e ro p tic cable provides excellent e le c tr i­
cal is o la tio n between transm itter and receiver.
Since lig h t waves are
used rather than e le c tric waves, the signals in the fib e ro p tics are
immune to those type of interference that degrade e le c tric a l signals.
Information can be sent through fib e ro p tics in e ith e r analog or
d ig ita l form.
I t was decided to use d ig ita l encoding in th is project.
The form of d ig ita l encoding chosen was pulse modulation, in which the
frequency o f the pulse s trin g coming out of the an alog-to-digital
(A-to-D) converter is nearly a lin e a r function of the input voltage.
This type of A-to-D conversion w ill be referred to as voltage-to fre - \
■
quency conversion and the A-to-D converter w ill be referred to as a
voltage-to-frequency converter throughout the rest of th is thesis.
The instrumentation technique advanced in th is thesis involves
converting the quantity to be measured to a voltage.
This voltage is
then applied to a voltage-to-frequency converter and the pulse strin g
3
from th is converter is used to turn a lig h t em itting diode (LED) on
and o ff.
cable.
The lig h t from th is LED is then launched down the fib e ro p tic
At the receiving end of the cable, the lig h t signal is trans­
formed in to an e le c tric a l signal that conforms to the voltage levels
established fo r Transistor Transistor Logic (TTL) c irc u its .
This sig­
n a l's frequency is then proportional to the quantity i n i t i a l l y measured,
the exact p ro p o rtio n a lity c o e ffic ie n t(s ) being dependent on the trans­
fe r function of the system as a whole.
This type of system is dia­
grammed in Figure I.
Two types of sensors were developed to interface with the fib e roptics data lin k .
One type of sensor measures temperature and the
other type measures e le c tric a l current.
The temperature sensor is an
integrated c ir c u it that produces a current proportional to the temper­
ature of the device.
Additional c ir c u itr y changes th is cu rre n t.in to a
voltage and allows am p lification and o ffs e t to be set so that the
temperature range o f in te re s t can correspond to the voltage range of
the voltage-to-frequency. converter.
The current sensors developed fo r the data lin k evolved along two
lines of thought.
One lin e was aimed at measuring current levels in
conventional A.C. lines and the other lin e was aimed at measuring
currents that could be e ith e r D.C. or A.C.
The f i r s t sensor was devel­
oped to measure these A.C. and D.C. currents.
I t is based on a Hall
e ffe c t device and generates an output voltage proportional to the in -
FIBEROPTIC
FREQUENCY
SENSOR
SIGNAL
CONVERSION
PULSES
LIGHT PULSES
FIBEROPTIC
RECEIVER
Figure I
TTL
SIGNAL
FREQUENCY
COUNTER
System Signal Flow
TRANSMITTER
5
stantaneous in te n s ity of the magnetic fie ld surrounding the conductor
and the excita tion current-supplied to the Hall e ffe c t device.
The
second current sensor is based around a conventional current tra n sfo r­
mer s im ila r to those used in most power applications.
This sensor is ,
of course, lim ite d to A.C. currents with frequencies near 60 Hz.
The
current transformer outputs a current proportional to the.A.C. current
being measured.
This A.C. current is passed through a re s is to r whose
size was chosen so that the voltage drop generated corresponds'to the
voltage produced by the Hall e ffe c t device under s im ila r conditions.
The signal from e ith e r current sensor is processed by c irc u itry that
re c tifie s and am plifies the signal producing an output that is com­
patible with the voltage-to-frequency converter. •
No matter which sensor is used, the frequency of the voltage-tofrequency converter has to be determined.
A microprocessor based data
acquisition system (DAS) was used to determine the frequency of the
pulse s trin g generated by the fib e ro p tics data lin k receiver.
The
method used involved counting the number of pulses from the receiver
over a known period of time.
a gated counter.
This method is generally referred to as
The gated counter is controlled by a program that
the DAS microprocessor executes.
The program can d ire c t the results to
be printed on an output device or saved in memory.
'
This thesis describes the construction of the fib e ro p tic data
lin k , the construction o f the voltage-to-frequency converter, the con­
6
s tr u c tion o f temperature and current transducers compatible with th is
equipments and i t describes the software used to control and calibrate
the system=
I
CHAPTER I I
THE FIBEROPTIC DATA LINK
The fib e ro p tic
data lin k consists of a transm itter and receiver
separated by 100 meters of Valtec PClO FIBERdata s in g le -fib e r fib e ro p tic
cable.
This data lin k is not a high speed data lin k , although the speed .
lim ita tio n is in the electronics and not the fib e ro p tic s .
I t was
decided to design the lin k to handle a square wave at a maximum frequency
of 100 kHz.
The lin k had to also be able to perform down to D.C.
conditions.
These specifications were arrived at a fte r considering the
frequency ranges available in hybrid and monolithic voltage-to-frequency
converters.
Since these specifications were set, several commercially
available data lin ks have come on the market with v ir tu a lly identical
specifications.
This frequency range appears to be the industry standard
fo r low data rate fib e ro p tic lin ks.
The spe cifica tion that the lin k be capable of operating down to
D.C. completely precludes the use of capacitively coupled am plifiers at
any point in the transm itter or receiver.
I t was also decided from a
point of size, power consumption and operating environment that semi­
conductor sources and detectors would be used in the data lin k .
The lig h t sources chosen were conventional LEDs.
These sources
are by fa r the easiest sources to bias, operate and alig n.
Another
fa cto r in th is selection was the large amount of work that has gone
in to improving LED r e lia b ilit y and operating li f e .
LEDs are also
much easier to obtain than other types of solid em itters.
The main
8
disadvantage is th a t the devices require large amounts o f power re la tiv e
to the amount of power coupled into the optical fib e r.
This is a func­
tio n of the broad area over which the lig h t is emitted from the LED
package and the small area that the terminated fib e r optic has.
This
in e ffic ie n c y is a tra d e -o ff th a t must be accepted to keep the ease of
alignment a ttrib u te .
The sources used in th is data lin k nominally con­
sume 100 m illiw a tts of power and the author has calculated that the
amount coupled in to the fib e r is on the order of a few microwatts.
Both
red and infrared sources were used in the data lin k .
The detectors chosen were Positive In trin s ic Negative (PIN).diodes.
These devices are re a d ily available and operate at much lower bias
voltages than avalanche type detectors.
This is due to th e ir internal
construction which more e ffe c tiv e ly u tiliz e s the voltages generated in
the space-charge layer (11).
The amount of current developed by one of
these diodes in it s reverse operating mode is I i nearly dependent on the
incident lig h t.
This is true over the voltage range th a t extends from
the reverse breakdown voltage of the diode to the point at which the
generated current and the input resistance of the f i r s t a m p lifie r pro­
duce enough voltage to remove the diode's reverse bias.
There was. also the choice .between single fib e r lig h t guides and
m ultiple fib e r lig h t guides.
The m ultiple fib e r lig h t guides are un­
doubtedly easier to use in a data lin k since they carry more lig h t than
single fib e r guides, but they are more costly and also more d if f ic u lt
9
to properly terminate.
fo r th is project.
Because of th is , single fib e r cable was chosen
Again, i t appears from advertising in electronics
magazines that the choice of single fib e r cables over m u ltifib e r cables
has been made by nearly every data lin k manufacturer.
The Fiberoptic Transmitter
The schematic fo r the transm itter fo r the v is ib le LED was provided
by Valtec, the fib e ro p tic cable manufacturer.
This was modified
s lig h tly fo r the infrared. LED which required a d iffe re n t drive current
from the red LED.
These c irc u its are shown in Figure 2.
The NAND gate
provides hysteresis and drive current fo r the tra n s is to r, which can
supply the higher current required by the. lig h t em itting diode.
The
d iffe re n t LED's used are shown along with the required current lim it ­
ing resisto rs.
The tran sm itte r has worked well from the beginning of
the evaluation,.and th is c ir c u it has not been changed.
The Fiberoptic Receiver
This c ir c u it was the most d i f f ic u lt of a ll of the c irc u its to
design.
The chief reason fo r th is was the very small signal produced
by the PIN diodes.
The fi.beroptics cable manufacturer had provided a
schematic fo r a receiver with the cable that was used in the project.
This receiver was constructed and i t did work, but i t was very sensitive
to ju s t about any change in operating conditions.
Most of these pro-
10
+ 5V
1/4
TTL
7 400
2N4124
IN
D1
Red
F LV104
R1
33
In f r a r e d
M FOEIOO
82
7
OH MS
Figure 2 Transmitter
blems were found to be coupling problems between the power supply and
various parts of the c ir c u it.
To avoid these problems, a more con­
servative design was adopted.
This design is presented in Figure 3.
Great care was taken to not only decouple the power supply from the
operational am p lifie r supplies, but to also decouple the various parts
of the c ir c u it from one another.
The input signal is very small, having been measured at .5 micro­
amperes fo r the red LED/detector p a ir.
The input resistance of the
op amp Al is on the order of 70 megohms, so v ir tu a lly a ll of this
current passes through the 510 kohm re s is to r.
An input resistance th is
large may be c ritic iz e d as introducing thermal noise and converting any
1k
SDO 761121
+ 15V
MFO D100
2N4124
6
LM30
LM318
7.2k
LM318
? 10k
A /W
Figure 3
Fiberoptic Receiver
12
stray currents in to voltage drops, but as long as th is introduced
noise does not create spurious lo gic tra n sitio n s at the output, i t is a
.small price to pay fo r decreasing the amount of voltage gain the op
amps must supply.
The op amp Al must have very small o ffse t current and
bias current due to the already mentioned small sig n a l.
The 1M308 op
amp selected fo r th is task meets these requirements easily with .4nA
and 3nA respectively (8).
The voltage gain was kept low in this stage
since the LM308 does not have a gain-bandwidth product much better
than I MHz and the c ir c u it must have an overall bandwidth of 100 kHz.
Once the signal has been amplified by the LM308, there is s u ffic ie n t
drive current, and the bias and o ffs e t current specifications can be
relaxed somewhat.
used.
For the next two am p lifie rs, LM308 op amps were
These am plifiers have a gain-bandwidth product o f . 15 MHz (8),
and can easily be pushed to higher voltage gains than the LM308.
The
la s t of these two am plifiers has a tpimpot in the feedback loop to
provide an adjustable gain.
This is to compensate fo r variable input
levels caused by d iffe re n t detector/source pairs or losses due to
variable fib e ro p tic lengths.
output tra n s is to r.
The fin a l stage of the receiver is the .
This tra n s is to r accomplishes two ,things.
I t not
only provides some wave shaping that removes noise introduced in the
am plification and cleans up the ris in g and fa llin g edges of the wave­
form, but provides a signal inversion to make up fo r the inversion
introduced by the fib e ro p tics transm itter.
13
There were two source detector pairs that were used in the data
I ink.
The p a ir that operates in the red end of the spectrum is a
Spectronics 500761121' PIN diode and a F airchild FLVl04 LED.
the pair supplied by the fib e ro p tic cable manufacturer.
detector/source pair operates at infrared wavelengths.
This was
The other
These are both
Motorola devices and the part numbers are MFODlOO and MF0E200 respect­
iv e ly .
The infrared p a ir gives a s lig h tly stronger s ig n a l, which is
probably due.to the higher semiconductor e fficie n cy at th is wavelength
(11). - I t is in te re stin g to note that e ith e r detector w ill -work with
eith er LED, but i t is often necessary to readjust the gain in the
receiver to get maximum performance when th is is done.
I f the detector
and LED are matched, there is no need to readjust the gain when going
from one detector/source pair to the other.
CHAPTER I I I
THE INTERFACE CIRCUITS AND TRANSDUCERS
Once the data lin k was operating, interface c irc u itry was con­
structed to allow generation of a pulse tra in from an input voltage.
This pulse tra in could then be fed in to the fib e ro p tic data lin k .
The
input voltage was to be derived from some physical quantity that a
transducer could change into an e le c tric a l sig n a l.
This e le c tric a l
signal had to be transformed in to a voltage, since the only A-to-D
conversion available is a voltage-to-frequency converter.
Provisions
had to be made to scale and o ffs e t th is voltage so that the maximum
output of the transducer would correspond to the maximum allowed input
voltage to the voltage-to-frequency converter.
The voltage-to-frequency converter w ill be the f i r s t interface
c ir c u it discussed.
The description of the current transducers and
th e ir interface c irc u itry w ill fo llo w , and the chapter w ill close on a
s im ila r description fo r the temperature transducer.
The Voltage-to-Frequency Converter
The voltage-to-frequency converter used fo r the analog-to-digital
conversion is based around an Analog Devices AD527 m onolithic voltageto-frequency converter ( I) .
This c ir c u it was selected over other in te ­
grated c irc u its because of the small number of additional components
necsssary fo r operation (6 additional components), its good s ta b ility
and lin e a rity , and the good te s t and application documentation provided
15
provided by the manufacturer.
A monolithic voltage-to frequency con­
verter was chosen over a hybrid or discrete component device.
Inte­
grated c irc u its recently introduced on the market are very much less
expensive in terms of cost and power consumption than e ith e r of the
other types, at very l i t t l e s a c rific e in performance.
fo r the c ir c u it used is given in Figure 4.
The schematic
This c ir c u it is based on
c ir c u it suggestions provided by Analog Devices.
+ 5V
Apflsf--- V v V —
2 AD537
.01 u f
10
Figure 4
5
Voltage-to-Frequency Converter
The internal operation of the device is not dram atically d iffe re n t
from other voltage-to-frequency converters.
A current source controlled
by the input voltage feeds charge.into an integrator composed of an
external capacitor and an internal operational a m p lifie r.
The voltage
16
developed across the capacitor is compared to a reference voltage
derived on the chip. . When th is voltage exceeds the reference voltage,
an astable m u ltiv ib ra to r is triggered'.
The output from the astable
m u ltiv ib ra to r in turn drives an output a m p lifie r which provides higher
d riv e r current.
The frequency of operation is determined by the size
of the external capacitor and also the size of the external resistors
used to adjust the magnitude of the current from the voltage-controlled
current source.
■
The lin e a r ity and temperature s t a b ility of the c ir c u it is greatly
dependent on the q u a lity of the external resistors and capacitor.
These
components must have very low temperature co e fficie n ts and the timing
capacitor must have a very low e ffe c tiv e series resistance i f the c ir ­
c u it is to meet the manufacturer's specifications.
The Current Transducers
Two types of transducers were used to make the current level
measurements on a conductor.
One of these transducers was an Ohio
Semitronics CT50L DC to 5 kiloh ertz transducer (9).
based on the well known Hall Effect (4).
This transducer is
Unlike conventional current
transformers which depend on the change of the current and a change in
it s accompanying magnetic fie ld , th is transducer d ire c tly measures the
in te n s ity of the magnetic fie ld .
Thus, it s time response is not lim ite d
by the inductance present in a sensing c o il, but only by the semi­
17
conductor transport processes and the properties of the material used to
concentrate the magnetic fie ld around the. Hall Effect sensor.
This en­
ables the transducer to have a response lin e a r to w ithin „5% over a
range from D.C. to 5 KHz.
The upper figu re is a function of th is p a rt­
ic u la r Hal I E ffect device and not the Hall Effect it s e lf .
There are two disadvantages to th is type of transducer.
The f i r s t
disadvantage is that i t must be supplied with a constant excitation
current (nominally .1 A).
Variations in th is excitation current show
up as unwanted variations in the transducer output.
The second dis­
advantage is that the Hall Effect device used is a semiconductor device
and the m o b ility of the charge carriers in the semiconductor is dependent
on the material temperature.
Since the voltage produced by the Hall
E ffect is dependent on the m o b ility of the charge ca rrie rs , variations .
in temperature may also cause unwanted output v a ria tio n s ..
Neither of these disadvantages is insurmountable.
current can be derived from a variety of sources.
The excitation
Possible sources
are batteries, power supplies, or in the case of measuring high A.C.
current, the excita tio n current could be transformed rig h t o ff the
power lin e it s e lf .
easily solved.
The problem of temperature dependence is also
Since the data is taken in d ig ita l form, the temper­
ature dependence can be removed mathematically.
Methods to do th is
are well known (3) and usually consist of. f it t in g experimentally de­
rived error data to a mathematical function.
This function is eith e r
18
d ire c tly evaluated by the microprocessor or is b u ilt into a lookup
table that the microprocessor can reference.
Both of these error
removal methods require that the temperature of the transducer be
known.
Temperature measuring methods are discussed la te r in this
section.
The second transducer used was a conventional current transformer,
s p e c ific a lly a Westinghouse Current Transformer type CMS.
This is a
transformer sim ila r to those presently used by the power companies in
determining current levels in transmission equipment.
The only m odifi­
cation required is the insertion of a small shunt resistance across
the transformer output terminals.
This shunt re s is to r (.024 ohms) was
chosen so that the voltage drop across i t would be compatible with
the output voltage developed by the Hall E ffect device.
Both transducers are operated so that a current of 50 amps causes
a 30 m illiv o lt peak output.
mental convenience.
The 50 amp fig u re was chosen fo r experi­
Hal I Effect transducers are available to measure
currents up to 8000 amperes (9).
Current transformers are available
fo r a s im ila r range (15).
A 50 amp A.C. transmission lin e was simulated by passing a 5
amp A.C. current through a ten turn co il wound through the active
area of each transducer.
An A.C. current source consisting of.a
variable transformer and a I ohm load resistance provided the current to
the transducers.
The current level in the "transmission lin e " was
19
then measured by recording the voltage dropped across the one ohm
load and m ultiplying by ten.
The R e c tifie r and F ilte r
The signal coming from the current transducers has to be re c tifie d
and am plified before the signal could be used by the voitage-to-frequency
converter, which requires a D.C. input voltage.
Since the current trans­
ducers have a 30 m illiv o lt peak output, d ire c t re c tific a tio n by a diode
bridge of any sort w ill introduce an e rro r.
Suppose th a t the
signal is f i r s t am plified to 10 volts peak p rio r to re c tify in g .
If
the signal passes .through a f u ll wave bridge r e c t if ie r , two forward
diode voltage drops are subtracted from the signal.
For s ilic o n diodes
th is translates to somewhere in the v ic in ity of 1.2 to 1.5 volts sub­
tracted from the peak voltage.
For voltages less than peak, the error
w ill be less than th is , but i t w ill be a nonlinear proportion of the
maximum error due to the nonlinear transfer ch a ra cte ristic of the diodes'.
The 1.5 v o lt maximum error corresponds to a 15% error, which is much to
high fo r the accuracy desired.
Amplifying the peak output voltage to
100 volts would reduce the percentage error by a fa cto r of 10, but
these higher voltages have gotten out of the voltage range of most
common integrated c ir c u it am p lifiers.
This argument precludes using the
"brute force" methods of re c tific a tio n common to power supplies.
The
solution to th is problem is to use a r e c t if ie r that is configured to
20
u tiliz e the diodes only to block the portion of the signal that is not
wanted rather than block and pass the waveform.
The c ir c u it in Fig­
ure 5 is based around a c ir c u it idea from a National Semiconductor
application note (7).
This c ir c u it not only provides f u ll wave re c ti­
fic a tio n , but also contains a portion to smooth the re c tifie d wave­
form and amplify the resulting D.C. voltage to match the voltage range
of the output 'to the voltage range of the voltage-to-frequency conver­
te r.
Although th is c ir c u it sub stan tially a lte rs A.C. waveforms, D.C.
waveforms are ju s t amplified.and smoothed to an average D.C. level.
The c ir c u it operation and a derivation of it s transfer function are
provided in Appendix A.
The schematic fo r the am p lifie r and precision r e c t if ie r is pro­
vided in the two parts of Figure 5.
One of these parts depicts the
active c ir c u itr y , while the other part depicts the power supply de­
coupling scheme (2).
This decoupling, scheme may seem rather elaborate
at f i r s t , but the accuracy of the e n tire instrument depends on the
proper functioning of th is one c ir c u it.
The c ir c u it w ill be operating
in close proxim ity to the voltage-to-frequency converter which can
introduce switching spikes on the ground and power lines of the
r e c t if ie r .
The decoupling w ill help to absorb these spikes before
they can get in to the op amp's c irc u itry .
In the case of an appli­
cation such as an A.C. current monitor, th is c irc u itry would be
operating on a power lin e and be to ta lly immersed in the 60 cycle
5a Active Part
A l - A4
LM 318
1N4148
100k
-W V 2 0 k > IOpf Z l O k '
in I k
A3
Al 6
6
V 01 J L
DCout
A2
A4
6
6
5b Decoupling Part
—-----
R z 5 O o h ms
C I = J yW f
C2= 1 0 0 pf
+ 12V
-12V
J L C2
Figure 5
R e c tifie r/F ilte r
22
electromagnetic fie ld . o f the power lin e .
These fie ld s may induce
noise in the c ir c u it at the 60 Hz lin e frequency.
This noise is
to ta lly indistinguishable from a va lid signal i f i t gets onto either
the input or the output of any of the am p lifiers, so i t is essential
that i t be kept away from the active-elements at a ll costs.
The Temperature Transducer
Since operation o f the Hall Effect Device may require an accurate
knowledge of the temperature, a temperature transducer would be re­
quired.
Several d iffe re n t integrated c ir c u it transducers were ac­
quired, connected to whatever supporting c irc u itry was required, and
th is combination tested in an environmental chamber.
On the basis of
these tests, the Analog Devices AD590 two terminal IC temperature
transducer was selected as the transducer to be used ( I ) .
The para­
meters used in selecting th is transducer were ease of use with the
voltage-to-frequency converter and accuracy.
The temperature transducer has only two types of errors in the
current output that is the response to temperature.
o ffs e t errors and nonlinearity errors.
th is device available.
These errors are
There are several grades of
In general, a more expensive grade has a
smaller o ffs e t voltage error than a less expensive grade.. The non­
lin e a r ity errors are the same from one grade to the next.
The c ir c u it that th-e AD590 is used in is shown in Figure 6.
23
+ 15V
AD590
1/4 L M 324
2 .5 K
Figure 6 Temperature Sensor
There are two variable resistors in the schematic.
is used to remove the o ffs e t inherent in the device.
The 5k resisto r
The IOk v a ri­
able re s is to r in the op amp feedback loop is provided to match the
output voltage produced by the maximum anticipated temperature to
the maximum input voltage that the voltage-to-frequency converter is
set fo r.
This allows the desired temperature range to be spread
over a larger fra c tio n of the voltage-to-frequency converter's
operating range.
CHAPTER IV
SOFTWARE .DEVELOPMENT
Before discussing -the software to control the hardware-that has
been developed, i t is necessary to describe the hardware environment
in which the software operates.
This environment consists of four pieces
of equipment, a ll functioning as one microprocessor-based data acquisi­
tio n system.
The data acquisition system need not be th is complex, this
organization p rim a rily re fle c ts the equipment available fo r th is project.
The equipment consists of an INTEL PR0MPT80 microcomputer, a Western
Telecomputing Corporation WTC-800 computer system, a WTC-700 data acquisi­
tion system contains a four channel A-to-D converter (used to calibrate
the data lin k instrum entation), a four channel event counter and the
c o n tro lle r card.that is connected to the WTC-800 system.
This co n tro lle r
card provides a ll of the bus timing and addressing fo r the WTC-700
system.
This system has a bus structure that is markedly d iffe re n t from
the bus used in the WTC-800 system.
The WTC-700 card cage contains
slots fo r the c o n tro lle r card (already mentioned), two power supply
cards, and 16 slots fo r data acquisition cards.
Each of these slots
is separately addressed, so the position of a specific card in the
bus determines the software address of the card. Each of the cards in
.
th is system has as its output an ASCII strin g representing the quantity
measured.
The c o n tro lle r card enables th is string to be read o ff one
byte at a time.
25
Software Routines
The software w ritte n fo r th is research project consists of two basic
types of programs.
These are the programs that interface d ire c tly with
the hardware (called hardware drivers), and the program that coordinates
these interface programs.
This modular program ,structure (6) and how
i t interfaces with the hardware is illu s tra te d in Figure 7.
This type of structure was chosen fo r its f le x ib ilit y .
I f the
hardware/software system is to do a d iffe re n t task, the hardware drivers
do not need to be changed.
The coordinating program is the only module
that has to be altered, and then most of the changes w ill only be in the
order that the supporting modules are called by the coordinating program.
Another advantage of th is type of structure from the programmer's pointof-view is that the programmer is not constrained to any one programming
language.
Routines that lend themselves to reg ister manipulation, or
that must execute very ra p id ly may be w ritte n in assembly language.
Routines that involve data processing may be w ritten in .a higher level
language that allows arrays and/or data structures ( i . e., BASIC, PLM/80
or PASCAL).
Routines th a t involve mathematical processing may be
w ritten in a formula oriented language such as FORTRAN or ALGOL.
The routines presented in th is thesis are w ritten in a combination
o f PLM/80 and INTEL 8080 assembly language.
The choice of a certain
language fo r one of the routines re fle c ts not only the above mentioned
considerations, but also the fa ct that at the beginning of the project
C O O R D IN A T IN G PROGRAM
TELETYPE
DRIVER
DRIVER
COUNTER
INTERFACE
DRIVER
PROGRAMS
rv>
TELETYPE
OPERATOR
Figure 7
A TO D
FREQUENCY
CONVERTER
COUNTER
ANALOG
FREQUENCY
SIGNAL
INPUT
Software/Hardware Interface
HARDWARE
SYSTEM
I/O
27
assembly language was the only language resident in the MDS 230 software
development system used to develop a ll the software in th is project.
The author also recognizes that the reader of this thesis may not have
access to a PLM/80 compiler or be fa m ilia r with the PLM/80 syntax.
Hence,' a ll PLM/80 routines are presented in the appendix in two forms.
The f i r s t of these forms is a lis tin g of the PLM/80 source code.
The
second form is a lis tin g of the same source code with the compiler
generated assembly language mnemonics included.
Appendix B also contains
a description of how PLM/80 and assembly language programs are in te r­
faced.
This part of the appendix
should make the reg ister and stack
manipulation used p rio r to and a fte r ca lls easier to understand.
The
program lis tin g s are contained in appendices D through G.
The software routines fo r th is project must be able to:
(a)
receive input from the operator as to what sensor(.s)
to read and when to read them
(b)
read the sensors
(c)
process the readings
■ (d)
report the results to the operator
These requirements demand that the coordinating program be able to
interface with drivers fo r the follow ing hardware:
(a)
A teletype
(b)
The frequency counter connected with the fib e r optics
data lin k
(c)
An A -to -D converter (fo r ca lib ra tio n only)
Before discussing in dividu al hardware drivers, the operation and
28
construction of the coordination program w ill be considered.
The Coordinating Program
This program f i r s t interrogates the user to set up parameters
that determine the in it ia liz a tio n of the frequency, counter, the num­
ber of times the readings w ill be taken, and the time delay between
the readings.
The program checks the in itia liz a tio n values provided
by the operator in two ways., The values are f i r s t checked to see i f
they correspond to the format given in the interrogation message.
I f the values pass th is f i r s t te s t, the values are converted from
the ASCII strings that came from the teletype to either binary
numbers (fo r the delay and re p e titio n parameters), or binary coded
decimal (BCD) numbers (fo r the counter in itia liz a tio n parameter).
The magnitudes of the binary numbers are checked to insure that they
f a ll w ithin the range prescribed by the interrogation message.
It
is not necessary to do th is fo r the BCD numbers since i f the input
number s trin g passes the f i r s t te s t, i t w ill f a ll w ithin the proper
range.
Should any of these values f a il eith er of these te sts, the
appropriate interrogation message is repeated u n til the operator can
provide a 'satisfa cto ry response.
in th is program.
There is only one assumption made
I t is assumed that the operator w ill enter numbers
on the teletype and not some other character.
The program w ill func­
tio n should characters other than numbers be supplied, but no error
29
message w ill be generated and the results w ill in general be d iffe re n t
from those anticipated.
Once the in it iliz a t io n parameters have been set, .the coordi­
nating program w ill ca ll the hardware drivers in the proper order to
read the sensor and p rin t the results on the teletype.
The program
then enters a software timing loop to generate a delay between read­
ings.
The duration of th is timing loop was one of the parameters
specified in the in it iliz a t io n sequence.
When this loop times out,
the program w ill make another reading i f i t has not completed the
specified number of readings.. When the program.has finished these
readings, i t re-enters the in itia liz a tio n sequence and waits fo r fu r­
ther operator input.
At th is point, i t is necessary to make some additional comments
on the actual time delay between readings of the frequency counter.
This delay is determined by three factors:
(1)
The length of time the A -to -D converter requires to make a
conversion. This also includes delays in the accompanying
software routines.
(2)
The length of time required to p rin t out or store the re­
sults of a conversion.
(3)
The delay introduced by the software controlled timing loops
The user has very l i t t l e control over the f i r s t of these factors.
delay caused by the second factor can be minimized, and the delay
caused by the th ird fa cto r is completely controllable.
The
30
The delay caused by the A-to-D conversion is d ire c tly propor­
tio n a l to the number placed in counter zero to specify the length
of time counter one downcounts.
clock rate fed in to counter zero.
The delay is also dependent on the
The hardware configuration chosen
fo r the WTC-520A board gives a clock period of 25.6 microseconds.
At th is clock rate, i f counter zero is in itia liz e d with a count of
8200, counter one w ill contain a count corresponding to 1/4 the actual
frequency of the incoming pulse s trin g .
These two factors imply that
the length of time required fo r one conversion is .21 second.
If
there were no other appreciable delays in the system, the maximum
sampling rate would.then be approximately 4.76 conversions per second.
When the delays caused by the teletype are accounted fo r, this
rate drops dram atically.
I f the teletype does no more than p rin t out
the four d ig its of the conversion, a carriage return and a lin e feed,
then the to ta l delay is .81 second and the rate is reduced to 1.235
conversions/second.
I t is quite lik e ly that more information than
th is would be printed on the teletype, with a corresponding reduction
in sampling rate.
The maximum sampling rate of 4.76 conversions per second could
be very nearly approached if.th e data were stored d ire c tly in memory
instead of being immediately printed on the teletype.
I t was assumed
in calculating the above sampling rate that the time required by the
software is ne glig ible compared to the hardware time..
A routine to
31
place the data d ire c tly in memory would presumably w ait in a loop
u n til the conversion was completed, read the appropriate counter,
store the BCD information in memory, store a data de lim iter in memory,
check to see i f the counter has been read the required number of times
and, i f not, begin another conversion and jump to the wait loop.
portion of code to do ju s t th is is presented in Appendix C.
A
This
routine has not actu ally been run on the DAS, as i t ' s purpose is
merely to illu s tr a te a point.
This point is to provide an idea of
the length of time a s im ila r program would require to store the in fo r­
mation in memory, and see i f th is time is s ig n ific a n t compared to the
hardware conversion time.
Each pass through th is routine takes a maximum of 220 clock
cycles.
With a clock rate of 2 MHz, th is is an execution time of:
220 x 1/(2 x TO6) = .11 x IO '3 sec
Since th e 'A -to -D conversion time alone is 210 x 10
tional processing time is re la tiv e ly inconsequential.
sec., th is addi­
This example
ju s tifie s the e a rlie r assumption that the time consumed in the hard­
ware in te rfacin g routines is not s ig n ific a n t compared to the conversion
time.
The Hardware Drivers
Now th a t the overall operation of the coordinating program is
understood, the program modules that the coordinating program in te r­
32
faces to w ill be considered.
Details on interfacing software to
these routines and the lis tin g s of the routines are contained in the
Appendices D through G.
The Teletype D river.
system.
The teletype is the main I/O device in the
Contained in the PROMPT 80 computer used in th is project is
an INTEL 8251 Universal Synchronous/Asynchronous Receiver/Transmitter
(USART) (5) and associated c irc u itry to drive a teletype on 20 ma.
current loops.
Al I of the communications to and from the teletype are
done via th is USART.
input/output ports.
The USART appears to the microprocessor as two
The port at address 236 serves as the port through
which the characters are transmitted to and from the teletype.
These
routines are derived from a set of assembly language routines prepared
e a rlie r by L. K. Smith and D. K. Weaver (10).
This teletype driver
does not use in te rrup ts and thus must stay in a waiting loop during
character transmission or reception.
These routines are now w ritten
in a mixture of PLM/80 and assembly language and have been modified
both in logic structure and buffer structure.
Assembly language was
used to decrease size and speed execution of some of the routines.
The routines require that a buffer area in memory have previously
been defined.
This bu ffe r area is up to 256 bytes long.
The f i r s t
byte in the buffer (lowest address) is reserved fo r the to ta l number
of f ille d bytes in the bu ffe r.
I t is zero i f the buffer is empty.
There are no re s tric tio n s on the contents of the rest of the buffer.
33
The routines themselves are presented in Appendix D1 along with
descriptions of the parameters required by each routine.
There are
provisions fo r ca llin g the important routines from eith er assembly
language or PLM/80.
The routines not only enable the teletype to be
used as an I/O device, but also allow rudimentary lin e editing to be
done on the lin e presently in the buffer.
Characters may be deleted
beginning with the la s t character entered by pressing the rubout
key.
The contents of the entire buffer may be erased leaving an
empty buffer by using CONTROL-X.
I f the lin e being entered exceeds
the buffer length, the routines w ill q u it echoing the characters a fte r
the buffer is f u l l .
The carriage return key terminates the lin e input.
The Frequency Board Driver.
The next interface routine to be
discussed w ill be the driver fo r the WTC-520A frequency board shown
in Figure 8 (14).
The WTC-520A frequency counter board is designed
around the INTEL 8253 counter (5).
counters on th is .c h ip .
There are three sixteen b it down-
Counters 0 and I are used on the WTC-520A
board to form a gated frequency counter.
Each counter has a gate en­
able input that controls when the input pulse strin g is to be counted,
and an input lin e that indicates when the counter reaches zero.
Counter zero on th is chip and a D f lip f lo p are used to control the
length of time that counter one may count the incoming pulse string.
To successfully operate the frequency board i t is necessary to:
( I)
Reset the output of counter zero.
INSTANTANE OU S i n p u t
O i V I S IO N F a t i
f FE Q V lN C y
*5 V
—Q(
A2< u
OJ
[V fM T
COU kTEH I I P u r
DI VBt oH A A U
*JV
Du a u 6 TO
EOGt CONNCCTTR
^-S-Vz
-tiv
I
JTo
Figure 8
WTC 520 Board (Courtesy of Western Telecomputing)
35
(2)
Preset the D f l i p f l op by forcing counter one's output high,
then low. At th is point, both counters are ready to begin
counting.
(3)
Load counter one with the number corresponding to the max­
imum number the counter can hold in the mode i t is being
operated in.
(4)
Load counter.zero with the number corresponding to the time
in te rva l that counter one is to count fo r. This starts both
of the counters.
When counter zero reaches zero, the D f lip flo p w ill be triggered,
and both counters w ill stop counting.
at any time.
The counters may then be read
Counter zero w i ll, of course, contain zero, but counter
one w ill contain a value corresponding to the number of counts sub­
tracted from the number i n i t i a l l y loaded into th is counter.
I t is
the re s p o n s ib ility of the programmer to determine that the counting
in te rval is always short enough to insure that counter one w ill not
count more pulses than the number i n i t i a l l y loaded in to the counter.
Since in th is application the microprocessor-based system has
C
nothing to do u n til the frequency counter is through making i t ' s
conversion, the driving routine merely waits in a loop checking to
see when counter zero's contents are zero.
When th is is true , the
contents of counter one are read and subtracted from the value i n i t i ­
a lly loaded in to counter one.
The re s u lt of th is subtraction is equal
to the number of pulses input to the board during the time i t took
counter zero to reach zero.
This number is changed in to an ASCII
s trin g and placed in the appropriate buffer.
36
The A-to-D Converter Driver.
The th ird interface driver controls
a-WTC-700-120A analog to d ig ita l conversion board (13). ' This board
resides in a WTC-700 Data Interface System connected to the WTC-800
156 Microprocessor C ontroller (13).
8255 p a ra lle l interface.
This co n tro lle r uses the INTEL
The 8255 must be set into the proper mode to
interface w ith the support electronics on the WTC-700 156 board.
When the mode of the 8255 is i n i t i a l l y set, the entire WTC-700 system
is reset and then the individual cards in the DAS may be communicated
with through the 8255.
The WTC-700-120A an alog -to -digital converter may be read by
signaling the card to make a conversion, waiting fo r the conversion to
be completed, and then reading the results of the conversion.
The
results are in the form of a fiv e byte ASCII string and are read from
the WTC-700-120A using a byte by byte handshake.
The de tails of th is
protocol are provided in the program lis tin g contained in Appendix G.
CHAPTER V
EXPERIMENTAL RESULTS
A fte r the hardware had been constructed, a series of tests were
run to ca lib ra te the operation of the sensors, fib e ro p tic data lin k ,
and DAS operating as one system.
involved two stages.
The process used in calib ration
The f i r s t stage involved in d iv id u a lly adjusting
the response of the sensors, voltage-to-frequency converter, data lin k ,
and software .parameters u n til they responded reasonably close to de­
sign specifications.
The second state involved deriving mathematical
formulas to correct fo r remaining errors in the system.
To accomplish the f i r s t stage of c a lib ra tio n , adjustments that
had been b u ilt into each sensor's c irc u itry were used to bring the
response of each sensor reasonably close to the design specifications.
An exact settin g was not required or attempted, as the mathematical
portion of the ca lib ra tio n procedure-compensates fo r any residual
errors.
Next, the gain of any required interface stages was set so
that the maximum voltage that would be delivered to the voltage-tofrequency converter was +10 volts.
Then the voltage-to-frequency
converter was set so that a 10 v o lt input would produce a 10 k ilo ­
hertz output.
F in a lly, a 10 kHz square reference was used to adjust
the gate time on the gated counter so there was a simple relatio n
between the value in the frequency counter at the end of the count­
ing period and the frequency being counted.
stage of the ca lib ra tio n was finished.
At this point, the f i r s t
38
The second stage of the adjustment procedure uses formulas to
correct fo r no nlinearity and remaining adjustment errors since the DAS
contains a mircoprocessor that is capable of performing numerical cal­
culations.
A series of measurements are made over the range of operation
of the sensor.
As these measurements are made, they are transferred
over the data lin k to the DAS where they are recorded.
At the same time,
•the same measurements are made with another set of instruments that are
known to be accurate.
A mathematical formula may then be constructed re­
la tin g the values recorded with the DAS to the actual quantity that was
measured.
The derived formula is a representation of the transfer
function fo r the system as a whole.
There are several methods to construct th is formula (3).
The method
chosen in th is case involves adjusting the coefficients of a polynomial
so that the polynomial corrects fo r the errors in the system.
The values
calculated with th is polynomial are expected to produce more accurate
measurements than the results without correction.
A BASIC program was
provided by. Dr. Donald Weaver to calculate the polynomial coefficients
required fo r th is method. . To demonstrate the increased accuracy of the
polynomial method over the lin e a r approximation method, the author wrote
a BASIC program to provide a least squares f i t of the same data to a l i n ­
ear re la tio n .
Printouts of the data used to calculate the coefficients
fo r th is polynomial and the co e fficie n ts calculated fo r a seventh degree
polynomial are provided in a table fo r each of the sensors.
A graph of
39
the calculated transfer function is also given, along with a graph of
erro r between the. lin e a r approximation and the seventh degree polynomial
In in te rp re tin g these graphs, i t is important to remember that the poly­
nomial representation of the transfer function is not exact, but has a
waviness to i t due to the fa c t that a f in it e number of terms were used
in the polynomial.
This waviness is apparent in the plots of the error
function which is the difference between the polynomial and line ar
representations.
While the minor waviness is a mathematical construc­
tio n , the plots do indicate the increase in accuracy th a t is available
with the polynomial method.
The two transfer functions fo r the current sensors (Figures 9 and
10 and Tables I and 2) p lo t the current measured in the conductor versus
the frequency of the signal measured from the data lin k .
The c irc u itry
had been adjusted so th a t 5 amperes through the conductor should produce
a 10 k ilo h e rtz reading with the DAS gated counter.
produces exactly th is amount.
Neither c irc u it
These discrepancies are due to the method
used in the i n it ia l hardware adjustments.
Readjusting the hardware to
elim inate these discrepancies is unnecessary since the polynomial repre­
sentation of the tran sfe r function fo r the readjusted hardware would be
\
'
ju s t as accurate as the present polynomial.
.
The transfer function fo r the temperature sensor is given in
Figure 11 and Table 3.
This transfer function d iffe rs from the other
transfer functions in that the output of the device was not adjusted so
Tl
-K-'
Figure 9
Transfer Function fo r Hall Effect Device & Data Link
E r r o r o f L in e a r A p p r o x im a tio n
.Y = .022416 6 -f :4G 2712X:
K ilo h c r tl
Figure 10
Transfer Function fo r Current Transformer & Data Link
DATA COEFFICIENTS ARE COMPUTED FROM
I
I
3
5
7
9
11
13
15
17
19
21
X (I)
.29
.984
2
2.988
4.048
' 5.044 ’
6.04 .
6.98
7.978
9.038
9.944
Y (I)
.214
. 5355
1.094
1.644
2.231
2.787
3.355
3.884
4.439
5.03
5.548
I
2
4
6
8
10
12
14
16
18
■ 20
22
X(I)
.
.544
1.494
2.538
3.48
4.504'
5.51
6.514 .
7.52
8.528
9.524
10.508
Y(I) .
.292
.8168
1.373
T.915
. 2.485
3,045
3.613
4.181
4.735
5.29
5.858
COEFFICIENTS OF POLYNOMIAL SUMMATION A (I)*X **I
I
A (I)
.106290860395553
0
.27675797880948
I
.230824938867842
2
-.0944872305830564
3
.020908734981913
4
2
.5305582678523D-03
5
I
.
57327492499476D-04
6
-3.9254887314146D-06
7
Table I
Hall Effect Device Coefficients
DATA COEFFICIENTS ARE COMPUTED FROM
I
I
3
5
7
9
11
13
15
17
19
21
.
X(I)
.274
1.034
2.08
3.04
4.04
5.024
6.054
7.104
7.988
9.05
10.04
■
Y(I)
.1187
.4723
.9535
1.403
1.87
2.329
2.813
3.303
3.716
4.219
4.697
I
2
4
6
8
' 10
.12
14
16
18
20
22
X(I)
.538
1.55 '
. 2.53
3.518
4.5
5.564
6.504
7.518
8.51
9.46
10.512
COEFFICIENTS OF POLYNOMIAL SUMMATION A (I)*X **I
I
A (I)
-.0142191448561888
0
.489367371176304
I
-.0279904147401379
2
.0118919854596125
3
-2.38428291814793D-03
4
2.407419265383D-04
5
- I . 14098596465538D-05
6
I . 88465239576853D-07
7
Table 2 Current Transformer Coefficients
Y(I)
.2413
.7123
1.156
1.623
2.081
2.581
3.019
- 3.497
3.974
4.426
4.916
43
E r r o r of L i n e a r A p p r o x i m a t i o n
-21.9058 +1.05246X
-325
- 300
A m p lifie r gain set to one
- 275
- 250
-225
Millivolts
Figure 11
Transfer Function fo r Temperature Sensor
DATA COEFFICIENTS ARE COMPUTED FROM
I
I
3
5
7
9
11
13
15
17
19
21
23
25
27
29
31
X (I) .
212.8
223.8
234.6
245
256.1
252
268.7
278.3
280.9
- 297.8
308.7
314.1
316.1
325.9
337.8
349.4
Y(I)
204.25
213.5
224.1
234.4
246.1
245.95
261.35
270.75
272.6
291.9 '
304.45
310.6
312.2
321.35
'332.4
344.2
I
2 .
4
6
8
10
12
14
16
18
20
22
24
26
28
30
X(I)
219.4
229.8
241
251.3
261.6
262.1
' 274.1
284.6
293.2
302.8
315.3
314.9
320.9
329.99
344 .
'
Y(I)
209N52
219.15
230.7
241.2
251.45
255.85
267.05
277.15
285.75
297.8
309.1
311.15
316.35
325.75
338.9
COEFFICIENTS OF POLYNOMIAL SUMMATION A (I)*X **I
I
A (I)
-75614.7574477737
O
2209.42819228466
I
2
-27 .0187201840786
.180187711624059
3
4
-7. 0942821931079D-04
I. 65235955637477D-06
5
-2. 111316378124010-09
6
' I. 143034446264390-12
7
Table 3 . Temperature Sensor Coefficients
45
that i t would produce a maximum of 10 vo lts.
This Was done because
there would be few applications in which the f u ll temperature range
of the device would be needed.
The o ffs e t and gain adjustments are
used to spread the range of in te re st over a larger portion of the
voltage-to-frequency converter input range.
An o ffse t (measured
in m illiv o lts ) adds or subtracts th is quantity from the constant term
of the polynomial approximation.
Changing the gain m u ltip lie s a ll
of the c o e fficie n ts by a lik e amount.
Neither of these operations
changes the general form of the transfer function.
This one p lo t w ill
su ffice fo r any temperature in the AD590‘ s rated range.
The curva­
tures v is ib le at each end of the transfer function are believed to
occur since the LM324 op amp is at or past the edge of it s specified
temperature range, and performance is beginning to deteriorate. '
The tra n sfe r function fo r the voltage-to-frequency converter is
given in Figure 12 and Table 4.
This tran sfe r function displays more
curvature than the integrated c ir c u it's manufacturer had specified.
This is due to the timing capacitor used in the device.
The effective
series resistance of th is capacitor and temperature c o e ffic ie n t are
higher than the specified amount.
Tests were done that demonstrated
a relationship between capacitor q u a lity and degree of curvature of.
the voltage-to-frequency converter's transfer function.
These tests
showed that the voltage-to-frequency converter's performance was re­
peatable, and with the polynomial method of representing the transfer
46
function, that is a ll that is required of any sensor.
47
\
I Volts
v- . 0 3
Line ar A p p r o x i m a t i o n
Y - .0 1 4 6 8 6 1 + .999987X
Volts
W
Error of
Figure 12
Transfer Function fo r Voltage-to-Frequency Converter
DATA COEFFICIENTS ARE COMPUTED FROM
I
I
3
5
7
9
11
13
15
17
19
21
X(I)
.29
.982
2.001
2.987
4.047
5.043
6.04
6.981
7.977
9.039
9.945
Y(I)
.29
.988
2.02
3.02
4.06
' 5.06
6.07'
7
8
9.04
9.95
.
I
2
4
6
8
10
12
. 14
16
18
20
,22
X(I)
;543
1.495
2.536
3.48
4.505
5.51
6.52
7.52
8.526
9.522
10.509
Y(I)
.543
1.504
2.54
3.49
4.572
5.53
■ 6.513
7.54
8.52
9.53 '
10.52
COEFFICIENTS OF POLYNOMIAL SUMATION A (I)*X **I
I
A (I)
0
-.0145017747016736
1
1.05706590453779
2
-.0590085615643065
-3
.0302319055502486
4
-7.70089530823416D-03
5
1. 01726923287447D-03
6
- 6 .72024426283903D-05
7
I . 76006946398493D-06
Table 4 Coefficients fo r Voltage-to-Frequency Converter
CHAPTER VI
SUMMARY
The purpose of th is investigation was to build a low data rate
fib e ro p tic data lin k and demonstrate methods of interfacing both sen­
sors and d ig ita l equipment to the data lin k .
To accomplish th is ,
data links were constructed and operated fo r both infrared and red
wavelengths.
These data lin ks had enough bandwidth to be able to
handle square waves with frequencies up to 100 kHz, although the
highest rate actually used fo r data transmission was only 10 kHz.
A
method of converting analog information to a d ig ita l quantity using a
voltage-to-frequency converter was developed to convert.D.C. voltages
to square waves that could be fed in to the fib e ro p tic data lin k .
Re­
covery of the signal at the other end was accomplished with a microprocessorvbased data acquisition system.
This data acquisition
system contains a frequency counter that was used to determine the
frequency of the signal that had been transmitted over the fib e ro p tic
data lin k .
A teletype was also connected to and controlled by the
*\
data acquisition system. This teletype enabled the operator to
specify parameters that controlled the way the frequency counter was
read and also allowed results to be. printed to the operator.
Al I of the data acquisition functions are controlled by the micro­
processor in the system, which in turn is directed by programs stored
in the data acquisition system memory.
I t is these programs th a t
determine what the system as a whole w ill do.
50
There were two types of sensors that were developed and in te r­
faced to the fib e ro p tic data lin k/d a ta acquisition system described
above.
These sensors enabled measurements of current and temperature
to be made.
Al I of the sensors converted the p a rtic u la r quantity
that they measured in to a voltage that was compatible with the
voltage-to-frequency converter.
Two types of current sensors were developed.
The f i r s t type of
current sensor was constructed using a conventional current.trans­
former.
quencies.
This sensor, could measure A.C. currents at power lin e fr e - (
The second type of current sensor was constructed using a
Hall E ffect device.
from D.C. to 5000 Hz.
This sensor allowed currents to be measured
Both of the current transducers used the same
c ir c u itr y to interface to the voltage-to-frequency converter.
The temperature sensor was constructed using an integrated c ir ­
c u it temperature transducer.
The output of th is transducer was con­
verted to a D.C. voltage by an interface c ir c u it that allowed a large
amount of la titu d e in selecting the temperature range that was to be
measured.
When these sensors had been constructed, they were attached
to the voltage-to-frequency converter and the output of the voltageto-frequency converter was fed into the fib e ro p tic data I ink/data
acquisition system.
The software w ritte n fo r the data acquisition
system could then be used to obtain accurate ca lib ra tio n curves and
functions fo r each of the sensors.
These curves allow the output of
51
the frequency counter to be translated into the quantity that was
measured.
I t is f e l t that th is experiment has demonstrated a valid in s tru ­
mentation technique that allows accurate measurements to be made via
a fib e ro p tic data lin k .
These methods allow measurements to be made
in an environment where e le c tric a l noise can mask or a lte r the in ­
formation being transmitted.
The techniques developed in th is thesis can be expanded into in ­
struments that could be used in several measurement problems.
An
area that has already been suggested is the measurement of current
levels in high voltage transmission line s.
The sp e cific problem
suggested developing a current sensor as one of the demonstration sen­
sors.
Such measurements are presently done with current transformers
combined with an analog meter or recorder.
There is -presently an
e ffo r t to automate these measurements using computer-based equipment,
which would benefit i f the ideas presented in th is thesis were
applied to the automation equipment.
Transmission of data through
fib e ro p tics would provide an added measure of system r e lia b ilit y by
is o la tin g sensors from the microprocessor-based system.
Transmission
of the information on wires does not necessarily have th is advantage.
Other areas where fib e ro p tics could be applied with some ad­
vantage are:
( I)
■
’
'
Near machinery that has large alternating magnetic fie ld s
I
52
such as motors, generators, or transformers.
(2)
Areas such as meteorological towers that are exposed and
susceptable to lig h tn in g strokes.
(3)
E le c tric a lly noisy areas such as telephone switching f a c il-
ities. •
(4)
Transmission of measurements over long distances (several
tens or hundreds of meters) where ground loops and differences
in potential between receiver and transm itter can occur.
(5)
.
Devices lik e e le c tro s ta tic p a rtic le accelerators or mag­
netohydrodynamic channels where great voltages e x is t between
the sensor and the computer.
(6)
Transmission of information through corrosive or p o te n tia lIy
explosive areas lik e those occurring in chemical plants.
Some of these applications might m ultiplex several sensors on
one data lin k .
Other applications may require b id ire ctio n a l communi­
cation between the sensor package and the DAS.
In these cases, the
chief d if f ic u lt y is in devising a protocol that allows communication
to occur on one data lin k , or with a minimum number of data links.
There are several areas outside the scope' of th is thesis that
warrant fu rth e r in vestig atio n.
The system developed in th is thesis
should be compared w ith other methods of transm itting data through
e le c tric a lly h o stile environments. • This would give a better in d i­
cation of when a fib e ro p tic system of .this nature is cost effe ctive .
53
Studies of th is nature have been done fo r communication applications
of fib e ro p tics (12), but there does not appear to be a sim ila r study
comparing fib e ro p tics with other is o la tio n techniques.
Other area's that warrant fu rth e r consideration are directed to­
wards problems that would be encountered in converting the ideas pre­
sented in th is thesis to a practical instrument capable of operating
'in a non-laboratory environment.
One problem is that of supplying
power to the sensor and fib e ro p tic transm itter outside of a laboratory
environment.
.The reason fo r using fib e ro p tics is to provide elec­
tr ic a l is o la tio n between the transm itting and receiving ends of the
data I ink.
This dictates separate power supplies at each end of the
data lin k .
The transm itter may not always be located near a conven­
tional power o u tle t.
Operation on a high voltage transmission lin e
is an excellent example of one o f these cases.
Here, the most
practical method of obtaining power would be by transforming the
power d ire c tly from the transmission lin e .
Other applications may
dicta te solar ce lls or a rechargeable battery backup.
The separate
source of power fo r the sensors and transm itter w ill depend on the
application of the data lin k .
In some of these applications, there
may only be a lim ite d amount of power.
In these cases, an e ffo rt
would have to be made to reduce the amount of power consumed by the
sensor and transm itter.
The c irc u itry could be redesigned using
lower power technologies such as CMOS, but the largest difference
54
could be made by reducing the power consumption of the transm itter,
as the LED alone consumes 1/2 watt.
Most of the lig h t generated by
the LED is not coupled into the fib e ro p tic cable.. A better arrange­
ment fo r coupling the LED's lig h t into the fib e ro p tic cable would
reduce the to ta l amount of lig h t that had to be generated, with a
corresponding reduction in power consumption.
Another area that has not been investigated is the temperature
dependence, o f the system.
The system response w ill vary somewhat with
temperature variatio ns, but the magnitude of these variations was not
checked in the prototype.
These variations would have to be quantified
before an instrument could operate dependably over a wide range of
temperature.
BIBLIOGRAPHY
56
BIBLIOGRAPHY
1.
Analog Devices, Data Acquisition Products Catalog Supplement,
Route I , Ind ustria l Park, P.0. Box 280, Norwood, Massachusetts
02062, 1979
2.
Brokaw, Paul, An I.C. Am plifiers User's Guide to Decoupling,
Grounding, and Making Things Go Right For a Change, Analog Devices,
Route I, Ind ustria l Park, P.0. Box 280, Norwood, Massachusetts 02062
3.
Gerald, Curtis F., Applied Numerical Analysis, Addison-Wesley
Publishing Company, Reading, Massachusetts, 1970
4.
H all, E.H., American Journal of Mathematics, 2, 287 (1879)
5.
In te l Corporation, Component Data Catalog, 3065 Bowers Avenue,
Santa Clara, C a lifo rnia 95051, 1979
6.
In te l Corporation, ISIS I I User's Guide, 3065 Bowers Avenue, Santa
Clara, C alifornia 95051, 1978
I.
National Semiconductor Corporation, AN 31, Linear Applications
Handbook, 2900 Semiconductor Drive, Santa Clara, C alifornia 95051,
1978
8.
National Semiconductor Corporation, AN 31, Linear Integrated
C ircu its Catalog, 2900 Semiconductor Drive, Santa Clara, C a lifo r­
nia 95051, 1977
9 . • Ohio Semitronics, Incorporated, Product Catalog, 1205 Chesapeake
Avenue, Columbus, Ohio 43212
10. Smith, Lois K., 8080 Software Development Package (unpublished),
- Department of E le ctrica l Engineering, Montana State University,
Bozeman, Montana 59717, 1978
II.
Sze, S.M., Physics of Semiconductor Devices, John Wiley and Sons,
New York, New York, 1969
12.
Uradnisheck, Jay, Estimating When Fiberoptics W ill Offer Greater
'Value in Use1, Electronics, November 9, 1978
13.
Western Telecomputing Corporation, WTC-700 System Hardware Manual,
Bozeman, Montana 59715
57
14.
Western Telecomputing Corporation, WTC-800 System Hardware
Manual, Bozeman, Montana 59715
15.
Westinghouse E le ctric Corporation, Type CMS Current Transformers
Data Sheet, Meter and LVIT D ivision, Raleigh, North Carolina
27603, 1978
APPENDIX
APPENDIX A
ANALYSIS OF FILTER/RECTIFIER STAGE
60
ANALYSIS OF FILTER/RECTIFIER STAGE
The c ir c u it in Figure IA was taken from a National Semiconductor
applications note (7) and provides the re c tific a tio n and f ilt e r in g
action in the r e c t if ie r and f i l t e r .
This is not actually.the c ir c u it
that was used in the hardware, as i t has had a ll of the frequency com­
pensating elements and extra am plification elements removed to c la rify
c ir c u it operation.
A m plifier Al and the feedback network consisting
of R l, R2, BI, D2 and C4 provide the re c tific a tio n .
To analyze the c ir ­
c u it operation, the follow ing assumptions need to be made:
(1)
Capacitor C4 is small enough to have l i t t l e e ffe c t in the
c ir c u it's passband.
(2)
Resistors R4 and RB are small compared to the input resistance
of the operational am plifiers (approximately 400K ohms).
Hence, they are going to have l i t t l e e ffe ct at raising the
noninverting inputs o ff ground, and can be neglected in the
analysis.
When these two considerations have been made, i t is possible to
show that the voltage transfer function in the complex frequency plane
(s plane) fo r the c ir c u it in Figure I has the form:
Vout
Vin
_
________
RT__ .,
(C2 x R7 x s + I )
(R1 x R3 - R6 x R2)
(R6 x R3 x R l)
eq (Al. I )
fo r Vin positive and
Vout
Vin
_
fo r Vin negative.
(C2 x R7 x s + I ) x R6
eq(H1.2)
I f Rl = R2 = R6 = R and i f R3 = 1/2 R then eq(A l.l)
R6
•
Figure IA
Rectifier/Filter
C2
62
reduces to:
Vout
Vin
R7
(C2 x R7 x s + I ) x R
and eq(Al.2) reduces to the negative of eq(A1.3).
eq(A l.3)
The signal inversion
caused by th is minus sign fo r negative input voltages causes negative
voltages to become positive.
The diode combination also blocks the
output of the f i r s t am p lifier fo r negative input voltages.
These two
actions insure that the re c tific a tio n is f u ll wave as was anticipated.
• The (C2 x R7 x s + I) part in the denominator of eq(A l.3) ex­
h ib its a pole.
I f the vaules of the resistances and capacitor are
substituted from the schematic in the main part of the te x t, the pole
occurs at:
wp = I / (C2xR7) = l/((2 2 .2 x 103)(10 x 10~6)) =
■4.5 rad/sec or .717 Hz.
eq(A l.4)
Above th is frequency the c ir c u it tends to smooth the output
voltage and below th is frequency the signals are passed unchanged.
This smoothing operation is akin to an integration and averaging
over the period of the wave form.
The pole at a f in it e frequency
causes D.C. to be passed without th is "integration"'.
This is con­
venient, since i f the D.C. were integrated, a ramp function would be
generated- which would be interpreted by the voltage-to-frequency
converter as a constantly changing input voltage rather than a con­
stant input voltage.
APPENDIX B
INTERFACING PLM/80 AND ASSEMBLY LANGUAGE PROGRAMS
64
INTERFACING PLM/80 AND ASSEMBLY LANGUAGE PROGRAMS
The main consideration in ca llin g a PLM/80 program from assembly
language or vice versa is the problem o f parameter passing from one
language to another.
lished (6).
There is a convention that has been estab­
When a PLM/80 procedure ca lls a subroutine and parameters
are passed to the subroutine; the f i r s t parameter is passed in the
8080's .BC re g iste r p a ir, and the second parameter is passed in the
8080's DE reg ister pa ir.
I f there are more than two parameters to be
passed, then the la s t two are passed as above, with a ll others being
placed on the stack.
The f i r s t parameter in the CALL statement para­
meter l i s t is the f i r s t on the stack, and the la s t parameter in the
l i s t is in the DE re g iste r pa ir.
I f the parameter being passed is a
byte,,then i t is passed in the low order reg ister of the register
p a ir ( i. e . , i f the byte is to be passed as the BC re g iste r p a ir,
then i t is placed in the C register)!.
When addresses are passed to
the called routine, the most s ig n ific a n t byte of the address is passed
in the high order byte of the re g iste r pa ir.
When a subroutine is to
return a parameter to the ca llin g routine, there are only two cases
to consider.
The routine eith er returns a byte or an address.
Bytes
are returned in the A re g is te r, and addresses are returned in the Mire g iste r pair.
APPENDIX C
PROGRAM FOR DETERMINING MINIMUM SOFTWARE DELAY
66'
PROGRAM FOR DETERMINING MINIMUM SOFTWARE DELAY
This program is assumed to be entered ju s t a fte r the frequency
counter has completed a conversion.
The loop that the processor s its
in while waiting fo r the conversion is assumed to be labeled WAIT.
This
loop is not presented here, but would be very sim ila r to the one in the
routine that reads the frequency board.
I t is also assumed that the
reg ister pair HL contains the address of the block in memory that the
data is to be stored in and that reg ister C contains the number of times
the loop is to be executed.
CTRl
CTRO
READl
CMD
SC1MD4
SClMDO
COMMA
DSEG
EQU
EQU
EQU
EQU
EQU
EQU
EQU
XXH '
XXH
XXH
XXH
XXH
XXH
I
I
9
ADDRESS OF THE DATA COUNTER
ADDRESS OF THE TIMING COUNTER
COMMAND TO PREPARE COUNTER ONE FOR READING
ADDRESS OF THE COUNTER COMMAND PORT
SETS COUNTER I TO MODE FOUR
SETS COUNTER I TO MODE ZERO
DATA DELIMITER
9
CSEG
;HL MUST CONTAIN THE CURRENT MEMORY ADDRESS FOR THE DATA
;C MUST CONTAIN THE NUMBER OF TIMES FREQUENCY COUNTER IS TO
;BE READ
JNZ
MVI
OUT
IN
MOV
INX
IN
MOV
WAIT
A1READl
CMD
CTRl
M, A
H
CTRl
M,A
;END OF WAIT LOOP
; PREPARE COUNTER I FOR READ
;SAVE LSB RESULT IN MEMORY
;M0VE MEMORY PQINTER
;SAVE MSB RESULT IN MEMORY
67
INX , H
MVI
M5COMMA
H
INX
DCR ' C
DONE
JZ
MVI
A5SClMDA
CMDOUT
A5SClMDO
MVI
OUT
CMD
A5SCOMDO
MVI
CMD
OUT
MVI
A,99H
OUT
CTRl
OUTCTRl
MVIA5OO
OUTCTRO
MVI
A582H
CTRO
OUT
JMP
WAIT
DONE:
9
;DATA DELIMITER IN MEMORY
; DECREMENT LOOP COUNT
;EXIT IF THRU
; RESET COUNTERS AND FLIPFLOPS
;LOAD MAX COUNT IN COUNTER ONE
; LOAD COUNT PER IN CTR ZERO
;THIS BEGING CONVERSION .
-,WAIT TILL CONVERSION DONE
APPENDIX D
THE COORDINATING PROGRAM
69'
I S I S - II PL/M- 80 V3'. I COMPILATION OF MODULE CURKENTM.UN I TORDRI
VER
OBJECT MODULE PLACED IN DVRTST.OBJ
COMPILER INVOKED BY:
: F I : PLM80 DVRTST• PLM NOPAOING
TITLEC * DRIVER TESTING PROGRAM ' ) .
1
2
I
CURRENTSMON I T O R S D R I V E R :
/
DO;
• . ‘
'
DECLARE. ( PRO MP T! , PR0M.PT2 > P R0 MP T 3 )
B L IC j
-
LABEL PU
/ * -
EXT ERN AL
PROCEDURES
D E SC R I B E D
IN
OTHER MODULES
* /
3
I
4
2
2
5
6
"l
2
7
B , ,2
I.
■9
2
10
II
2
12
I
I 3 ,2
I4
I
15
2
16-. •2
17 ‘ I I
I8
2
19
2
. ■.
• •’
K E Y B O A R D S I N P U T : PROCEDURE ( B U F R ) EXTERNAL;
DECLARE BUFR ADDRESS;
END H E Y 8 0 A R D S I N P U T ;
L I N O U T : PROCEDURE ( B U F R ) E XT E R N A L ;
DECLARE BUFR ADDRESS;
END L I N O U T ; ' ,
S T R O U T : PROCEDURE ( B U F R ) , E XT E RN A L;
■ DECLARE BUFR ADDRESS; ■
'•
.
EN D ST RO U T ;
C A R L N F PROCEDURE E X T E R N A L ;
'
END CARLNF; • • .
FREQ:
PROCEDURE ( D A B U F R U I N T P E R ) E XTERNAL;
■ DECLARE ( D A B U F R f I N T P E R ) " ADDRESS;
END FREQ;
•
D V R A T D : PROCEDURE ( B U F F , D E V ) E X T E RN A L;
DECLARE BUFF ADDRESS, DExV B Y TE ;
END D V R A T D ; /
' '
.
/ *
PROCEDURE TO PACK 2 A S C I I NUMBERS I N T O ONE BC
D B Y T E . RE QU IR E S THE ADDRESS OF MS A S C I I B Y T E .
* /
20
I
,
PACK:
,
■'
PROCEDURE
V
(FIR STSB YTE)-B YTE
PUBLIC;
)
70 '
P LMg^
COMPILER
2 I
22
DRIVER
2
Q
TE STING
DECLARE
DECLARE
PROGRAM
F I RSTSBY TE ADD R ES S, CHAR B Y TE ;
( C O N T E N T BASED F I RSTB Y T E ) ( I ) '
BYTE I
23
24
.2
2
25
2
" Z
CHAR = 0 H ;
I
CHAR = ROR ( ( C O N T E N T ”' (0-) AND 0 0 0 0 I I L I B )
, 4) ;
CHAR =
CHAR
OR
(CONT ENT
(I)
AND 0 0 0 0 I I
I I B) ;
24
27
2
2
RETURN CHAR;
END PACK;
.
•
Z *
.
•
PROCEDURE TO CALC U LA TE
I G I T ASCI I S TRING .
*/
/
-
*
'
REQUIRES'THE
MS A S C I I BYTE
.
28
I
29
30
31
2
&
2
.32
33
2'
2
..
* /
BINARY
VALUE
'
'
ADDRESS -OF
THE
- . '
BYTE P R EC E E D I N G
-
-
FOURVALUE;
OF FOUR D
PROCEDURE
( STRING)
^
-
;
ADDRESS PUBL
I C;
;
'
DECLARE' ( S T R I N G , V A L U E ) ADDRESS;
DECLARE CARRAY BASED S T R I N G ) ( 4 ) BYTE;
VALUE = ( A RRAY ( I ) AND 0 F H ) * 1 0 0 0 + CAR
RAY ( 2 ) AND 0 F H ) * 10 0 + (ARRAY ( 3 ) AND 0 F H ) ' * 10
. + ( A R RA Y ( 4 ) AND 0 F H ) ;
. RETURN V A L U E ; - '
'
END F O U R V A L U E ;
‘
/*
"
•
•■ \
. ■
S I G N . ON AND - PRO MP TI NG MESSAGE'S
• ■
•
■
x- ' * /
34
I
35
I
1
•
' '
DECLARE CONTENT I ( 3 2 ) BYTE P U B L I C DATA
( 3 1 , ' CURRENT M O N I T O R R E AD I N G R O U T I N E ' ) ;
DECLARE C ON T E NT 2 ( . 4 8 ) BYTE P U B L I C DATA
( 4 7 , !"ENTER 4 D I G I T I N T E G R A T I O N COUNT ( DEFAUL
T 8 2 0 0 )? ');
•
'
71
P LK80
COMPILER
' DRIVER" TE ST IN G P-ROGRAM
/
37
I
38
I .
39 -
I
40
4 1
I
I
42
I
43
I
44
I
'
.
'36
I
- DECLARE CONTENTS ( 3 5 ) B Y T . E P U B L I C DATA (
'
/
3 d , 'NUMBER OF SAMPLES ( 0 0 0 I TO 9 9 9 9 ) ? ' ) ;
- / •' ■ DECLARE CON TEN T 4'-. (5 1 ). B.YTE P U B L I C DATA
( 5 0 , 'NUMBER OF SECONDS BETWEEN SAMPLES ( 0 0 0 0
' TO 9 9 9 9'-) I
’ -);'.
DECLARE - CONTENTS - ( 9 ) BYTE P U B L I C DATA
(.8 , " COUNT= ' ) ;
^
PE CLARE CONTENTS. ( 1 6 ) BYTE P U B L I C "DATA
( 1 5 , ' D . C . - VOLTAGE=" ' ) ; .
DECLARE DABUFR ( 2 5 6 ) ' • BYTE P U B L I C ;
. ■
DECLARE BUFR ( 2 5 6 ) BYTE P U B L I C / + ALOCAT •/
E BUFFER S T O R A G E * / ; '
DECLARE ' ( COUNT l , T E M P B , K , D E V I C E , B U F L ) B
Y TE' P U B L I C ;
,
■
DECLARE I N T P E R STRUCTURE ( HTGHB.YTE BYTE: ./
, LOWBYTE B Y T E ) P U B L I C ;
{
'
'
DECLARE ( I , J , P £ . R I O D , SAMPLENUM-BER, SECON' "
OS) ADDRESS P U B L I C ;
A* ■
CALL. D R I V E R S
x
45
46
v
48
49
50
51
52
53
I
' '
I N TE R AC T
v
.GET. I N T E G R A T I O N
*<
I
I
• . I, "
I '
I.
• 2
2
2
AT
A
AND
'
WITH
TTY- OPERATOR
.
P E R I O D . FROM-OPERATOR-
.
' •
:
'
• .
.
■
PROMiPTl
CALL. T J N O U T ( ..CONTENT I ( 0 ) ) ; ■'
CALL S T R O U T ( ; . C O N T E N T 2 < T 0 ) ) ; ,•
" ' :
CALL . K E Y B O A R D S I N P U T ( - B U F R ( O ) ' ) ;
. IF. BUFR ( 0 ) =■ 0 THEN
T DO;
I N TP E R- LO WB Y TE . = 0 0 H ; '
* ■
IN TP E R -H IG H B Y TE .= 82H;
END;
else
■
DO; ■
.
'
'
,
.-
72'
‘ P LM80
COMPILER •
DRIVER
TESTING PROGRAM
" IE
"
.
*
56' 57
ELSE
2
3
/
.
58
3
59.
' 60 .
3
2
R( 3 ) ) ;
.
F R (I));
<>
4
THEN GOTO PROM­
. '
'
62
63'
65 '
. 66
"
I
I ■
I
2
67 '
2... .
'/
= PACK( . B U F
I N T P E R . H I GHBYTE = PACK ('-EU.
END,;
•
.
END;
.
.
N
/
• GET NUMBER Or
I
DO;
INTPER.LOWBYTE
. \
■
/^
61
BUFR(O)
PT I ;
-
"
SAMPLE'S-' TO BE TAKEN
..
■
■
P R 0 M P T 2 : ,CALL S T R O U T ( . C O N T EN TS ( 0 ) ) i
CALL KEYBOARDS I NPUT ( . B U F R ( 0 ) ) ;■"
I F B U F R ( 0 ) <> -4 THEN GOTO P R 0 M P T 2 ;
•E LSE DO;
SAMPLESNUMBER = F O UR V A L U E ( . B U F R ( 0 )
);
t
■69 ■ 2
IF
PROMPT 2 ;
• END;
/*
..
SAMPLESNUMBER
> 9999
.
.
GET' TIME- DELAY .BETWEEN END OF TTY
XT SAMPLE
‘
.
.
*/
70
Tl
72
74
75
76
THEN GOTO
OUTPUT & NE
:
I
I
I
I
2
'2
P ROMPT3 : CALL STROUT ( . CONTENT 4 ( 0 ) ) ;
CALL K E Y B O A R D $ I N P U T ( . B U F R ( O ) )';
I F B U F R ( O ) <> 4 . THEN GOTO PROMPTS;.
•
ELSE DO;
''
S EC ON DS '= F O UR V A L U E ( . B U F R ( O ) ) ;
•
I F SECONDS >• 9 9 9 9 THEN GOTO PROMPT
2
I
I
- , END;
.
.DE V I CE= 4 AH‘; / * A T O D CARD, CHANNEL 0 * /
P E R I O D = ( 5 H L ( D 0 U B L E ( I N T P E R . H IG HBT TE
OR ( DOUBLE ( I N T P E R . L O W B Y T E ) ) ) ;
DO 1=1. TO S-AMPLENUMBEh;
-
7 8' 79
80
7 ,8 )
81 '
I
V
.
*
73
P L'M-80 COMPiI LE R
82
2
:
83
84
85 .
■ 86'
87.
• 88
' ' 89
90'
' 91
" 92
"9 3
■94
95
.■ 2
-2
2
: .3
- 4. 4
"■ 3
2
.I
.
I >
MODULE
PRuGRAM
-
CALL STR'OUT C . DABUFR C0 ) ) ;
GAOL DVRATDC . DABUFR C0 ) DEV I CE ) ; / *G
' ET AD C O N V E R S I O N * /
'
CALL STROUTC . C 0 NTE NT6 C 0 ) ) ;
CALL L I N O U T C . DABUFR C0 ).) ;
I TO SECONDS;
\ .DO J =
I
DO K = I
TO 4 0 ;
CALL T I ME C2 5 0 ) ; „
END;
'
END;
‘
-/
END;
,
GOTO .PROMPT I ;
___
END C U R R E N T S M Q N I T O R S D R I VER;
INFORMATIO N:
CODE AREA S I Z E .
V A R I A B L E AREA S I Z E
MAXIMUM STACK S I Z E
T l 9 L I N E S READ - "
" - 0 , PROGRAM E R R O R ( S )
■' r
TESTING
CALL FREQC . DABUFRC0 ) , P E R I U D ) ; / * GE T
' FREQUENCY C O U N T * /
' :
■. C AL L' STROUTC ..CONTENTS C0.)
-
2
2
2
DRIVER.
= 0286H
= 0 2 1 BH
= 0008H
'
’
6 46 D
536D
' 8D •
.' '
■
E ND .OF- P L / M - 8 0
COMPILATION
l-aizr --
\
>
74
)
I S I S - I I P L / M - 80' V 3 . I C O M P I L A T I O N OF MODULE CURRENTMONI TORDRI
■ ;
VER
O B J E C T MODULE PLACED I N D V R T S T . O B J .
.
'
C O M P I L E R I NV OKED B Y : : F 1 : PLM80 D V R T S T 1P L M ■NOPAGI NG CODE P R I N
T CD VRTS T . L L T ) T I T L E C ’ D R I V E R T E S T I N G PROGRAM ’ )
■ l"
C CURRENT S MONI T O R S D R I V E R :
"
-I
DO;
.
2 •
I " •
~v '
DECLARE' CP RO MP T I i P ROMP T2 ^ PROMPTS ) LABEL PU
-•
B L I C;
/*
■
•
3
4
,5 L6
7 •
•8 .
9
10 ‘
I I ,
12
I 3
I4
I
2
2
r
2
2
I
2
2
I
2
I
...
-
.
EXT ERN AL
S
-
•
PROCEDURES
DESCRIBED
I N - OTHE R IXODULE
K E Y B O A R D S I N P U T : PROCEDURE / B U F R ) , EXTERNAL;
DECLARE BUFR A D D R E S S ; '
.
•
END KEYBOARDS I N P U T ; ''
.- - L I N O U T : PROCEDURE CB U F R ) E X T E R N A L ; ..
■ DECLARE BUFR ADDRESS; .
' __ '
END L I N O U T ;
'
.
PROCEDURE
CBUFR)
EXTERNAL;
STRO U T :
DECLARE BUFR ADDRESS;
' ■END s t r o u t ;
C A R L N F : PROCEDURE E X T E R N A L ;
END CARLNF;
PROCEDURE C D A B U F R , I N T P E R ) EXTERNAL
FREQ:
. .
-
.
15 .
2
'
16 . . 2
.
17 ■
I " "
' 2
18
I9 '
2 ■
•
*
-
;
DECLARE CDABUFR j . I N T P E R ) "ADDRESS;
. '
■ '■ . END FREQ;
D1V R A T D : PROCEDURE ' C B U F F i D E V ) E XT ERN AL;
DECLARE BUEF A DD RE SS , DEV' 6 Y TE ;
END DVRATD;
>
.
^
PROCEDURE TO PACK 2 A S C I T N UM B ER S . INTO- ONE BC
D B Y T E . R E Q U I R E S THE ADDRESS-OF- MS A S C I I B Y T E .
*/
■
’ ■ ■ ■ ' ■ '
75
P LM80
20
COMPILER'
I
TESTING
PROGRAM WITH MNEMONICS'
PACK:
PROCEDURE
;
(FIRSTSBYTE)
" -
BYTE-' P U B L I C
y
J
#
STATEMENT
20
J PROC
PACK
L XI
H , F IR STB YTE+IH •
2 I 0.1 0 0
M,B
70
• MOV
H
• DCX '
2B
M
,C
MOV
"
;
71 .
'
F
I
RSTSBT
TE
ADDRESS;
CHAR-BYTE;
DECLARE
(
CONTENT
BASED
F
I
R
S
T
B
Y TE ) ( I ) '
DECLARE
BYTEr
‘ CHAR = 0 H ;
' . . • • ;
; ' STATEMENT
. I
L
# 23
' . ' ;
H , CHA R
LXI
-0216
'210200
M> 0H
MV I
02.1 9
3600
CHAR = ROR( ( CONTENT ( 0 ) AND 00.001 I I I B )
f 4 );
; STATEMENT
—
-‘
# 24
F I R S T B Y TE .
. ' '
LHLD
2A0000
0 2 TB
A ,0 F .H
MV I .
3E0F . .
02 I E
M
ANA '
0220 - . A6
.■
,'
' RRC • , •
V
; •
0 2 2 I " 0 F ...
. .r
RRC
0 2 2 2 . 0F
.RRC
0 F ■■
0223.
I.
.
•/
■
.
RRC
0 2 2 4 . 0F
CHAR
,
STA
0 225 . 320200,'
/ •
. . i CHAR = CHAR OR ( CONTENT ( . 1 ) AND 0 0 0 0 I I
IlB );'
f STATEMENT.
'
,
# 25
F
I
R
S
T
B
Y
T
E
'
L
H
L
D
2A0000
0228
H
I
N
X
022B
23 ■
A ,0FH
MVI
3E0F022C
M
ANA
022E
A6
0 2 10
0213
; 0 2 14
02 I 5
' 21 ' - 2
22
•2
.
' 2
. .23
. 24
■ 2
"
'
‘
'■ •
' ■■
"■ 2 5
•
2
>
„
•;
76
PL M80
COMPILER
TESTING
210200
B6
77
RETURN
' 022F
0232
0233
26 .
PROGRAM WITH MNEMONICS
2
H , CHAR
M
M, A
LXI
ORA
MOV
CHAR) .
'
)
# 26
C9
0234
27-
END PACK)
' 2
RET
. .
-
J ■ STATEMENT
# -27
* /
•
:
*
.
/*
' PROCEDURE TO CALCULATE
I G I T ASCI I S T R IN G .
STATEMENT
.
■
B I N A R Y .VALUE
.
OF,FOUR
.
D.
_
/*
28
. R E Q U I R E S THE
MS A S C I I BYTE
*/
FOURVALUE:
I
ADDRESS OF
PROCEDURE
THE BYTE P R E C E E D I N G
v
(STRING)
'
ADDRESS PUBL
ic ;
J
28
'
:■
.
STATEMENT
"
J PROC
FOURVALUE
210400
LXIHj S T R I N G + I H
.7 0
"
^ MOV I" .
M j-B
2B DCX
.-H ;
- • \ '
.7 1
•
■
' MOV ;•
: • Mj.C ;
. .• ' 7
DECLARE ( S T R I N G , V A L U E ) - ADDRESS)
. " ■
DECLARE (ARRAY BASED S T R I N G ) ( 4 ) ' - B YT E)
VALUE = ( ARRAY . ( I ) AND 0FH-,)* 1 0 0 0 +'' ( A R
RAY ( 2 ) AND 0 F H ) * 1 0 0 + (ARRAY ( 3 ) AND 0 F H ) * 10
+ (ARRAY ( 4 ) A
0235
0238
0239
023A;
■
,
'
•
■ 29
2 ^
' 30 ' • 2 . • • 31
2
'
v- '
ND 0 F H ) )
)
# 31
023B' ■ 2 A 0 3 0 0 ■
f
LHLD
STRING
STATEMENT
77
' PLM80
\
COMPILER
TESTING
023E
23
023P
3E0F
0241,
A6 ■
'
0242 1 6 F
0243
2600
0 24 5 • I I E 80 3 ■
0 2 4 8 vCD0000
0248
ES
,
024C
2A0300
0 2 4F ' 23
0 2 50
23
'
3E0F
02510253
A6
6F
■
0254
0255
2600
0257
.1 I 6 4 0 0
C D0 000 .
0 2 5A
025 D
Cl
025E
09
025F
0 I 0300'
ES
0262
0263
2A0300 ■
0266
09
3E0F
0267
0 2 6 9 . A6
026A . 6F
0268.
2600 ,
■C D0 0 0 0 026D
0270
Ci '
0271
09 0 2 7 2 ' 010400.ES
0275
2A0300
0276
09
0279
0 27 A ’ 3E0F
027 C . A6
5F
027D
PROGRAM' WITH MNEMONICS
;
H
INX ,
"A,0FH '
MV I
M
. ANA
Lj A
MOV
H j 0.
MVI
LXI •
D , 3 E8 H
8P0034
. CALL
■ ; .1
' PUSH.
' H •
LHLD,
. STRING
-•
INX
■H .
INX• H A ,. 0 F H ■’
MVI ■
ANA
M
Lj A.'
MOV
MVI
Hj 0
LXI
D j 6 4H
@ P 0 03 4
CALL
I
B
POP
• DAD
B B j 3H
.
LXI
i I
' PUSH .. ' HLHLD '
S T R I NG
B•
DAD.
• A j 0FH- ‘
: MVI
M -.
ANAL j A- 1
MOV
Hj 0 V
" MVl
9P0033 CALL '
; I
"B
POP •
DAD
B • ‘
■B j 4H
LXI
PUSH '
H -"
.1
LHLD
STRINGDAD
B M VI.
A j 0 FH
ANA
M
E» A"
MOV
-
V .'\
78
PL M 80
COMPILER
T E ST IN G
027E
0280
028 I
0282
I 600
MV I
’ D , 0'
El
- POP
,
H .
19
' -'
DAD
■ ■D
220500
SHLD
VALUE
u . R E T U R N ' V A LU E ;
'•■. '
32
2 .
\
-•
' ' .
I
;
STATEMENT
S " STATEMENT
-'
# 3 3
"
r
# 32'
. C9
' RET
END FOURVALUE;
0285
: . 33 .
PROGRAM WITH MNEMONICS
Z*
SIGN
'
ON AND PROMPTI NG
. ' ' V .
MESSAGES
'
' ;
-
* /
34
I
35
I
DECLARE CONTENT I ( 3 2 ) BYTE P U B L I C DATA
( 3 1 , ' CURRENT M ONI T OR RE ADI NG R O U T I N E ' . ) ;
DECLARE CONTENT2 ( 4 8 ) , BYTE P U B L I C DATA
( 4 7 , ' E N T E R 4 D I G I T I N T E G R A T I O N ' COUNT ( DEEAUL
T 8 20 0 )? .’ );
,
36 . I
DECLARE CONTENTS ( 3 5 ) BYT
Ei P U B L I C DATA (
'
3 4 , 'NUMBER OF S A M P L E S ' C 0 0 0 1 TO 9 9 9 9 ) ? ' ) ; .
'
DECLARE CONTE NT4' ( 5 1) BYTE P U B L I C . DATA,
■ ' . ( 5 0 , .'NUMBER OF SECONDS BETWEEN SAMPLES ( 0 0 0 0 .
. TO. 9 9 9 9 ) ? . ' ) ;
. '
' .
‘ '
' ' ' • , /
; DECLARE CONTENTS ( 9 ) BYTE P U B L I C . DATA
'"
I.
.' 37
'3 8
I
39
./ .
40
- 41
I
-
(s /'
"
- '
I"
I
42-
■I
43
I
44
.
I
-
'
■
Co u n t =
') ;
- .
/
" ■
7" '
■ (15,_'
DECLARE CONTENTS ( 1 6 ) BYTE P U B L I C DATA.
D . C. VOLTAGE= ' ) ;
1
'
' DECLARE D A B U F R ( 2 5 6 ) BYTE P U B L I C ;
. DECLARE B U F R ( 2 5 6 ) BYTE P U B L I C / + A L O C A T
E BUFFER S T O R A G E * / ;
;
DECLARE ( COUN T l , TEMPB, K , DE V I CE, BUF L ) B
YTE P U B L I C ;
.
DECLARE I N T P E R STRUCTURE CHI GHBYTE' BYTE
, LOWBYTE B Y TE ) P U B L I C ;
■
DECLARE ( I , J , ' P E R T O D , SAMPLENUMBER, SECON .
v
"
.
.
:
79
PLK80
COMPILER
T E ST IN G
OS)
PROGRAM WI TH. MNEMONICS
ADDRESS P U B L I C ;
/ *
"
CALL
—
DRIVERS
AND
I N T E R A C T WI T H ' TTY
■ R
'
*/
•/*
GET
* / .I
INTEGRATION
PROMPT I :
I
45
-
OPERATO
— *
00BF
#■ 45
310000
P E R I O D FROM OPERATOR
CALL
L I NOUT ( . CONTENT- 1 C0 I ) ;
V ;• STATEMENT
LXI
"
SpjeS TA C K SO R IG IN --..
PROMPT]
- • SP> @STACK SORT GI N""’
LXI
3 I 0000
'
CONTENT I.
LXI
0 I 0000
LINOU-T
CALL
CD0000
, CALL STROTJT ( . CON TE N T2 C0 ) ) ;
I
:46
r STATEMENT
•
' /.
§ 46 ‘
B> C 0 N T E N T 2 ,
LXI .
0 0CB
0 I 20 00
' STROUT
' ;;
CALL
0 0C E " C D 0 0 0 0
_ CALL KE YBOARDS I N P U T C . BUFRC 0 ) ) ; ' ■ 47
•I
'
J- STATEMENT
_.
—
.
1
' '
# ■4 7 .
' EUBUFR
- '
‘ 0 0 DI ' 010701 ■ / . LXI •
KEYBOARDINPUT
... - " .
' CALL
CD0000
00D4
THEN
..
BUFRC
0
)
=
0
.
AS •
I...
■ ' IF
"
.-J STATE ME NT
.*
'•
r
#■ 4 8
‘
BUFR
'
1
LDA
00D.7 • 3 A. 07 01
0H
'
'
CPI .
00DA
FE 0 0
JNZ
C2EA00
eI
:
.
• 0 0D C
(
DOr
I
49
I N T P E R - LOWBYTE = 0 0 H J
2
50
i
J STATEMENT
,
•.
# 50
H , IN T P E R + IH "
• •
LXI
2 10D02
0 0 DF
.
.
. 00 C2
0 0 CS
00C8
■
-
.
- -
.
' •
- '
X
80
COMPI LER
P L M8 0
TESTING
00E2
51
PROGRAM . WI TH MNEMONICS
MVI
' M,0H
I N T P E R . H I GHBYTE
3600
2
- /S' 51
00E 4
2B '
"00E5 . 3 6 8 2
‘
52
,2
DCX
MVI
'• I
82HJ
•
•
j statement:
=
H ^
Mj 8 2 H
END;
s
v
•
■ # 52
. __ 00ET. . C 3 0 7 0 I
.
53
54
. I ■■
. 2
\ '
• ’
JMP '
@I : ■
ELSE
.
DO;
•,
STATEMENT
@2
*
.
’
IF
4 THEN • GOTO PROM
BUFRC0) .< >
. PTlJ
■ ;
# 54
3A07.0 1 .
FE04
CAF 5 0 0
00EA
00ED
00EF
■■
•;
LDA
CPI
JZ
' BUFR ’ '
4H
@3
/
.
' # 55 .
■ 00F-2 - C 3 C 2 0 0
■■ ' ." .o . ’
•_
JMP
.
@3:
\ 56 : •2 ■
57
• 3
. -
■■• E LSE DO; •
; ■INTPER.LOWBYTE
-
- . - - V
■
#
00F5,
l- 0 0 F 8
00FB
58
57
0 I 0 A0 I
CD I 0 0 2
-320D02 .
V
•
"
= PACKC • B UF .
.
;
•i /
’
.
F R C l));
• -
Sc
LXI
010801
• •
'
STATEMENT
- r J
*
-
CO
m
I
' 00FE
STATEMENT-
L X I/
B j BUFR+ 3H
. ■
CALL ’
PACK.
S T A. - V . I N T P E R + I H
I N T P E R . H I G H B Y T E == PACKH « BU
3
-
.
;
PROMPT T
"
••
.RC 3 ) ) J
STATEMENT
v
.
-
y-
B,B U FR +I H
•
•
STATEMENT
81
P LM80
COMPILER '
TE STIN G
CALL
STA
CD I 0 0 2
320C02
0 10 1
0104
'5 9
PROGRAM WITH MNEMONICS
PACK •
INTPER
ENDj
-3
STATEMENT
'
# 5 9
60
' - -- ''
.2
@4:
E ND j '
.
STATEMENT
. # 60
.
./*
61
• I
.. 6 2
I
63
-I
\
..
-
.■
'
..
'
.
' GET NUMBER . OF SAMPLES' TO BE TAKEN /
I
'
*/
‘
",
P R 0 M P T 2 : CALL STROUTC . CONTENT3C 0 ) ) J
'
’ J .STATEMENT
# 6 I
PR0MPT2:
I
SP.* @STACKS O R I G I N . ' . , ■
LXI
0 107
310000
LXI
B , CONTENTS
0 I 0A
015000
CALL
StROUT
. ' '.
010D
CD0000
CALL KEYBOARDS I NPUTC • BUFR ( 0. ) ) J .
J . . STATEMENT
•
# 62
: .
.
'
"
"
0110
010701 . .
-LX I
By BUFR
j ■
.
0 1 1 3 : CD0000
•
. CALL.
KE-Y BOARD I N PUT "■
I F BUFRC 0.) <> 4 - THEN GOTO PR0MPT2J
.
J STATEMENT
# 6 3
0 1 1 6 ■ 3A07.0.1
01.19FE04 ‘
01 I B
C A 2 10 1 .
-
'
- ■
'
LDA
'■ C P I
JZ
'/
- '••
. BUFR
J4H '
@5
'
..
'
J
- ^
65
66
—
0 1 IE
.
I
.2
STATEMENT
# 6 4
C30701
JMP
PROMPT2
§5 :
'
'
E L SE DOJ
• SAMPLESN.UMBER. = FOURVALUE C . BUFR C0 )
■z.'
PLM80
COMPILER
T E ST IN G
PROGRAM WITH MNEMONICS
/
) J
STATEMENT
J
66
0 1210 I 070 I
0 1 2 4 .'CD3502,
. 0 127.
22 1402
U
' . 67
•
Bj BUFR
_
•
LXI
CALL
FOURVALUE
SHLD
SAMPLENUMBER SAMPL E SNUMBER > 9 9 9 9 THEN GOTO
IF
2
PR0 MP T2J
,
-•
# 61 '
•
■
• '
0 I 2 A . I I 0 F 27
0 12D
21 I 4 0 2
0130
CD0000 '
0 133
D2390 I ’
*
0136'
, 69
--
'
/
'
'
I
I
■'
S S TA TE ME-N T
,
.
' V. .
’
*/.. ■ '
•-
■'
. ■
-T
.
.
.
" .
'
.
BETWEEN E N D . OF TTY
;
OUTPUT & N E ­
: ' -
PROMPTS :
# 70
7 I
'
. GET T I M E DELAY
XT-SAMPLE
.
(
.
P R0 MP T2
'
@6: .
/*
5 70
JMP
- @7:
END; '
69
STATEMENT •
' LXI
* ’ ‘ D ,270FH
;' LXI '
H , SAMPLENUMBER
CALL
8P0104
"' . '
JNC .
.> 7 •
. J
STATEMENT-
68
.
C3070I
•
2
.'}
-
C ^ LL
/
STROUTC
- '
PROMPTS:
.
CONTENT 4 ( 0 )■) J ' ;
'
' . S STATEMENT
.Vj'.
-/
. •
0 139
310000
LXI
" SP,eSTACKSO RIG IN .
0 1 3C
0 17300
LXI
' B* CONTENT A ' . 0 1 3F
CD0000
CALL
- STROUT
CALL KE-YBOARDSINPUTC . B U F R C 0 > ) J
-J STATEMENT
• #" 7 1. .
0142
010701
•
LXI
B* BUF R
■
:
",
. V
•
83
P LM80
COMPILER
0 I 45
72
TESTING
CD0000
IF
0 '7 2
3A0701'
0 148
0 I 4B
FE04 ■
•0 I 4 D
CA5301,
PROGRAM WITH MNEMONICS
BUFRC 0 )
CALL . , ^ k e y b o a r d i n p u t
<> 4 THEN GOTO P R 0 M P T 3 i
i STATEMENT
BUFR
4H
@8
LDA
CPI
JZ
i
■
JMP . .. PROMPTS
\ .
@8 :
ELSE DOi ■ 1 v
,
..
SECONDS = F O U R VA LU E C. BUFRC0 ) ) i
(
; s t a t e m e n t :# 75 '
V .
B,BUFR
. LXT
0153
0 1 0 7 0 1'
F OURVALUE
CALL
0156
CD3502
SHLT)
SECONDS'
0 I59
221602
I F SECONDS > 9 9 9 9 THEN GOTO PROMPT
‘ 3i
■i STATEMENT '
0150
IA
" 75
1
2
76 -
STATEMENT
# 73'
C3 3 9 0 I
.’ v
# 76'
0 15 C • I 1 0F27.
1 O l S F v- 2 I I 6 0 2
0162
CD0000
0165
D26B0.1
*
,
—
.01 6 8
.
»■
D , 270FH _
H , SECONDS
9P0104
.@10
.;
LXI
LXI .
CALL'
JNC
STATEMENT'
■
■
# 77
C 3 3 9 0 1".
jMP
;
-
PROMPTS
-
@1 0 :
• ■
78
ENDS
. 79-.
I
J
@9:
D E V I C E = 4 A H i / * ■ ATO 'D CARD,
' '
-
■
# 79
*
STATEMENT.
:
CQ
I
%
*■
.
■ • ■
CHANNEL 0 * /
i STATEMENT
•
. .
• . V - : ' L '. '.
\
v
.■
-
: -
84
P LM80..COMPILER-
TE ST IN G PROGRAM WITH MNEMONICS
0 1 6B
0 1 6E
80
2 10A02
364A
I
) , 8)
.
81
•
' - ,82'
.
LXI
' H , DEVICE .
MVI.
x
M,4AH
P E R I O D = ( SHL <DO UB LE CI N T P E R - . H I GHBYTE
OR CDOUBLEt I N T P E R . LOWBYTE) ) ) J
..
'} STATEMENT
# 80
0 170 -' 2A0C02
LHLD .
INTPER
0 I 73
2600
•
.
MVI
. H ,0
■ 0 1 75 ' 0 E 0 8
'
• - . ■ MVI
C ,8H
■ 0177
CD0000'
' CALL' ••
9P0088" •
0 17 A
ES
PUSH
H ' • . ■ -' J 'I
0 17 B ' 2 A 0 D 02 •
' ' LHLD
" INTPER+IH..
0 1 7E
2600"
MVI
' V H ,0'
„ 01 8 0
Dl
'
. POP
■ ’D
•,
J I ,0 181
C-D0000
CALL
@P0049
0 184
221202
SHLD ..
PERIO D •
I
DO I = I TO SAMPLENUMBERJ
"
",
7
J- STATEMENT '
#81
. . . .
0187
2 10100
.
LXI
H, IH
0 18A
220E02
'
" - ■ SHLD
I
@1 1 :
■y . 0 1 8 0 ' I I 1 4 0 2
LXI
D , SAMPLENUMBER
• •
0190
0 10E02
. L X I '■
Bj I
;■0 I 9 3 • C D 0 0 0 0
CALL ' ' ‘ 8 P 0 0 9 8
• 0 j 96
DA0B02
'
JC
@12
C A LL F R E Q C ♦ D A B U F R ( 0 ) , P E R I O D ) J / * GET
2
■ , ' FREQUENCY- C O U N T * / J STATEMENT
# 82
0199 .
'• 0 1 9C
0 I 9D
0 I A0
83
. LH LD - ' . P E R I O D
. .
XCHG ,
'■
'.
• x - 'i • ' ’
LXI
B j DABUFR . '7
CALL
FREQ" / '
STROUT C.. CONTENTS ( 0 ) ) j '
,
i STATEMENT
2 A I 202
-ES'
010700
’ ■C D 0 0 0 0
CALL
2
# 83
\
85
RLM80
' 84
0 I A3
.0 I A 6
CALL
2
_
’
■
• 86
2
87
2
. 88
, 2
LXI8 , CONTENTS
CALL y
STROUT
STROUT (' . DABUFRC 0 ) ) J
J STATEMENT '
# '8 4
0 10700
CD0000
i
B j DABUFR
LXI
STROUT
CALL"
'CALL DVRATDC . DABUF.RC0O , D E V I C E ) J / * G
• / ET AD C O N V E R S I O N * /
, -*
- •
STATEMENT
1 . .
# 85
, -LHLD DEVIC E-..
' 0 LAE
2A0A02 '
'- ■
■
XCHG
0182
E B "..
B
,
DABUFR
,
0183
■0 1 0 7 0 0 .
: LXI
I '
DVRATD
CALL
0 I 86
CD0000
i
(
CALL STROUTC . CONTENTS C0 ) ) J
STATEMENT '
J
# 86
LXI "
B , CONTENTS
0 1 8 9 " 0 I AF00.
CALL
STROUT .
"
CD0000
' 0 I BC
CALL L I N O UT C • DABUF R C.0 ) ) s '.
S STATEMENT. ' . .. ■
—
■- ' ' _
# 87
B , DABUFR”
' LXI
,
-0-1 BF . .0 1 0 7 0 0
-. - ' / .
LTNOUT ■■'
' CALL,
• 0 I C2
000000 ■
V
•DO J = f t o SECONDS; - - '
0 I A9
01 AC
85'
PROGRAM W I TH MNEMONI CS .
0 I A600
CD0000
2
-
'
TESTING
CO MP I LE R
:
'
;
# 8 8 '.
'
210100
' 0,1 CS
221002
01 CB
LXT •
S HL D1
-
statement
H , I H-.
• J -
@13:
01 CB
I I I 602
01
1002.,
0 I CE
0 I Dl
CD0000
. 0 I D4 " DAFE0 I
89
• .3 .
-
,
'* ■
i LXi :
LX I
CALL
JC
DO K = 1
/ -D, SECONDS.
B ,J
.
@P0 0 9 8
@14
■>.
1,
TO 40 ;";
■
. ..• ; STATEMENT
- ' 'v, •
-
''
•x •
•- ■
/
.v
\
86
PLM80
CO MP I LE R
TESTING
PROGRAM W I T H
MNEMON PCS
■
■
.0107
0 I DA
#
89
2 10902
3 6 0 1.
'
LXI
MV I • '
'
•
H,K
Mj I H
"
@15:
'
90
- 4
I
0 1E5
01E7
••
9T
. # 90
3EF A ,
CD0000
MVI
CALL.
' END;
STATEMENT
AJ 0FAH
@P0 I 0 5 r - , '
;• STATEMENT
■' .
-
-X
# 91
210902
34
C2DC0I
LXI
' I NR .
JNZ
Hj K
M
@15
z
;
0 IF l .
0-1F4
0 I F -7
. 0 IF8
0 I FB'.
92
110100:
2A1002
19
221002 •
D2CB0I
.
A ■'
STATEMENT
Dj I H .
LXI
.
. LHLD
."J .
;• Dx- ..
' DAD
SHLD .
J .
@1 3 ,
JNC.
@14:
END;
2
•
^ -
A j 2 BH
Hj K
M'
@16
ME C2 5 0 )
■j
@16:
END;
,3
;
'
93
I
•. 4 '
0 IEA
0 IED
0 I EE
92
■ M V I" LXI
CMP
JC
' CALL T I
0J DC ' 3 E 2 8
210902’
’ 01DE
"
0 I E I : BE
0 I E 2 ' D A F l 01
STATEMENT
.
# 93
110100
0 IFE
2A0E02
020 I
0204
19
•0205 . 2 2 0 E 0 2
D2.8D0 I
-x 0 2 0 8
'
'
x
...
'
DjlH
LXI '
LHLD " I
DAD, . . - D
SHLD
I .
@11
JNC
‘
•
■■I :
'
87
P L M 80
COMPILER
PROGRAM.WITH MNEMONICS
§12:
GOTO PROMPT I
I
94
TE STIN G
J
S
STATEMENT
}
; . '■
.9 5
I
\
'
'
# 94
020B
C3C200
- JMP
•
PROMPT I
■
END CURRENT SMONI TO RSDRI VERJ
. •
■
.
-'
* 95
:
'
.
■ 020E'
PB
EI
' ' 0 2 0 F .. 7 6' •
HLT
:
"
MODULE" I N F O R M A T I O N :
r.
'
•
CODE AREA . S I Z E y
=
V A R I A B L E AREA S I Z E =
MAXIMUM STACK S I Z E =
I 19 L I N E S - READ '
0 PROGRAM E R R O R ( S ) '
E ND OF P L / M - 8 0
''
;
STATEMENT
: =
'
.
' .
0286H
0 21 . 8 H
0008H
'
'
.■
646D.536D
8D
' '
"
■'
'
-
.
. ..
.
COMP ULAT ION
’
.
-
-
i
V
A
APPENDIX E
THE TELETYPE DRIVERS
89
PARAMETER PASSING SPECIFICATIONS FOR THE TELETYPE DRIVERS
The follow ing routines are w ritte n in assembly language and
are contained in a f i l e named DVRSUP.SRC:
STROUT:
Outputs the contents of a buffer without appending a
carriage return and lin e feed to the buffer.
The
address of the f i r s t byte in the buffer must be placed
in re g iste r pair BC p rio r to ca llin g th is routine.
LI NOUT:
Outputs the buffer appending a carriage return and lin e
feed to the buffer contents.
The address of the f i r s t
byte in the buffer must be placed in BC p rio r to the
routine c a ll.
CHIN:
Reads a character from the teletype.
The character
is returned to the ca llin g routine in the A register.
.CHOUT:
Outputs a character to the teletype.
The address of
the character to be output must be in th e .BC register
p a ir p rio r to the routine c a ll.
The follow ing routines are w ritte n in PLM/80 and are contained
in the f i l e DVRPTY.PLM:
ECHO:
Receives a character from the teletype keyboard and
p rin ts the character on the teletype.
Returns ASCH
equivalent of the character in the A re g iste r.
90.
CHARACTEROUT:
Prints a character on the teletype.
The routine
must be entered with the ASCII equivalent of the charac­
te r in the C re g iste r.
CHARACTERINPUT:
Gets a character from the teletype keyboard.
Char­
acter is returned to the ca llin g routine in the A reg ister.
CARLNF:
Outputs a carriage return and a lin e feed to the teletype.
KEYBOARDINPUT:
F ills a buffer in memory with characters from the
teletype.
The routine is exited with a carriage return
which is not placed in the buffer.
linefeeds as input characters.
The routine ignores
Procedures are provided
to allow.the previously entered character to be deleted
from the buffer using the rubout key or to discard a ll of
the characters in the buffer by entering a CONTROL-X.
When the buffer is f u l l , the routine w ill not accept new
characters u n til a carriage return is used.
A carriage
return at any time w ill cause the routine to be exited
with the buffer conforming to the standard stated e a rlie r.
91
I S IS -II P L /K -8 0 .V3. I
O B J E C T MODULE PLACED
C O M P I L E R I NVOKED B Y :
' RIVER
I
• TELETYPED R IV E R :
DOJ •
.
'
'
/* %
2
I
’
^
'
'
‘
d'
’
'
'
DATA - I N I T I A L I Z A T I O N
* '/ '
-
C O M P I L A T I O N OF MODULE T E L E T Y P E D R I V E R
IN DVRPTY. O B J ‘
^
: F I : P L M 8 0 DVRP TY -P LM NOPAGI NG T I T L E ( '
T E S T I N G PROGRAM' )
'
=
.
'
FOR CONSTANTS
'
■
- D E CLAR E. ( C R E T , F E E D , R E S E T , S E T , RUBOUT, DASH, C
'
NTRLX^ S L AS H ) BYTE P U B L I C DATA ( 0 DH , 0 A H » 4 0 H , 0CF
.
.
H, 7 F H y 5 F H , I 8H,5CH).J
/*
'
/ ■
PROCEDURE TO RESET 8 2 5 I
\
.
*/
RE TMD: ' ..PROCEDURE P U B L I C ;
3
I
... 4
OUTPUT C0 E DH ) = RE S E TJ2
5
RETURN;'
2
END RE TM D;
' 62
*
■■
. /*
PROCEDURE TO SET 8 2 5 1 MODE (DO F I R S T )
- .
*/ •
I '■ v ‘ SETMD:
PROCEDURE P U B L I C ;
•
■
O U T P U T ( O E D r i ) = SET ; .
2■ 8.
RETURN; \ ' . . 9
2
END SETMD; '
; ,
2.10
I
X
••
/*
•
' ■
GET ■CHARACTER FROM 8 2 5 1 .-OR USE ANOTHER R O U T I N E
W I T H SAME NAME
- "
1
*/
C
H
I
N
:
PROCEDURE
BYTE
E XT E RN A L;
11
I
END
C
H
I
N
;
2
12
OUTPUT 'CH AR TO 8 2 5 1 G I V E N . I T S
ADDRESS
IN
RE: G B
92
P L M 80
COMPILER
TELETYPE
c
•' - ■
*/
...1 3
14
I
2
.1 5
2
DRIVERS
.
•.
C H O U T : • PROCEDURE CCHAROUT) E X T E R N A L ;
. DECLARE CHAROUT ADDRESS; '
END CHOUT;
-
/*
R O U T I N E TO GET CHAR. FROM
O I T TO T T Y P R I N T E R
•
TTY
KEYBOARD AND ECH
'
ECHO:' ■ PROCEDURE BYTE P U B L I C ; • DECLARE"' CHAR B Y T E ;
CHAR = C H I N ;
CALL CHOUTC . CHAR).;
RETURN CHAR;
- .
END' ECHO; /*
’
'
R O U T I N E TO OUTPUT CHARACER G I V E N . O N L Y
ACTER
•
. 22 '
CHARACTERSOUT:
I
( CHAROUTPUT) . PUBL
' •
'
DECLARE CHAROUTPUT BY TE ;'
- '
CALL CHOUT ( . C H A R O U T P U T ) ;
RETURN;
' x- •
' END CHARACTERSOUT;
'
LCJ
23
24
r 25
■26
2
2
2
2
..
/
*
"
THE. CHAR
PROCEDURE
■
•
'
R O U T I N E TO CHARACTER I N P U T
R E C E I V E D FROM . TTY
- -
■
RETURNS
•
CHARACTER.
C H A R A C T E R I N P U T : / PROCEDURE BYTE P U B L I C ;
- ' DECLARE TEMP B Y T E ; .
-V‘ .
• *v TEMP =
CHIN;
RETURN -TEMP; '
.
'
END C H A R A C T E R I N P U T ; ' -
27 ■ I ; •
28
" 2 •"
29 , 2 '
30
2
31 . : , 2 .
/*
"
.
r
GENERATES A CARRI AGE
*/
•
-
'
RETURN AND L I N E
' -
FEED
'
" "
P LM80
C O MP I L ER
32
I
2
34
• 35
36.
2
2
2
i
; .
3738 .
39'
.-
I
2
2,
DRIVERS
I
C A R L N F : PROCEDURE P U B L I C ;
/ + OUTPUT CARRI AGE R E T U R N * / '
CALL CHARACTERSOUT ( C RE T ) ;
/+OUTPUT L IN E F E E D */
CALL CHARACTERSOUT ( F E E D ) ;
RETURN;
END .CARLNF;
•/*
'
■/
. - P R I N T CONTENTS .OF BUFFER TO ‘OUTPUT
Q U I RE S ADDRESS OF BUFFER ' -.
33
T E L E T YP E
'
'
TC
'
' ' .
' ' " /.
•
/*
*
' ^
'
-
'
'
. '
--
-/*
'
'
"
. RE
•. '
\
'T '
CARRI AGE ,RETURN. •
. .
.
•
. -- .
.
-
F I L L B U FF E R. F R OM KEYBOARD.
. DRE S S. MAX 2 5 5 CHARACTERS
. *7 '
.
DEVIC E.
""
S T R O UT : PROCEDURE-' ( B U F R ) E X T E RN A L;
'
•" DECLARE BUFR ADDRESS;
END STRS OUT;
43.
I • ■
‘
44
2 ■ '
45- • 2
46
'2
Al
2
48
-.2
49
2
50 ■ 2 .
-
/
I-.
2
2 .
.
•
. L T N O U T : PROCEDURE ( B U F R ) E X T E R N A L ;
'•
'• DECLARE B U F R • ADDRESS; "
‘
END L I N O U T ; '
P R I N T BUFFER CONTENTS' WI THO UT
R E Q U I R E S BUFFER- ADDRESS '
40
41
.42
'
-
•
'
v
'
REQUIRES
'
J'
BUFFiER AD
-
,
■
, K E Y B O A R D I N P U T : . PROCEDURE ( BUFR ) REENTRANT-.
v ’ PUBLIC;
.
. . . "
'
' DECLARE B U F R . A D D R E S S r
V
DECLARE ( B U FL ^ COUNT, CHAR I N P U T ) BYTE;
DECLARE: ( CO NT E NT BASED B U F R ) ( 2 5 5 ) . BYT
Er
BUFL=255;
L.OOP0 : ' COUN T= 0 ; ■_ - LOOP I : C H A R I N P U T = ECHO;' /
I R C HA R I NP U T = CRET
THEN GOTO ' E X I '
T ,.'
/ * E X I T I F CARRI AGE R E T U R N * / ' :
94
PL M80
COMPILER
52
TELETYPE DRIVERS
2
IF
C H A R I NPUT
FEED
THEN
GOTO LOO
.P U
5 /
2
55
. 56
■ 2
3
/ + L O O P BACK I F L I N E F E E D * /
I F C H A R I N P U T = RUBOUT
THEN _
_/*RUBOUT" R O U T I N E * /
RUB:
DO;
I F COUNT > 0 THEN COUNT = COUN
T -IJ
58
59 '
60
61
3
3
3
2
62
2
63
64
65
66
67
6 8 :
69 :
■7 I.
.3
'3
\3
’2
■2
2
2
73 ■
74
2
2
75
2
CALL CHARACTERSOUT ( D A S H ) ;
GOTO L O O P l J
"
• END RUB;
I F C H A R I NPUT = CNTRLX THEN
■\
/ + W I P E O U T R O U T I N E , ENTERED BY CONT
.
RO L. X * Z
77
78
79
80
81
82
'
2
2
2
■ 2
2
I
NEW
3
.
^
1•
.;
•
DO7 .
/.
/ + OUTPUT S L A S H * ' / .
CALL CHARACT E RSOUT ( S L A S H ) ; . ; "
CALL CARLNF J '
;
x
'. .
GOTO LO OP0 ;
END NEW;.
CONTENT ( I +- COUNT) = CHAR-INPUT;
COUNT =' COUNT + I ;
■'t
I F ^ COUNT. > B U F L - I THEN GOTO W A I T ;
I F C H A R I N P U T = CRET. THEN GOTO $ X I T ;
/ + E X I T ON.CARRIAGE R E T U R N * /
^ .
ELSE GOTO L O O P l f
-W AIT:
CHARINPUT = C H IN ;
"
/ + W A I T FOR.CARRIA GE R E T U R N * / I F CHAR I N P U T. = CRET THEN - GOTO. E X I T
• ELSE GOTO W A I T ;
E X IT :
■ "CON TEN T ( 0 )
CALL CARLNFJ
RETURN;
' ' ■ '
END K E Y BOARD I N P U T ;
END TELE TYPE D RI VE R;
I
COUNT;'
95
PLf/80
CO MP ILE R
'
TELETYPE
DRIVERS
I
MODULE
INFO RMATIO N: \
•' . CODE AREA S I Z E
= 01 I BH .
V A R I A B L E AREA S I Z E ' = 0 0 0 3 H
. MAXIMUM STACK S I Z E = 0 0 0 B H \
' 12 2 L I N E S . READ
0 PROGRAM E R R O R ( S )
E ND OF ’ P L / M - - 8 0
COMPILATION
' 280D
3D
• IlD
: ,
Z
I
^
.
96.
A SM80. D V R S U P . SRC SYMBOLS NOPAGI NG
!
PPORT')
I S I S - I I 8 0 8 0 / 8 0 8 5 -MACRO AS SEMBLER,
T E L E T Y P E D R I V E R SUPPORT ‘
LOC
OBJ
LINE
.
■
.
■
■
•
00EC
SOURCE
I
2
7
SU
MODULE- .
STATEMENT
; TTY
0EDH
0ECH
3
COMMAND
TTY. DATA. CH
S
■ •'X
.
■
J
8
S
9
\
I
10
.
11
■
"
-,
-
V3 .0
DSEG
TTYC '
EQU
CHANNEL.
•
- 3 TTYD : - EQU
.
ANNEL
.4- J
-'
5 ;■
6
•
CSEG
I :
00ED
■
T I TLE C ' T E L E T Y P E - D R I V E R
12
-
I
ROUTI NE T O , O U T P U T A, S T R I N G . S T RI N G
ADDRESS. I N ' B C . F I R S T BYTE OF S T R I NG
S
I S
THE NUMBER OF CHAR I N RESJ OF S
TRING .
H L , DE RETUR
S ' USES REG H L , DE BC, AF .
NED I N T A C T . '
V~
.
-.
J
J
I
'
0000
' 0 001
0002
0003
0 0 0 4.
’
.
D5
55
V -
’ - - 1 3 ' i -■ . ■■ - '
■ '
I 4 STROUT:' PUSH
• .
15
16
17:
I8
■ ' -
6 0 "I
69
5E
UNT
0005
•
TB
i 9
D
PUSH- -. - H .
H,.B
' MOV
. MOV X L, C
E, M
MOV
IN E
MOV „
A ,E
-
-
v
z
•\
.
I
■■
-
*
'
'
■-
- :
^ ...
S
P U T ' CAHR CO
S
CHAR COUNT
'
97.
IS IS -II
8 0 8 0/8 085
MACRO ASSEMBLER TELETYPE
IN
-0 0 0 6
FE00
•20
A
CPI
■
0H •
CA I 9 0 0
■'
0 0 0 8 ' 0 3.
/
C
21
CHAR
- 22 S C R l:
23 ;
v ' 24' j - - - -
y .
J SEE
.
HAR
0008
DRIVER- SUPPORT
JZ
INX
.
SCR2
• "B,
/
J JUMP
J INC
IF
IF
NO C
NO
BUF PTR
'25
J ENTER' THE - CHARACTER OUT ROUTI NE WI
TH THE BUFFERS SET FOR PLM CONVENTI O
N
.
.
2 6 J • BC C O N T A I N S THE ADDRESS O F / THE BYT .
E TO BE' O U T P U T . E C O N T A I N S THE -NUMBE
I
R OF
2 7 J BYTES R E M A I N I N G * . BUT I S NOT- ■ •
- P A S S E D TO THE R O U T I N E . CH s
■ ’
'
OUT. ’
2 8 -S------. - - r
-
29' S
30
CALL
, CHOUT
J OUTPUT. CHAR
x ACTER
. DCR
J-DEC CHAR. CO
E
31.
.
UNT
*
; • ■•'.
y''
CAl 9 0 0 . .C
32
SCR2JZ
J OUT LOOP-.
F A l 900 ' 'C .' •
33. ;
' " . . JM . :: ' S C R 2 :'
..J E X I T I P M I N '
USOF ' CHAR
' ,
■ ,A --"
/
C30B00 C - -. 3 4 JMP '
-SCRl- ' ' • . J GET- ANOTHER
•
t . " • CHAR - '
E.l
’• • ' v' ■ ‘ 35 S C R 2 :
POP
. H Dl
' .
'36
D ■;.( -.
POP
C9
37
RET. r
38 J
X
3 9 ; -------------4 0 J ROUTI NE' TO OUTPUT- A S T R I N G AND SUPP
LY CAR RI AG E RETURN AND L I N E FEE.D
0 0 0 C CD2F00 .
. 0 0 0 F. I D .
#.
001 0
0 01-3'
00 16'
00 I 9
0 0 I A'
0 0 IB
C
-.
'
•
.*
98 .
I SI S-J.I ■8 0 8 0 / 8 0 8 5
Iv-ACRO ASSEMBLER TELETYPE D R IV E R . SUPPORT
'
..
/
• /
001 C CD0 0 0 0
00 I F CD0000
0 0 2 2 C9
C
•- E - . " .
)■
41 .; NO R E G I S T E R S
4 2 ; _ ---------43 S
4 4 L I N O U T : CALL
CALL
•45
. RET .
'46.
47
‘ /I C
49
50
■■
DBED
0025
E 6 02 .
54
*
0027". 'CA 2 30.0
0 0 2A
55
• c
DBEC
56
.7
,
0 0 ZC E 6 7F<
• •002E" C.9 .
.
\ N '
'^
;
\
-
'■
0 0 2 F ES 0 0 3 0 60
0031 69
57
, 5 8 ..
•5 9
.6 \o
.61
6.2
63
64
65
66
67
'
.
*
A --------iROUTI NE TO READ A CHARACTER FROM T
TV.
RETURNS. BYTE I N A". " NO OTHER
R E G I S T E R S USED.' A L L O TH E RS . ' RETURNE
D INTACT.
>
_.;
-
*
0023
V
STROUT
.." CARLNF
'■ ' '
’
CI
52
53
USED
.
CHIN: .
WORD "
IN
TTYC
1 -
■-
' J READ
•
STATUS
'.
AN I
• J MASK
CHEC
■ '2 H .
K- STATUS WORD , .
■CHIN. "
S WATT
I F 'NO '
JZ
DATA
. TTY D ',
;
I N P U T DATA .
IN
WORD ■
ANI
■ 07FH
. i REMOVE PARl '
TY B I T
..
RET
I
;
_
___ _ - - -J ROUTI NE 1 TO OUTPUT- CHARACTER. •. ADDR
E SS OF CHARACTER. I N BC. USES A F j B C j H
L..
HL^ DE RETURNED- I N T A C T
i ------------J
RUSH ■ . H • x
CHOUT:
'
." V - '
.
,
MOV
H j B-'' "
MOV
L j C.''
; PUT CHARACT
■
ER ADDRESS I N HL
.
■
-
-•
■ ,
1■
99
I S IS -Il
8 0 8 0/8 085
MACRO ASSEMBLER TELETYPE
0 0 3 2 . DBED.
68
0034
E60I
69
0036
CA3 2 0 0
•7 0
0039
7E
7 1-
" I .
.7 2
. 73
•74
0 0 3 A D3EC
003C El „ '
0 0 3D C9
■:
79
<
PUBLIC
CHIN
SYMBOLS
C 0023
•
E X T E R N A L ' SYMBOLS
C A R L NF E 0 0 0 0 ’
• U S E R SYMBOLS'
C A R L NF E 0 0 0 0
"
•
T
'
" Y
-
-
C 002F
0000 "
:
.
LINOUT C 00 I C
TTY C . ,A. 0 0 E D
.
-
CHIN
\ .
/
COMPLETE >
\
•
'-•
■
C 0023' "
CHOUT.'.. C 0 0 2 F
001 C
S CRl
VC 0 0 0 B•
19
STROUT C 0 0 0 0
N O . ERRORS
-
STROUT C
TTYD . A 0 0
'■
-
T TY C
A 0 0 ED
TTYD
ITLP C 0 0 3 2 - • ■
AS SE MB LY
.
, EXTRN-'
CARLNF
- , %
P U B L I C ' C H I N j T T Y C , T T Y D , G HO U T
, LlNOUT>STROUT'
/
- . END
" .
.-
'
'
IN
'
/
CHOUT
SUPPORT.
' i READ " STATUS1
' -TTYC
: '
,
; MASK & CHEC
"AN I . .
0 I H- , .
K STATUS WORD
, . . JZ
W A IT L P
i W A I T FOR TT
Y TO CATCH UP I F ZERO '
"
; WHEN■TTY RE
MOV
A ,M
A D Y j. PUT CHAR ' I N . A- •
; OUTPUT CHAR
. OU-T
. TTYD .
. - ' ; .POP'
H ' "
'
.V
RET
• ■
WAITLPr
■WORD
75 ; .
76
77
78
DRIVER
' /'
- LINOUT C
SCR2
C 00
V
,
A 00EC
W
100
I S I S - I I P L / M - 8 0 V3'. i C O M P I L A T I O N OF MODULE T E L E T Y P E DRI VER
OBJECT MODULE ' PLACED I N D V R P T Y . O B J
. C O M P I L E R I NVOKED B Y :
: F 1 : P L M 8 0 D V R P T Y . P L M NOPAGI NG CODE P R I
■NT-C D V R P T Y . L L T > T I T L E ( ' T E LE TYP E D R I V E R ' )
- "
-1
TELE T Y P E D R I V E R :
DOS
'
' I '
"
'
.
-
D A T A " ' I N I T I A L I Z A T I O N . F O R. COMSJANTS
■.*/
'
' DECLARE CC R E T , F E E D , RESET> SET", RUBOUT, DASH, C
: N T R L X , SLASH') BYTE PUBLIC." D ATA( 0 D H , 0 AH, 4 0 H , 0 CF
H , 7 F H , 5 F H , I 8 H , 5CH). J. •
. 'i
.I
v*
■.
PROCEDURE
* z
'
TO RESET. 8"251
RE TM D :
PROCEDURE
PUBLIC;
;
STATEMENT
# 3
; PROC
RETMD
O U T P U T ( O E D yH ) = R E S E T ;
S STATEMENT-
.5
. , # '4 -
,,
RESET
0EDH
LDA
OUT
- 0008
3A0200• •
) 0 0 0 B • D3ED ' '
• ■
RETURN;
I
STATEMENT"
# S000D
RETl
C9
END
RETftD;
;
#
STATEMENT
6
/*
PROCEDURE
TO SET
8 2 5 1 MODE
( DO F I R S T ) /
. .,-V:
101
PLM80
CO MP ILE R
TELETYPE
DRIVER
W IT H ASSEMBLY MNEMONICS
-
-
*/
7 .
r
.
I
SETMD:
PROCEDURE
PUBLIC;
i.
STATEMENT.
# 7
I • ' ; p r o g . S e t m d '.
OUTPUT ( 0 E D H ) = S E T i '
!
'
J. STATEMENT
.
# 8
LDA
OUT
000E'. ■3A0300
0 0 1 1 ' D3ED
9'
return
SET.
0EDH
;
STATEMENT
# 9'
0013
C9
- '
END
<
SETMD;
RET
;
#
10
GET CHARACTER FROM . 8 2 . 5 1 OR U
SE ANOTHER R OU TI N E WI TH §AME NAME
*/
./■
Tl
12
1
STATEMENT
-.
CHIN;
PROCEDURE BYTE E X T E R N A L ;
.• E ND- C H I N ; ■ . '"
'
x
2
/ * '.
. T ; -•
OUTPUT. CHAR TO- 8 2 5 I . GIVEN"' I T , S ADDRESS
c
13
I4
15
•16
1
2
2
I
^
* / .
/
.
'•
.
.
• .
.> ■
•
IN
;
' "
REG Bx
..
-
: ' '
'
.. , . . "
"-'-•..
- '
" -• ' ' . ' '
- CHOUT: -,.-PROCEDURE CCHAROUT).; E X T E R N A L ; DECLARE. CHAROUT. ADD.RESSJ v
'END CHOUT; ‘
■■■'.'
■•
.V
'
t
./*
•.
' "'•
R O U T I N E TO GET CHAR FROM TTY KEYBOARD AND ECH
O I T TO T T Y P R I N T E R
*/
.'
_• E CHO:
PROCEDURE BYTE P U B L I C ;
. .
; STATEMENT
#
16'
^
I
•
102
PLK80
17-.
18 '
C O MP I L ER
2 '
2
'
- ‘
19
2
2
"
DRIVER
W I T H ASSEMBLY MNEMONICS-
J PROC
ECHO '
DECLARE CHAR B Y T E ;
CHAR = C H I N J
. .
-
'
-
. / '
T . ’
"
; " STATEMENT-
'
" # \ l8 *
. 0 0 1 4 ' CD0000
CALL
0017 .'320000
STA
CALL CHOUTC. C H A R ) ;
r
.
20
TELETYPE
#
19"
0 0 1A
0 0 1D
T
.
- .
CHIN
CHAR
'
' '■
.;
■ :
STATEMENT
: - "v
010000
- LXI
C D 0 0 0 0 ..
: CALL
R E T U R N .C H AR ;
. .
ESCHAR, . CHOliTv .
V STATEMENT
21.
■
# 20
0020
3A0000
0023
C9
-■ .
END ECHO;
..
..
2
-
-
v
LDA
RET
' CHAR '
. '
;
'# 21
/*
'
ROUTINE
■ ■ ACTER
.
•
STATEMENT
■'
TO OUTPUT
CHARACER G I V E N
ONLY THE C H A R •
x
22
' CHARACTERSOUT:
I
-
- ;ic r .
, •/.
- /
"
■
-
22
■'
.
PUBL
• ' .
.y ;
;
2
2
' '
.
. #
23
24 '
PROCEDURE , ( C H A R O UT P UT )
.v- v v-:'
STATEMENT.
'
•' :
Ch a r a c t e RO UTV
■0024 *2 1 0 1 0 0
LXl
H j. CHAROUTPUT
■
0 0 2 7 ■ 71
• ■ . MOV
M,.C. '
.-V
^ ' .
DECLARE CriAROUTPUT B Y T E ;
CALL CHOUT C . 'CHAROUTPUT) ; •
"
; STATEMENT
0028
-002B
-
24 •
prog
'
.
0 10100
CD0000
,
LXI
- v -; CALL
"-N v
•. • •
- B i CHAROUTPUT
.
CHOUT ^
.'
.^
v
-
■ Z-
\
-
103
P L M8 0
CO MP ILE R
TELETYPE
25
DRIVER
WI TH ASSEMBLY .MNEMONICS
RETURN J
}
STATEMENT'
S
STATEMENT
■ '
; # 2 .5 . .
002E
C9
RET
, .
END CHARACTERSOUTi
■26 '
•
# 26 .
■" / * •
R O U T I N E . TO CHARACTER
R E C E I V E D FROM T T Y
.*/
■
•
•
28
. 29
2
'
30
# 29
002F
CD0000
0032' 320200
;
RETURN
31 :
' . # 30 •
- '
0035 " 3A0200 '
LDA '
TEMP.
0 0 3 8 " ' C9
'
. RET .
'
END CHARACTERTNPUT;- ;■ ".
/ /
r
• -!
PROCEDURE BYTE
; PROC
CHARACTER I N P U T '
DECLARE TEMP B Y T E /
V' TEMP = - C H I N ;
2
. v CALL
' STA
TEMP;
•
:
.
. ■
-
P U B L IC /.'
STATEMENT
" ■x
'
■
;
STATEMENT
;
STATEMENT'
;
STATEMENT
CHIN
TEMP
\
■
CHARACTER
'
. CHARACTERINPUT:
# 27
I N P U T i RETURNS
-
x ,
:
* .31
GENERATES.A
CARRI AGE
RETURN- AND L I N E
* / ■ '•
FEED,
■ '
CARLNF:
PROCEDURE. P U B L I C ; '
' '
• >■ 3 2
. .
.
■’ ' ' - -'
. ; • PROC
CARLNF
/ + OUTPUT CARRI AGE R E T U R N * / '
-32
v.
S
;
.
..
STATEMENT
•
104
PLM80
33
• -i
COMPILER
2
TELETYPE
DRIVER WITH ASSEMBLY MNEMONICS
CALL CH AR ACTE RSOUT ( C R E T ) ; •.
- .
; ' ■
' ;.
- ; STATEMENT
* 33.. •'
0039
2A0000
LHLD ' v CRET
:
003C
4D •
„
: MOV
C,L
'
003D
CD2400
'
' CALL
CHARACTEROUT
/^OUTPUT L IN E F E E D * /
CALL CHARACTERSOUT ( F E E D ) J
J STATEMENT'
# 3 4
■
L HL D
0 0 4 0 ' 2 A 0 1 0 0 ,FEED
- :• '
0043
4D
r"
Aov' '
Ci Li
0044
CD2400
CALL !
CHARACTEROUT
' ■ ' '■
RETURN;
J STATEMENT
# 35
0047
C9
' RET' END CARLNFJ
J - STATEMENT
# -36
•
,
^
2
'/ * - • • • ■ .
1
• P R I N T CONTENTS OF BUFFER. TO OUTPUT
-■ ■ . Q UI RE S- ADDRESS' OF BUFF ER
'■■
37
38
39
.
■
..
\
'
2
/*
40
1
. fl
2
42
'
■■
■
'•
i ' .
P R I N T BUFFER CONTENTS WI THO UT
' 1
R E Q U I R E S . BUFFER ADDRESS
'
2
•
L I N O U T : PROCEDURE- ( B U F R ) EXT ERN AL;
■ DECLARE BUFR ADDRESS;
END L I N O U T ; ' ' -•
1:
2
■■
*/
D E V I C E ... . RE
•
f [
' -
L-
■
CARRIAGE . RETURN.
' ■
'
"
_
" ^ - . ' '
' : , / S T R O U T ; PROCEDURE ( B U F R ) E X T E RN A L; .
> -DECLARE BUFR . ADDRESS;
. ' '
END." STRSOUT-J. ./* .
/- '
'
F I L L BUFFER FROM KEYBOARD. R E Q U I R E S BUFFER AD
DRESS ► MAX 2 5 5 CHARACTERS
. ‘
-.-J -
:
::
-
-
-
:
:
'
^
\
"
•/
105
P.LM80 COMPILER
TELETYPE
DRIVER WITH ASSEMBLY MNEMONICS
J
*
43
I•
-
'
■
■
■
K E Y B O A R D I N P U T : . PROCEDURE ( B U F R ) REENTRANT
PUBLIC) v
\
.
) ' STATEMENT
# 43
'
■. $ PROC ' KEYBOARDt NPUT
0 0 4 8 . . 3B
/ ■.
- DCX ' .
SP 0049
ES
, PUSH
H
,
004 A
CS
'
....
PUSH
B
'
. DECLARE BUF.R ADDRESSf
z
DECLARE. ( 8 U F L , COUNT, C H A R I N P U T ) BYTE)
'
DECLARE . (CONTENT BASED B U F R ) . . ( 2 5 5 ) . BYT
"
- 44
. 2 '
■ ’ 45 '1 \ 2 . •
' 46 2....
UJ
i
47
/
'
BUFL=255) .
2
#
004B
004E
004F
4 8 -- 2 ■■
47 ■
■ \
210200
39
36F.F
LOOP0 r
_
)
V
STATEMENT
»
•
LXI
DAD ■
MV I
COU N T = 0 )
H,2H.
SP
M,0FFH
' •• • •
). BUFL
’
■
.
V
-
* ) 'STATEMENT
CO
I
■
LOOP0:
LX I.
... 0 0 5 I
210300
.
DAD
' '■0 0 5 4 - 3 9
:. .
. 0055. . 3 600 M VI- .
. L O OP l : C H A R I N P U T =
2
- .
-■
49
'I
' -' -
#
H , 3H \ • ) ' COUNT „■
-SP.. .
- M.,0H -I
ECHO).
- S -.STATEMENT
49
•
LO O Pl:
0057.
005A
1
50.
'2
, 005 D
005E
I.
-
CDl 4 0 0
210400.
39
77
ECHO '
. H , 4H
CALL '
LXI
.
TE
DAD
MOV
CHARINPUT
V I
-
.)
SP
M, A
CRET.-
THEN
" T')
:
'
■ V
•
•' v :•
CHA RI NP UT
GOTO E X I
706
COMPI LER
PLM80
•
T E L ET YP E ' D R I V E R W I T H ASSEMBLY MNEMONICS
.
f
'Z -
••
■
.
005F
' ' -V 0 0 6 2
'
'0 0 65 '
0066
"■■■ _ x - ■ . 0 0 6 7
#
,
y
50
3A0000"
210400
39
BE • ‘
C26D0-0
>'
--
# 5 1 '
C30401
—
00 6 A
,
•
Pl J
1 , \
# 5 2
3 A 0 I 00
C06D
0 0 7 0 ' 2 I 0 400
0 0 7 3 ' 39'
'..
0 0 7 4 .BE
C27B00
0075
# ''53
' 0 0 7 8 " ' C 35 7 0 0 ■■
5 4'
.2 : ,
'
' '
." '
.
„ - # 54
3A0400
. ■' .0 0 7 8
210400
007E
0081
39 .
BE '
.■ 0 0 8 2
C29F00
0083
55.
. 2
■•’ V
■
*
'
. . . • '
STATEMENT
I
C H A R I NPUT
•
/«
■
-JMP-
I
.
E XIT
STATEMENT
•
- -
§1 :
/ * E X I T I F CARRIAGE R E T U R N * /
THEN GOTO LOO
I F CHAR I N P U T ' = FEED
'
/
,
S
STATEMENT
. \
LDA
.LX lDAD
.CMP'
JNZ'
.. * ■
.
S
'
2
•
-CRET
H,4H
SP
' M '
81
.
■:
52
LDA ’• •
LXI .
DAD.
CMP
JNZ
;.
.
.
-
FEED
H , 4H
SP. ..
.M
"82
■
;
'
;
■
-
CHA RI NP U T
STATEMENT
J M P . ' ’ LOOPl
• ■
••
.@2 :
r' ' '
/ ♦ L O O P BACK I F L I N E F E E D * / .
' IF- C H A R I N P U T - RUBOUT . THEN ■
- .
j .'STATEMENT
.. t I
''
■■ ■'
LDA' _ . . RUBOUT
- J ' CHARI N P UT
' 'H, 4H
LXI " ’
SP
DAD
,
M
- ■' ■
CMP
JNZ
@3 ' "
/♦RUBOLTT - R O U T I N E * /
S
. DO;
RUB:
. J STATEMENT
; /
v;
■
;
.
. •- . - " %
' -■
' \
4
! - V r. - 1
; ..
T
107
P.LM80
"TELETYPE
CO MP I LE R
\
S
•
*
DRIVER
WI TH
55
RUB:
56
IF
3.
T -H
—
Z " 0086
0088
008B
0 0 SC
008D
..
-
■ MVI
.LXT;,.
" DAD
CMP
JNC
\
# 57
•
210300
39
35 ... ...
.0090
0093
" 0094
COUNT >" 0
" "
■.
# .5 6 ""
3E00
" . /'
:_210300•
" 39'. • BE-"
D29500 ,
\ -
LXI .
DAD
. DCR
58
;
3'
: 59
•:
3
■(■
CDASHvi "
; i STATEMENT
. ..
J M P / ;•
( E N D RUBi ,
6 0 1. . 3
.
-
STATEMENT
.■
. —
. ■
# 5 9 •' '.. /' '■ '
•-*. . . '.
C3 5 70 0 ". i -
—■
/ 00?.C
'.J
'" "
4
. DASH
•
LHLD
MOV
. C ,L '
CHARACTEROUT.
' CALL •
GOTO LOOBTL .. •
- :
* " . i ": STATEMENT
■• • • ,
"# 5 8
2A0500
. 0095
4D ",
0098
.. 0 0 9 9 : " C D 2 4 0 0
- .
"'
C A L L . CHARACTERSOUT
-
-
'\
COUNT ’= . COUN
THEN
- j
A,0HV "
. i ■ COUNT •
H, 3H '
SP .
M
@4".. ■"
"i STATEMENT
•
"
H,3H
i COUNT.
• ^ SP
M. ' " . .
■"'@4:
.
MNEMONICS
ASSEMBLY
LOOP I"
".
■ ■;y "
/.
-
i- STATEMENT
#. 6 0
■@3 :
•
61
2
IF
'x
- ■
009F
00A2
CHAR I NPUT. = CNTRLX .THEN
i STATEMENT
# 61
3A0600
2 I 0400
LDA .
LX I.
CNTRLX
H , 4H_:. ■ ,J ' CHARI NPUT
'
PLM80
COMPILER
00A5
00A6
00A7.
-
:
• /
2
62
TELETYPE
•
V
■ 66
.
(
.
V ;
r
3
1
: ?00B4
' CARLNF
CALL
GOTO LOOP0J
’
X ^ •
.
"
■' I
# 65
•
C 35.1 0 0 '
JMP
END NEWJ-
.
.■ • •.
6 7.
:-6 ^
-
2%
. ».
■' ■ ■ ,
-'
# 67
• 00B7
210300
00BA
39
7E
00BB
3C ,
"
0 0B C
4E
^00 BD
. 0 0 BE-' 0.600 •
-
:- @5
CONTENTCl
'
.
/
.
STATEMENT .
J
I
LOOP0 •
. ■ ’
■
'i
■i ■■
STATEMENT
,.
" >"
:
LHLD1 • , SLASH ,
'
X
'
C
,
L
.
MOV
• " CHARACTEROUT
:
CALL.
CALL CARLNFJ ■■
■ .
■
J STATEMENT
;
# 64
00B I ■. CD3900
3
J
. " ^
•
' I
,
^
, /^ O U T P U T ".SLASH*/ ■
CALL CHARACTERSOUT ( S L A S H ) J
J STATEMENT
■
r ;‘ ■
3
.!
N
-NEW:
# 63
00AA
2A0700
4D.
0 0 At)
0 0 AE > - C D 2 4 0 0
, ■■
DO;
# 62 / .
■
64
.
NEW:
• ./ -
3
: 63
6 5. '
SP
DAD
M ■'/
CMP
•
85 . ' ' "
J NZ
/ * W I PEOUT R O U T I N E , ENTERED BY CONT
x
39
BE
C2B700
ROL X * /
V ■ 7'
-
. ..
DRIVER' WITH ASSEMBLY MNEMONICS
j . >• ' . \ . ;v
+, COUNT) '=
STATEMENT
■.
CHARI NPUTJ .
J STATEMENT/
J •COUNTH1, 3H
LXI ■
DAD
SP
■ '
A ,M
MOV^ ■
INR
- •s
: A . '
C, A
MOV '
/B ,0 ' MVI L
•
109
. P.LM80
•‘ .
■. 6 8
COMPI LER
TELETYPE
00G0
EB
IB
■. 0 0C 1
•0 0 C 2 , I B ' ■- ...
0 0 C 3 - TB0 0 C 4 " "CD 00 00
I
'0 0C7
.13
13'
1 00C8
13 "
'0009
0 0 CA
TA • 0 0C B ■ 7 7
2 .
*.
•—
•.#' 6 8
EB
0000
0.0 CD
2B
00CE
34
69
-2
# 69'
0 0 CF
2B
0 0 D0
7E" .
0 0D1
3D
; - ■ : 0 0 D2 ' 2 3
' -V■ 0 0 D 3 " BE : . . '
D2DA00 '
00D4-
• .v
XCHG ■
■ DCX ■ ' D
,
D - -.
•.
'.DCX
■
>DCX ' •" "D
CALL ;
@P00T3'.
*
D
.: TN Xv
. IN X :
.
D '
D
INX
' LDAX •
D'-.:
M , A ..
■ MOV COUNT - . C O U N T ' + - I T - .
;>
. i -.s t a t e m e n t
. •
. /
:x
1 -•
\.
XCHG
' v , x.
'
DCX •
.. H
;
- ; -• ■
'
INR .
M
I F COUNT > B U F L - I THEN GOTO W A I T ; v
; STATEMENT
.
.
.^
' 00D7
I
71
2
\
*
*
Z
0 0DA
0 0 DD
' 00E0'
_ 00E I
’ 00E2
# 7B '
C3EB00
<■
. IF
D R I V E R ■W I T H .ASSEMBLY MNEMONICS
DCX
.
;
,MOV
.' ; • DCR ■
INX
■ ".CMP ' ' , . ONC . :.
S .
H. .
A, M
A
H
M
§6
. I ■
..
STATEMENT
\ ■' . v /. - ,
WATT . .
• , J MP :
..
. '
@6 :
: .. '
' •.
C H A R I N P U T = C R E T ' THEN G O T O - E X I T i . '
-J
.
. J STATE ME NT
# 71 ' 3A0000
210400
3 9.
' ;
BE
C2E800 ' ■
LDA.. . .. . .CRET : :
‘ H j 4H
L X I ■’
DAD " - : - . S P
' CMP:
. . M
. • J N Z • / @7 ■
i . CHA RI NP UT
-.
'■
;
.-V 7
-I . V
,
no
: P LM80
COKPH-ER
TELETYPE
DRIVER WITH ASSEMBLY MNEMONICS
"
:
....
: ^ STATEMENT
72
. •' . . ..
-00E 5
C30401 . .
. . . JMP
- E X IT
■
v.
■■
"
. •
■ @7$
‘ . " / + E X I T ON CARRI AGE R E T U R N * /
' ' /
ELSE GOTO L O O P l f
f STATEMENT
# 7 3
/
00E 8
C35700
JMP'' .' ■ LOOPl
'
*
73
2
• .7 4 ;
2
@8?
'
'
• i.
■/
-\
: '» 7 4
.
00EB
00EE.
00FI
00F2
.7 5
WAIT:
CD0000
210400
39
77 .
' 2'
.
'
CHARI NPUT' = C H I N f •
,
; ■.....
%' J .s t a t e m e n t "
\ .
7
W AI T: .
■ / ★ W A I T - - F O R CARRIAGE*. R E T U R N * / :
CHJN..
.
CALL
LXI
Hs 4H
f CHARI NP UT •
DAD
SP.
' ■ Y-:.
■ '
MOV
M, A
I F C H A R I N P U T = CRET THEN GOTO E X I T .
-
. •
. # 75
0 0 F 3.. 3 A 0 0 0 0 1
• LbAv V
.
00F6
2 1 0 4 0 0 . ■ .r ■ . l x I
■
■
■
:
'
DAD
'
:
00.F9
39 / . ‘
•
. ■00FA-; BE
.CME,'
...
00FB
C2010I x
■J N Z
'
. *'
■# 7 6
00FE
C30401
j
..
77
2
# .77...
0101'
C3EB00.
.
-
.
n
f
CRET '.
H j>4H .. ■
SP ' ..
M
• ■•
@9:
'.....
'' '
.. ’■ :
V
STATEMENT
•
j • CHARI NP UT
’
J - .'.
. '
f ' S T AT E M E N T :
.
JMP
E X IT \\.
@9 : ' "-Y Y
. E L S E . GOTO WATTf
.. ■
.
Y
='
@1 0 : ■
- /
JMP
WAIT ^ Y
m
. f
.
/
STATEMENT
I
'P L M 80
•
78
CO MP ILE R
.
2
.
i
I
TELETYPE
DRIVER
E X IT :
/
W IT H ASSEMBLY
. CONTENT(O) '=
..
/
*
"
MNEMONICS
CdUNT)
.
'
CTA T C1k/. I
a 78
E X IT :
0104
0107
,01 0 8
0 109
0 10A
0 10B
' , 010C
' —010D
0 I 0E
' 0 I 0F
^0110
■■
*
.
•
- .2 1 0 0 0 0
39, ■'
-4E •
■'2.3
• 46
23
• 23
-7E.
. 60
.69
77
:
•
I
'■
CALL
'I
2
79
0111
2
80
■
-
0114
0115
0116
' . 0 I 17
. * . ■'
2
81
.. ; ,
I
MODULE
; BUFR
H,0H
SP
Cj M :
H ■ • '
.
B , M -'
' _ ■'
H •■
H -. ‘
..
CARLNF
# 79
CD3900
RETURN;
/
# 80;
3 3 ■■"
El
•
- ;E 1
;
• C9
■
END
" ,
ft
82<
'
LXI DAD •
.• • MOV
-.IN X
. MOV
. I N X '•
.' I N X
, "'
v MOV
" \
MOV
MOV
MOV
CAR L N F ; ■
, X
■■
CALL-
AjM
HjB ■
l ; c
M j A.: .
; -,STATEMENT
■
.
. Z.
.
.
INX '
p o p .- POP.
" . ' - ‘. R E T
k e y b o a r d in p u t
:
.
CODE AREA S I Z E
V A R I A B L E AREA S I Z E
MAXIMUM STACK , S I Z E
.
= 0118H
= 0003H
= 000BH
x f
:
■‘ \
.
’
t
"
'
STATEMENT
. •;
STATEMENT
;-
,
.
j
SP ..
H
.
>
H''
' . " ‘ X :.
81
END T E L E T Y P E D R I VER; - >■■ ■'
INFORMATIO N:
i •
'
,
280D
,
' 3D. Y -I I D-
:
,
112
■ P LM80
CO MP I LE R
TELETYPE
D R I V E R W I T H ASSEMBLY
\
1 2 5 L I N E S READ"
0 PROGRAM E R R O R ( S )
" E ND O F . P L / M - 8 0
MNEMONICS
COMPILATION
■»
'•
■■/
-
..
-• I
*
•• x
X
V
I
A
■
'
/ •
.1
f
^'
' /
Z'
!
\
/
■ >-
\
- APPENDIX F
THE FREQUENCY BOARD DRIVER
114
■PARAMETER PASSING SPECIFICATIONS FOR. THE .FREQUENCY BOARD DRIVER
The routines and labels of the module DVRFRQ.SRC:
FREQ:
The label of the entry point fo r the frequency card
reading routine.
The routine must be called with the
address of the data buffer where the count is to be placed
in register pair BC and the counting period in register
pair DE.
The contents of a ll other registers are returned
in ta c t to the ca llin g program.
'
TSTMSB:
Tests the most s ig n ific a n t byte of counter zero to see i f
i t is zero.
This routine ca lls READO and destroys the
contents of the HL re g iste r pa ir.
THIS ROUTINE IS NOT
PLM/80 COMPATIBLE.
TSTLSB: . Tests least s ig n ific a n t byte of counter zero to see i f i t
is zero.
This routine ca lls READO and destroys the con­
tents o f the HL re g iste r p a ir.
THIS,ROUTINE IS NOT
PLM/80 COMPATIBLE.
GETCl:
Label of entry point fo r portion of program that reads
counter one and converts the results to an ASCII s trin g .
READO:
Routine to read counter zero.
reg ister pair.
READ!:
NOT PLM/80 COMPATIBLE.
Routine to read counter one.
pa ir.
Returns count in HL
NOT PLM/80 COMPATIBLE.
Returns count in HL reg ister
■115
ASCII:
Converts a four d ig it BCD number into an ASCII strin g .
The routine must be entered with the BCD number in register
pair DE and the address of the buffer that the ASCII string
is to be placed in in re g iste r pair HI.
COMPATIBLE.
'
NOT PLM/80
/
116
A SM80
DVRFRQ. SRC: SYMBOLS NO.PAGING T I TLE ( ' W T C - 5 2 0 A
S I S - 11 ' 8 0 8 0 / 8 0 8 5
W T C - 5 2 0 A DRIVER
LOG • " OBJ
MACRO ASSEMBLER,
' LIN E
SOURCE
STATEMENT
I
■:2
-Y '
. 0031'
DSEG .
SC0BIN
EQU
.‘ . 0 0 1 1 0 0 0 0 8 '
NTER 0 , 2 B Y T E R/ W, MODE 0 , B I NAR Y
00 I I 0 0 0 I B
3 SC0BCD r EQU
I*
M
" BCD .- ■
'
0 070."
4
•
00B0
00B I
0079
6
7
8
^ '
0000 '
0040
0080' /
0024 •
9
10
' • . . " I I
1.2
I
_
0025
0026
0027 ■
MODULE
-
0030 ■
■ 007 I
V3. 0
DRIVER * )
'
•
. 1.3
'I4
I s'
I 6
I7
• II 8
O
19
J-COU
'I -.
S U l B I N . EQU
" .
I
5 SCl BCD ' EQU
■#
. 01 I 1 0 0 0 0 6 . .
J
"
"
B I N AR Y
0 1 I 1000 I B
:
'
.....
BCD
. ■
■SC2BIN -• • EQU
101 1 0 0 0 0 B
j
SC2BCD
EQU
101 I 0 0 0 I B
S C I MD 4
EQU
0 I I I 100I B
J SET
COUNTER I MODE 4
EQU
00000000B
LC0
EQU •. • 0 10 0 0 0 0 0 B
LCl
10000000B
EQU .
LC2 •36D
x
J I/O
EQU ..
RWC0
PORT ADR COUNTER. 0
*
37 D '•
I J-I / O
EQU ' .
RW C l '
PORT A D R1 COUNTER- I , . . ' ■ /
EQU
, 3 8D
RW C2
39 D
J I/O
EQU
P8253
PORT ADR CONTROL, WORD
CSEG
’
}
}
ROUTINE
■
-
TO READ THE
WTC52 0
-
'
EREQUEN
117
I S IS -L I
8080
8085
MACRO. ASSEMBLER FREQUENCY BOARD DRIVER
CY COUNTER CARD. PARAMETERS PASSED
I ARE THE I N T E G R A T I O N P E R I O D I N R E G I '
STER DE AND T H E ' AD D RE SS . OF THE DATA'
; BUFFER -THAT THE COUNT I S TO BE PLA .
CED I N I N . REG BCi
RETURNS -TO THE
2 2 i C A L L I N G PROGRAM WI TH THE A S C I I REP
• R E S E N T A T I O N OF THE COUNT I N THE D E S 2 3 J • I GN ATED B UF F ER .
' '•
I
'/
' 2 4 I ------------------------ ' ---------- -----------------------------------------20
.
'-21
25-. I 0000
ES
. ■
I
'0001 SE7 I
,
0003
D327 .
0005
3E 31
0007
0009
D3 2 7 ’
3E79
000B
D327 ■
' 0 0 0 D ' 3E 7 1 ,
•-
000F
00 1 I
D327 :
3E99
\
0013
0015
D325
0325
0017
7B
26
27
'
28"
F R E Q : . PUSH " • - Hi.'
-• , .
.
r
S TO USE AS BINARY. COUNTER LOAD A WITH S C 0B I N.
IN. I T A L : M V I ■
A , SC I BCD • J SET
COUNTER 0 WORD
.
29 ■
OUT
P825 3
- : J-S E f
COUNTER 0
30
MV I
A , S C 0 B C D •_
J SET
COUNTER 0 WORD ' _
-'-"I
31
OUT
,
P82 5 3
32
M V I. '
A,SC1MD4
JSET .
COUNTER 0 MD 4 WORD 33
OUT
P8253
3 4 J TO USE AS BI NARY C TR, LOAD .A W I TH
SClBIN
,
.
.35 '
MVT-. -, -. - A , S C l B CD .
■ J RES
V
E T . COUNTER ' 0
3 6. ,
.OU-T . - ' P 8 2 5 3 ;
..
.„ ‘
37
'
MVI
■ Aj 9 9 H . .
;
. J BCD
99
■
. 1
• ■■■
. 38
OUT
RWCl
.3 9
■ OUT
RWCl
.JCTR .
I NOW C O N T A I N S MAX COUNT
■
4 0 J I F U S I N G AS- BINARY- CTR CHANGE 9 9 T
O FF
x
41
MOV
A,E. .
. JGET
I N T P E R LSB ;
'
118
I SI S - 1 I. 8 0 8 0 - 8 0 8 5
MACRO ASSEMBLER'FREQUENCY BOARD D R I V E R -
■\
00 I 8 •D324 .
42
RW C0 ’ OUT
LSB TO CTR 0 ■
A* D
- '
MOV
YTE . I N T P E R I N A
•
RWC0
,■ ~
■ OUT
TE T O . CTR 0 CTRS NOW• COUNTING
J NOW SEE I F • COUNT DOWN TO ZERO
READ0.
T S T M S B I CALL
D. COUNTER 0
A
- .XRA,
OA
1 Z
.
H '
' CMP
>
,• I F MSBYTE 0
TSTMSB
.JNZ
V . ...
P I F NOT ZERO .
READ0 •
T S T L S B : CALL
AXRA ,
O A .
CMP
L
I F LSB 0
\
TSTLSB
J NZ
P I F NOT ZERO
i NOW GET. COUNT FROM COUNTER I ’
i
.
READl
G E T C l S - CALL .
; WRI
TE
00 I A 7A
43
00 I B D324
44
00 I D CD4200'
• -. ' 0 0 2 0 , AF ' . ‘ '
0 0 2 L BC
45
46
C
47
-
48
0 0 2 2 "C2-1 D0 0, '
0025
0028
CD4200
AF ■
0029
BD
002A
C22500
C .
. 49
50
5 I
C
52
C
53
.
.■
- 0 0 2D
■-
• ,
\
CD4 D0 0
54
. 55
56
57
58
59
' .
60
.
C".
..
61
j
0030
AF
'
'
} MSB
J WRI
J REA
J ZER ‘
■J SEE
S JUM
■
s ZER
;
i SEE'
5 JUM /
•
'
i ' NOW SUBTRACT FROM BCD 9 9 9 9
3
NOTES SINGE ALL SUBTRACTS -ARE DONE- FROM -99.99 THERE.
CAN NEVER
j BE A CARRY OR A U X I L L A Y . CARRY, AND T
^ERE I S NO NEED FOR D E C I M A L A D J U S T .
J T H I S I S A PROPERTY OF THE NUMBER SY
STEM AND THE PLACE- 9 9 9 9 HAS I N A FOUR
62
63 J
- 64.
JD IG IT
SYSTEM.
-Y
'
XRA-
■ A
!
I
-
>
i CLE-
119
I S IS -II
8080-8085
0031
3E9 9
0033
95
MACRO ASSEMBLER FREQUENCY BOARD- DRIVER ~
65
.
;.
'
. 0 0 3 4 . ■6 F • •
00-35
0036
6.6
I
67
af;
.
3E99
■
■
' 68
6 9.
' '
00 38 ' 9 4 - . .
0039
67
003A
EB ■ ■•
003B
003C
003D
0040
60
69
CD5800
El
0 0 41
C.9
.70
7 I
x
72
73
74
75
76
77
78
C
79
80
OI
'■ -
'
0042
3E00
0044
D3 2 7
0046
D B2 4
0 0 4 8 . 6F
- V .
-
AR C A R R I E S
S IN I
A , 9 9H
MV I
T I A L -COUNT LSBYTE J SUB
SUB ..
L
COUNT FROM I N I T I A L . ;
.
.'
, RES
MOV
L j>A
TORE TO HL
A
'
' ' . . ■
-. V
- XRA
, IN I
AT
9
9
H
,
MV I
T I A L COUNT MSBYTE
SUB
- H
'
• •
. - J SUB
HCOUNT; FROM I N I T I A L W/ BORROW
S
RES
MOV '' ' H»A ' .
TORE TO HL "
' . i.
I NOW SAVE I N - D E RE.G P A I R
XCHG
; BRI NG BUFFER ADDRESS FRdM B C 'TO HL
HfB
' MOV
MOV
. L ,C
’
• •
CALL
A S C II .
'
.
-J RES
' H
POP
TORE E NV IR ON ME NT
RET
;
.
.
X.
'
- '
-.- '
i-
82- . ; R O U T I N E ' TO READ COUNTER 0 -"ON. ■THE F
, LY'.'. RETURNS COUNT IN" HL
8 3 ; DESTROYS T H g . CONTENTS OF A REG
, 84 . >----------- r
85 ;
; S SAM
Af LC0
MVI
8 6 RE AD0 :
PLE COMMAND
. OUT
- P825 3
/ '' . J LAT
87
CH COUNTER .
;,REA
IN
-RWC0
88
v
D LSBCOUNTER
)
L ,A MOV
' ■ 89
I-S T S -II
0049
8080-8085
MACRO ASSEMBLER FREQUENCY
DB 2 4
90 ■ :
RWC0
_ .
. • J RE A
IN
D MSBYTE
HiJl A
MOV
" j NO W
'■ 91
. COUNT I N HL
'
'.RET .
' 92
9 3.. J
•9 4
-------------;--------------------- >--•------------------------ 9 5 , J R O U T I N E TO READ COUNTER I ON THE F L '
.
V . RETURNS. C O U N T , I N HL
9 6 • ; DESTROYS CONTENTS OF A REG
.
.00 4B 67
,' 0 0 4 0
004D
C9
3 E 40
•
DB25
. 0 0 5 3 6F
0 0 5 4 - DB2 5. .
0056
67
A
■ 0 0 5 7 , C9
.
- -
'
.•••■
'
' ' z
' 0058
3604
005A 23 "
0 0 SB 7 A
R E A D l : ' ..MVI
RLE COMMAND
.. OUT
100
CH COUNTER
' • IN
10 1
D LSBCOUNTER
102\
. MOV,
IN
103
D MSBYTEI 0 4s_ ' - .
MOV
COUNT I N HL
/105'
'• .. - RET '
'' 99
-
0 04F- D327
0051
BOARD DR IV E R
. - ' 1065.
' , ..
,
-
- A,LCl
. R8 2 5 3
'
RW C I . -
-
J SAM-
'.
f LAT
; RE A
LfA
RWCl
j
rea;
I
J NOW
H,A
:
'
- ■
-
.1 0 7
10 8
>•------------------------------------------------------------- :-------- ;
,v R O U T I N E . TO CONVERT 4 D I G I T BCD CQU ■
NT TO A S C I I I N' THE DATA B UF F E R .
1 0 9 ’ > R E Q UI R E S THE BUFFER A D D R E S S ' I N H L . '
AND THE BCD' NUMBER I N . DE- ;
1 1 0 J A R E G I S T E R DE STROYE D.
Ill
} -------------------------- L - - - - - - - - -----
'112 '
.
.
"
ASCII:
MVI
M».0.4H
CHAR- COUNT I N I ST. BYTE,
114
I NX'
H
.
115
MOV ■
A j- D :
-.
1 13
PUT .
, -V ■
•• :
J GET
i
'
■z
121
I S IS -I I
8080-8085
KACftO ASSEMBLER FREQUENCY BOARD DRIVER
0 0 SC 0 F
1 16
005 D
0 0 SE
005F
00 60
•v
0062
0F
0F. .
0F
E 6 0 F ■■
117
118
I 19
120
0064
77.
F 6 30
0065' 23
0 0 6 6 7A
. 121
122
'
/ ■
0 0 6 7 E 6 0 F ■■
0 06 9 .
123
. 124
1 25
' 126
F 6 30
0 0 6 B 77
006 C 23
0 0 6 D 7 B''
127
1 28
. 1 29
006'E ,0F- "
^ ' ■
0 0 6 F 0F
,
0 0 7 0 0F
" ''
007 I 0F- . •
" '
007 2 E60F
- 130
131
. 132
13.3
I 34..
0 0 7 4 - F 6 30
0076
0077
0078
0079
007 B
007 D
77
23
7B .
E60F
F 6 30
77
135
!
■ 1 36
1 37
• 138
I 39
140
■14 1
2 KSN I BBLES
RRC '
•
*
HANGE N I B B L E S
RRC
' RRC
■ RRC
00001 I I IB
AN I ;
AR UPPER N I B B L E
30H
■ O RI "
•
K A S C I I ' CHAR • ;■
KOV
M,A
E I N DABUFR V
. 7
"•
' INX
H;
'■ MOV
A , Dv
.
.
2 MSNIBBLE S .
0000 1I l l B
"
■ ANI
CARD M SN I BBLE
30H
,
: .■
■ O RIf
M A S C I I CHAR
M,A '
KOV 1
I NX
H
AjE
MOV
LSNIBBLE
- RRC.
RRC ■■ .
'i ;
■
. RRC
■ ' ' ■ RRC
0 FH
■ ANI'.
- ■ • ,
iu
AR UPPER N I B B L E
■30H - ORI .
X
I
K A S C II
Mi , A .
:
• MOV
H
INX '
AjE
KOV
0F.H-.
. '
' ANI
- ORI
• . 30H
Mj A „ ' .
;
MOV'
■. V
/
JEXC
/
• ZJ CLE
Jf o
• . . V •
r
'.
• J SAV
. . '
'•
;
<-.
- •j GE T, '
■ •
JDIS-,
. i
-
!
,
' .
. JFOR
.
.
J GE T
. . - ' V x
': J CLE '.
V
JFOR-
-I
:.
. .
.
(,
V
122
I s i ' s - 11
8080-8085
C9 ‘
■
•' ' 1 4 3
' ■144
•
'
I
.
.
/
PACRU ASSEPBLER FREQUENCY
1 42
007E
'
I 45
•
J ALL
. R
OF
BOARD D R I V E R
COUNT NOW AS1C 11 - I N - THE
BUFE
. RET.
P U B L I C . F R E Q , REA D 0 , READ I , ASCT I , TSTMS
B , T S T LS B VG ET C I
END
.
PUBLIC
. A SCI L
SYMBOLS
C 0 0 5 8 -■
X
FREQ' '
I
i
t .
C 002D
,C 0 0 0 0 , ‘ - GETCl
'
.-READL
C 0040
0042
T
S
T
M
SB
C
0
0
I
D
•
'
25 ;
'
-
; READ0
C
TSTLSB C 00
•.
■
’.
E XTERNAL
SYMBOLS
U S E R SYMBOLS
A SCI I
C 0058
R EADI - C 004D
'
FREQ
■
RWC0
\
AS SEM BLY
'
' . .
COMPLETE,-
' ■■
■':./:
■
■
'
• .
C 0 0 0 0 .•
G E TC l
C .0020 . . IN IT A L C
0001
LC0
• A 0000
LCl
: A 00
40
' LC2
A 0080
0042
A 0024
' 0026
RWCL ‘ A 0 0 2 5 .
SC0BCD A - 0 0 3 1 ■
■
RWC2
' A
'
S C0 B TN A 0 0 3 0
S C l B C D- A 0 0 7 V
■ SC
I B IN A 0070
•.
S C I P.D4 A 0 0 7 9
SC2B
.CD A 0 0 B I
SC2BI N A 0 0B 0 '
TSTLSB
: . C 0025
'
NO ERRORS .
•/
APPENDIX G
THE A TO D CONVERTER DRIVER
PARAMETER PASSING SPECIFICATIONS FOR THE A-TO-D DRIVER
The routines and labels in the f i l e DVRDCV.SRC:
MSET:
Sets the mode of the 8255 pa rallel interface chip.
This
routine destroys the A register".
RSET:
Resets the WTC-700 system,.
This routine destroys the A
register^
RDRDY:
.
In itia liz e s the WTC-700 system by c a llin g MSET and RSET.
A ll registers returned in ta c t.
RDAD:
Reads the WTC-700 120A analog to d ig ita l conversion card.
The card number and device number on the card must be
placed in register A.
The address of the buffer that
the results are to be placed in is in re g iste r pair HE.
THIS ROUTINE IS NOT PLM/80 COMPATIBLE.
DVRATD:
Calls RDAD.
The re g iste r pa ir BC must contain the address
of the buffer that the data is to be placed in .
and source number must be in register E.
The card
This routine
serves as the ca llin g routine when the A-to-D converter
is called from PLM/80.
12$ ;
A SM80
DV RDC V. SRC
SYMBOLS NOPAGI NG
• ••
\
0098
000 I
A TO U UKl
VER' )
I S I S - I I - 8 0 8 0 / 8 0 8 5 MACRO A S SEM BL ER,
W T C - 7 0 0 A TO D D R I V E R
LOC
T I T L E Ct WTC-IOO
OBJ
LINE
V 3.0
SOURCE
’
'
' MODULE
-'
STATEMENT
DSEG
.I
J8255
. 098H
2 MDSET '■ EQU
J READ
3 READ
EQU
. 01H
•
COMMAND
4 PRTA - EQU
J 8255
” : 0 4H
L E R PORT" A
- 5 PRTB ■ " EQU' 0 5 H- E ■ J " ,
"
B;
0 6 H ''
6 PRTC
EQU ■'
* * ■
I
\
SI
' ■
C
. 7 PRTD•
EQU
07-H
>825 5
D PORT
"CSEG
8 •
9 J
10 J -
i
.
.
0004
;
000 5
0006
0007
CONTRO ,
••
*■
COMMAN
J THE SE R O U T I N E S ARE D R I V E R S FOR THE
• W T C - 7 0 0 .-DATA I NTE RFACE S YS TE M.
THEY
12' J P E R M I T ANY CHANNEL ON. ANY SOURCE .CA
RD TO BE READ.
THESE D R I V E R S RE QUI R
-1E
- 13
I
A
•;
I
-
. I T
.
i 1
RESET
...
WT C 7 0 0 •
-• . -
J TWO EXT ERN AL
PARAMETERS. TO OPERATE.
PARAMETERS- ARE A STORAGE BUFF
THESE
ER
3 CALLED DABUFR AND A CONSTANT,
DABUF
L , WHICH I S THE LENGTH OF DABUFR M I N
US
-i
.
"
/;
126.
I S IS -II
8080-8085
MACRO ASSEMBLER' A - T O - O
DRIVER
-
15
J ONE.
TO SUCCE SFULLY L I N K ANOTHER
PROGRAM .TO THESE D R I V E R S THE OTHER P ■
RO.
- I 6 ‘ J GRAM MUST' HAVE T H E S E ‘/TWO PARAMETERS.
^
'- DECLARED. AS P U B L I C S .
A L L E N T RY P OI N
' :
T -.
.
I 7. ; LABLES • HAVE BEEN DECLARED P U B L I C I N
; T H I S PROGRAM AND A R E ' A CC E SSABLE TO
18 i THE- PROGRAM US ER.
FOR R E G I S T E R USE
AG E, CONSULT THEf COMMENTS . W I T H THE
19 I I N D I V I D U A L R O U T I N E S . -
20 J
■
21
S
22
J
23
'
.
:.
'
-
.
----------------- --------------------------------
24
} T H I S R O U T I N E 'CALLS' READS ANY CARD
' AND D E V I C E WHEN PASSED THE D E V I CEOCA
RD
2 5 i NUMBER AND THE ADDRESS OF THE BUFF
ER ''THE DATA I S TO BE PLACED I N .
2 6 i - - - - ------'------ ----------- 7 ;---------------------------------- ---------
\
'
. .
27
0 0 0 0 CS
28'
•’ 0 0 0 1 E l .
" "
: .29_
• ". :
- 0 0 0 2 ' CD 18 0 0 , " C ' . 3 0
.
-
0005
7B
0006
CD2300
'0 009
C9
v
-
"
'
,'
33
s
■.
D V R AT D ; ' PUSH.
B-'. ^ '
: POP
- ' H
/
R ADDRESS NOW I N HL
- ' ■'.■
CALL
• RDRDY .
W T C 7 0 0 . S Y S T E M - R E A D Y ' :' '
. MOV
' A,_E' .
D E V I C E &. CARD U I N ' C<
CALL
RDAD,
.
READI NG I N T O DABUFR
_. RET :
3 4
'
31
C
32
-
.
35
I
-
-
. .
■
.
.
. J BUF- .
..YGET
' / ' ''
JPUT
J GET
,
'
-
'
I S I S - I I •8080-8085
MACRO ASSEMBLER" A - T d - D
36
.
■
.
' x
,
.
\
-
■
.
3E 9 8
000C
D307
0.0 0E
C9
.
1•
•
J
3 7 J T H I S R OU TI NE SETS THE MODE OFy THE 8
. . 2 5 5 SYSTEM CONTROLE.R " I N THE W T C - 7 0 0
-38 J I T I S USUALLY . CALLED P R I O R TO ANY A
TTEMPT AT I / O , W I T H THE WTC700 SYSTEM
:
. .
'
'
. f"
'
000A
DRIVER
.
--
39" JTHE R OU TI N E DESTROYS R E G I S T E R A , BU
T ALL OTHE'R R O U T I N E S ARE RETURNED I N
tact. •
• ; :
.
;
40. J ' - - ------r
------ _
' .7
.4.1 > :
-V
'
. *
J GET. 825.5 'RE
A
,
MDSET
M
V
I
"
4 2 MSETi
SET
•
.
• j. SEN D COMMAN
PRTD
OUT.
43
D
RET
44
45 L".
4 6 J -----------47
.
48
J T H I S R O U T I N E R ES ETS THE E N T I R E WTC7 0 0 S Y S T E M . I T USUALLY FOLLOWS THE
J R OU TI NE M S E T . ' 'THE C ON T E N T S . O F THE
A R E G I S T E R . ARE D E ST RO YE D , BUT ALL OT
• HER" '
4 9 J REGI STERS. ARE- Re t u r n e d i n t a c t . ' . 7 —
5 0 > —- — —————
'
000F
3E08
001 I
0013
D306
3E00 "
0015
0017
D306
C 9.
•
5 1 J
MVI ' . •
5 2 RSET:
T COMMAND
■ OUT
53
MV I
54
0 0 RESET
" .
OUT ' , ~
55
• RET ."
5.6
A, 8H
PRTC
A ,0H
PRTC
. J WTC70 0. . RESE
'
I J REMOVE- WTCT
•
'
128'
I SISr-I I
8080-8085
MACRO ASSEMBLER A - T O - D DRIVER
.
58
•
59
60
6.1
■"
•
62
63
•
57
0 0 I A CD0 A0 0 :
C
00 I D CD0F00
0020 7A
C
0 0 2 1 . Dl
0 0 2 2 C9
-C
,
>■ ^
■
Y
j T H I S R OU T I N E I N I T I A L I Z E S THE 8 2 5 5 S
YSTEM" CONTROLER' AND THE WTC- 7 0 0
j ALL R E G I S T E R S ARE- RETURNED I N T A C T .
■
•*
.
• .
„
0 0 1 8 ' D5
0019
--------------- -- --------------------------------------------------------------------------
J
..
X
RDRDY 5
P
.
USH
D
■ " x.
MOV ,•
6 4".
. SOURCE .'ADR■
' CALL
' 65
DE
' " ;
CALL.
66
. MOV. •
67
ADR I N A x
.
. POP
68
.69
.
RET
•
70
•
T i
; •
• - —- —
r '
•
•
- D j-A-' - . ' I SAVE
X ‘
.
CAFfD &
- '
\
J SET 8 2 5 5 MO
I
- M SE T
x
- RSET
AjD
D
;
J CARD,SOURCE
-
•
. - , 7 2 . J T H I S R OU T I N E READS.' A SOURCE CARD A
ND CHANNEL .I N ^THE W T C - 7 0 0
\
7 3 J SYSTEM.
THE CARD ADDRESS AND SOURC'
E ADDRESS" ARE. PLACED I N R E G I S T E R
7 4 JA PRI OR. TO C A L L I N G - T H E ' R O U T I N E 'TH
" • '
E ADDRESSES I N T H E . A R E G I S T E R FOLLOW
7 5 . J T H I S CONVENTION:
THE 'MOST S I G N I E I C
ANT N I B B L E CO NT AI NS THE. CHANNEL ADDR
ESS
I
7 6 J P E R M I S S S B L E ADDRESSES ARE' BI NARY 4
THRU 7 .
THE LEAST. ' ■
’>
S I G N I F I C A N T . N I B B L E •'
" '•
- 7 7 J C O N T A I N S THE CARD A D D R E S S .
PERMISS
,
•
.
/
129
I S IS -I I
8 0 8 0 - 808 5
MACRO ASSEMBLER A - T O - D ' DRIVER
78
79
80
81
ABLE ADDRESSES ARE B I N A R Y 0 - . 1 5 .
. .,
S THE
R OUTI NE D E S T R O Y S . T H E A R E G I S T E R '
. i BUT ALL OTHER R E G I S T E R S ARE RETURN
ED
'
, •
J INTACT.
THE." OUTPUT FROM- THE DATA CARD I S PLACED AT T H E ' L O C A T I O N S P E C I F .
I E D - ...
. ' - • •
S BY. R E G I S T E R P A I R H L .
THE CHARACTER
AT T H I S L O C A T I O N B E I N G THE B I NAR Y
J REPRESENTATI ON. "OF THE NUMBER OF CHA
RACTERS IN' THEv B U F F E R .
Otd
0023
D305
0 0 2 5 'CS
0 0 2 6 ES
x0 0 2 7 0 1 F F 0 0
002A
23
0 0 2B 3 E 0 I
002D
D306
■0 0 2 F • DB06
0031
. 0033
0036
.00 38
003A
E610
•
CA2F00
C
DB06 E620
C24D00
C
I- N
• 83
o Gt
PRTB
' 8 4 . RDAD:
-. } OUTPUT CARD
' j SOURCE TO 8 2 5 5 ' . '■ •>
85
PUSH
B
H
PUSH
86
S BUF LENGTH •
B , 255D
87
."
LXI
&
CHAR COUNT
INX .
H
S ROOM FOR CH
88- '
AR COUNT
; GET READ WT
MVI A , READ
8 9 . RADL I :
* C 7 0 0 -,COMMAND -. /
PRTC • ; S I SSUE 'COMMA
OUT
.90- . - Y
.
.-.
NB. -• J B R I N G -I-N ST
PRTC
. 9 1. S T L O O P : I N
ATUS WORD
- - JMASK- OFF: B I
- A N I. 10 H .. ' 92
T 4
STLOOP. . J TRY AGAI N I
.. JZ93
F B IT 4 0
J BRI NG I N ST
IN
PRTC
94
' ■
AJUS WORD•
■ J MASK OFF . B I
AN I
020H
95
T ,5.
. .
J JUMP I F LAS
96
JNZ.
ENDST
.
130
I S IS -II
8080-8085
MACRO ASSEMBLER A - T O - D D R I V E R
- *
T CHAR
0 0 3D DB04.
97.
'
003F
0040
'' "0041
’
'• 0 0 4 2
0045
0046'
-•
0048
■ ' 004A
• 004D
t-
004F
0050
0051
0052
.■ 0 0 5 3
0 0 54
0055
0056
"00 5 8
77.
. "
98
; IN .
^
■
PR. TA
"' '
"
■■
‘ i ACCEPT DATA
■ (
i PUT' DATA I N
MOV
' Mj A.BUFFER
- :'
04'
'
- : ' INR .
B- •
, ; INCREMENT -C
." 9.9
• '•
• .
HAR .COUNT.
'. . • V
c
...
•
0D "
100 ' •
DCR
/ DECREMENT B
UFFER L E N G T H . \ .
' CAS 3 0 0 . C- ' 101 . :
JZ
"■
FULL
■ I E X I T .!"E BUF
FER FULL l .23
’ 102.
•"
•" I N X ;
H. ' . ' } I NCREMENT ' B /.
UFFER P O I N T E R •
-3 E00
■ 103
A j 0H •
MVI
S S IG NA L FOR
’ . ' .
ANOTHER CHAR D30 6
104
-OUT '
PRTC '
j I S S U E COMMA
ND
C32B00 '
Q
105
JMP
RADLl
j GETT ANOTHER. "
CHARACTER
DB04
106 ENDSTi
IN
PRTA
LACCEPT L A S T
CHAR OF S T R I N G
77
1 0 7 ■, ■
'
-MOV
Mj A
j PUT. DATA , I N
..
BUFFER.
0 4 ■:
108
INR
B V .
5 .INCREMENT. C.
- HAR COUNT
0D
' ’
109 /
'
DCR
j DECREMENT B- 9,
U F FER LENGTH".
. '■ 1V
23 .
H- ■
110.
‘
' INX"
.J INCREMENT ' B '
C
\•
UFFER- P O | N T E R . :. '
I. •
78
I I I FU^L:
MOV
A j B". .
SP U f CHAR CO,
UNT I N A
i.
2F.
- 112.
CMA
5F
I I 3
MOV
EjA
I 6FF.
I 14
. MV I
D » 0 F F H • "S HAVE FORMED
2 * S COMPLEMENT OF. ( CHARCOUNT + I )
I
19
'
.1 I 5 •
DAD ■
D .
I NOW HAVE -RE
r
131'
I
ISISl II
0059
8080-8085
70
•
. 0 0 5 A Cl
0 0 SB- E l
005C C9 .
‘ z - : .'■■
/ .
'
KACRQ ASSEMBLER A - T u - D
DRIVER
CREATED BUFFER BEG ADR
KOV.
Mj. B
J CHAR COUNT'
■
I N BUFFER TO -Bv ‘
'
• '' T.' I 1 7
' POP.
' B
'
•
,
. 11 8
'
POP
' :‘H
•
1 19
RET •
r
- ' - V
1 20
PUBLIC
D V R A T D , RSETURDRDYfRD
..
A D , KSET
•
'
121END;
•
1 16
P U B L I C . SYMBOLS "
D VRATD C 0 0 0 0
KSET
,
"
"
C 000A
0018' -
'
'
'• .
RDAD
- C 0 0 2 3:
RSEJ
'C 0 0 0 F .
'
.
■ '
^
'
-
'
’'
'
' "
" --‘ •
' E N D S T , ' C 004D
FULL
C 0053-'
*MD SET' A
- ; 00.98
" KSET ■ C ' 0 0 0 A
PRTA
A- 0 0
04
.
PRTB . A . 0 0 0 5 0 0 2 3
. :
, /
' RDRDY."' C 0 0 1 8 \ V READ
- ET
C. 0 0 0 F '
'
J : ■,
'
C
,
E X T E R N A L . SYMBOLS
U-S E R SYMBOLSDVRATD C 0 0 0 0 . .
.
''
RDRDY
-
A ' S S E K B L Y COMPLETE,.
STLOOP
NO ERRORS
C 002F
'
-
x '
■.
A/0001
\
I' "
RS
, ^ ^ S ^ e r o p t i c d a t a l i n k s t o instru
1762 00173174 2
N378
B392
cop.2
Beer, Michael S
Applying fiberoptic
data links to instrumen­
tation
DATE
IS S U E D
r
Y f\ -Y t)
:
^
K
TO
< "/» 3
ftfa w c n
JUN
,
■
S Y t- z - t /
619®
f P
"
//5 7 ?
B 39^
&
'
Download