United States
Environmental Protection
Agency
Environmental Sciences Research EPA-600 '2-78-099
Laboratory May 1978
Research Triangle Park NC 27711
Research and Development
&EHV
A Microcomputer-
id if ie( [icle
Size Spectrometer
Description and
Program Listings
-------
RESEARCH REPORTING SERIES
Research reports of the Office of Research and Development. U S. Environmental
Protection Agency, have been grouped into nine series. These nine broad cate-
gories were established to facilitate further development and application of en-
vironmental technology. Elimination of traditional grouping was consciously
planned to foster technology transfer and a maximum interface in related fields.
The nine series are:
1. Environmental Health Effects Research
2. Environmental Protection Technology
3. Ecological Research
4. Environmental Monitoring
5. Socioeconomic Environmental Studies
6. Scientific and Technical Assessment Reports (STAR)
7. Interagency Energy-Environment Research and Development
8. "Special" Reports
9. Miscellaneous Reports
This report has been assigned to the ENVIRONMENTAL PROTECTION TECH-
NOLOGY series. This series describes research performed to develop and dem-
onstrate instrumentation, equipment, and methodology to repair or prevent en-
vironmental degradation from point and non-point sources of pollution. This work
provides the new or improved technology required for the control and treatment
of pollution sources to meet environmental quality standards.
This document is available to the public through the National Technical Informa-
tion Service, Springfield, Virginia 22161.
-------
EPA 600/2-78-099
May 1978
A MICROCOMPUTER-MODIFIED PARTICLE SIZE SPECTROMETER
Description and Program Listings
by
Charles W. Lewis
Atmospheric Chemistry and Physics Division
Environmental Sciences Research Laboratory
Research Triangle Park, North Carolina 27711
ENVIRONMENTAL SCIENCES RESEARCH LABORATORY
OFFICE OF RESEARCH AND DEVELOPMENT
U.S. ENVIRONMENTAL PROTECTION AGENCY
RF.SEARCH TRIANGLE PARK, NORTH CAROLINA 27711
-------
DISCLAIMER
This report has been reviewed by the Environmental Sciences Research
Laboratory, U.S. Environmental Protection Agency, and approved for
publication. Mention of trade names or commercial products does not
constitute endoresement or recommendation for use.
ii
-------
ABSTRACT
A fully automated aerosol particle size spectrometer system is described
that consists of a light scattering particle sensor, an analog to digital
converter, and a microcomputer with associated printout device. The system
is capable of acquiring a differential particle size distribution, printing
the resulting spectrum in one of three representations, and repeating the
procedure at preselected intervals. An example of the application of the
system for measuring an outdoor aerosol size distribution is presented.
The appendices contain documented microcomputer program listings and
flow charts for Program Sizer (the program that operates the spectrometer
system and the principal result of this study) and Program MCA (a program
that converts part of the spectrometer system to a conventional 256-channel
pulse height analyzer).
This report covers a period from September 1976 to December 1977, and
work was completed as of December 22, 1977.
ill
-------
CONTENTS
Abstract Ill
Figures vl
Tables vli
Acknowledgements vili
1. Introduction 1
2. System Description 3
3. Calibration 12
4. Results 19
5. Discussion 22
References 24
Appendices
A. Program Sizer 25
Flow Chart 27
Listing 30
B. Program MCA 50
Flow Charts 52
Listing 54
-------
FIGURES
Number
1. Aerosol spectrometer system 4
2. Aerosol spectrometer block diagram 5
3. KIM-1 Microcomputer 7
4. Polystyrene latex aerosol calibration spectra 15
5. ADC channel vs. PSL particle diameter 16
6. Size interval width vs. particle diameter 18
7. Outdoor ambient aerosol size distribution results. . . 20
vl
-------
TABLES
Number
1. Input/Output Connections 9
2. Size Interval Calibration Constants 13
vii
-------
ACKNOWLEDGEMENTS
The enthusiastic support and encouragement given to this project by
Robert K. Stevens, Chief, Atmospheric Instrumentation Branch, is happily
acknowledged. Paul J. Lamothe made important microcomputer programming
contributions during the early stages of this project.
viii
-------
SECTION 1
INTRODUCTION
Recently a new device - the microprocessor - has become readily available.
The impact of this device on future analytical instrumentation and control
systems promises to be at least as great as that of the minicomputer in the
past. For the experimental research scientist, a microcomputer is a particu-
larly convenient form in which to use a microprocessor. A microcomputer
usually consists of a central processor unit (the microprocessor), memory,
and interface circuitry all present on a single printed circuit board. The
resulting "computer on a board" has most of the desirable features of a
minicomputer: (1) flexibility of a stored program in contrast to hard-wired
circuitry, (2) high speed operation, (3) capability for interruption by
peripheral devices requiring service, and (4) interface compatibility with
a variety of peripheral devices. The important difference, however, is
that the microcomputer is significantly smaller in size and lower in cost
than a minicomputer by roughly an order of magnitude. Furthermore, the
cost savings are magnified by the usage of comparatively inexpensive
peripheral devices, for example, ordinary audio cassette recorders for the
magnetic tape recording medium. Thus many possibilities now exist for the
incorporation of microprocessors or microcomputers in stand-alone Instruments
that could not justify the cost of a minicomputer.
An aerosol particle size spectrometer system that uses a $245 micro-
computer is described here. The system is able to (1) acquire a differential
size distribution simultaneously over 19 intervals of equal logarithmic
size between 0.3 and 11 ym diameter, for an arbitrary preset counting time,
(2) print the size distribution directly in a number, surface or volume
-------
representation, and (3) repeat the cycle indefinitely for unattended operation,
The system has obvious predecessors, for example, in the work of Whitby
et al (1972a), but the present system seems to be particularly attractive
in terms of cost, convenience, and flexibility.
A condensed version of the present report is available elsewhere
(Lewis and Lamothe, 1978). The most significant part of the report is the
appendices, which contain documented listings of the microcomputer programs
developed in this study, and which have not been published previously.
-------
SECTION 2
SYSTEM DESCRIPTION
HARDWARE
A photograph of the assembled system Is shown in Figure 1; the block
diagram form is shown in Figure 2. Each component of the system is described
below.
Sensor
A Model 208 Particle Analyzer (Climet, Inc.) was used to generate an
analog voltage pulse for each aerosol particle drawn into the analyzer from
the ambient atmosphere. The height of each pulse (produced by light scatter-
ing from the particle as it passes through an internal light beam) is
monotonically related to the size of the particle and is available at a
standard coaxial connector at the rear of the unit. Additional circuitry
within the analyzer, conventionally used to count all particles larger than
several selectable size thresholds, was not used. The CALIBRATE ADJUST
circuitry was retained however as it provided a convenient means to set the
total gain of the Climet unit. Any one of several commercial particle
sizing instruments based on light scattering could be used as a sensor for
the system. The Climet unit was chosen because of its unique optical system,
which not only produces the Important monotonic character of the response
function, but also causes the response to be nearly independent of refractive
index (Cooke and Kerker, 1975).
-------
J
Figure 1. Aerosol spectrometer system.
-------
SENSOR
I
ADC
TTY
AtCOMPUTER
AUDIO
CASSETTE
Figure 2. Aerosol spectrometer block diagram.
-------
Analog to Digital Converter (ADC)
Each pulse (approximately Gaussian shape, several microsecond duration)
from the sensor was fed directly to an 8192 channel 50-MHz Analog to Digital
Converter (Tracor Northern, Model TN-1211). A simple resistor network
voltage divider was added to the ADC input to attenuate the input pulse by
about 20%. This change produced a better match between the nominal 10 volt
maximum output of the Climet unit and the 8 volt maximum input of the ADC.
The ADC converted each pulse to a 13 bit binary number proportional to the
pulse height. At the end of conversion the ADC generated a positive TTL
level which was used to signal the microcomputer that an event was ready to
be transferred. After transfer, the ADC was cleared and made ready for the
next conversion by receipt of a positive TTL pulse of about one psec duration,
generated by the microcomputer. The particular ADC used was only one of
several alternatives which would have been suitable.
Microcomputer
A KIM-1 microcomputer (MOS Technology, Inc.) served as the interface
between the system's input and output components and provided the interme-
diate data storage medium. The device is shown in Figure 3. The heart of
this "computer on a board" is a 1-MHz 8-bit microprocessor (MOS 6502). The
26 by 21 cm board also includes (a) a keyboard and 6-digit light-emitting
diode (LKD) display, (b) interface and control circuitry for teletypewriter
and audio magnetic tape cassette additions, (c) a program stored in read
only memory (ROM), which constitutes a complete operating system for the
LED/keyboard, teletypewriter, and audio cassette, (d) storage for user
written programs and data, in the form of approximately 1100 8-bit words of
random access memory (RAM), (e) 15 individually programmable input-output
lines, in addition to others dedicated to teletypewriter and cassette use,
and (f) a 1-MHz programmable clock for interval timing applications. All
of these features were used in the system described here.
A 16-conductor connection is necessary between the ADC and microcomputer
(13 data inputs, a "ready" input, a "clear" output, and, of course, a
-------
Figure 3. KIM-1 Microcomputer.
-------
ground line). The teletypewriter involves a 4-line connection; the cassette
recorder involves a 3-line connection. It is important to appreciate that
the task of interfacing peripheral devices to the microcomputer is essentially
trival since all active circuitry to drive these devices is an integral
part of the microcomputer itself.
The microcomputer requires +5 and +12 VDC, the latter voltage being
necessary only if an audio cassette recorder is used. An Econo/Mate II
dual power supply (Power/Mate Corp.) furnished both voltages. All electrical
connections between the microcomputer and the rest of the system components
are given in Table 1.
The microcomputer is the least interchangeable system component, since
the spectrometer system was designed around the special features of the
KIM-1 unit. There are, however, several other microcomputer systems presently
availnble with features similar to those of the KIM-1 unit. Most of these
probably would be suitable as the basis of a spectrometer system like the
one reported here.
Teletypewriter and Audio Cassette Recorder
The system used a Model ASR33 teletypewriter, so that keyboard, printer,
and paper tape read and punch functions were all available. However, any
20-mA current loop serial teleprinter could be used, because the KIM micro-
computer is capable of adjusting to the teleprinter's bit rate over a large
range of rates. A similar flexibility exists with regard to choice of a
magnetic tape recorder. A medium priced non professional recorder has been
used with the system.
SOFTWARE
The program ("Sizer") written to control the operation of the spectro-
meter occupies nearly all of the user available RAM of the microcomputer.
It consists of three segments — acquisition, transformation, and output. A
complete listing may be found in Appendix A. It is also available upon
request in the form of punched paper tape.
8
-------
TABLE 1. INPUT/OUTPUT CONNECTIONS
Microcomputer
Connector Pin
A-A
A-14
A- 4
A- 3
A- 2
A- 5
A- 6
A- 7
A-8
A-10
A-ll
A-12
A-13
A-16
A-15
A- 9
A-R
A-S
A-T
A-U
A-l*
A-L
A-M
A-N
I/O Port
Designation
PAO
PA1
PA2
PAS
PA4
PAS
PA6
PA7
PB1
PB2
PB3
PB4
PB5
PB7
PBO
OPTIONAL:
I/O Signal
+5 VDC
AO (ADC LEAST SIGNIFICANT BIT)
Al
A2
A3
A4
A5
A6
A7
A8
A9
A10
All
A12 (ADC MOST SIGNIFICANT BIT)
STORE (ADC READY SIGNAL)
CLEAR (ADC RESET SIGNAL)
TTY KEYBOARD RETURN
TTY PRINTER RETURN
TTY KEYBOARD
TTY PRINTER
GROUND (FOR ADC, AUDIO
RECORDER, +5 and +12 VDC)
AUDIO IN (EARPHONE JACK)
AUDIO OUT (MICROPHONE JACK)
t!2 VDC
*A jumper wire must connect pins A-l and A-K. Also if the teletypewriter
keyboard, instead of the microcomputer keyboard, is used as the input device
a jumper wire must connect pins A-21 and A-V.
-------
Acquisition
Upon receipt of a "ready" signal, the microcomputer accepts an ADC
binary number, and a "clear" signal is generated that prepares the ADC to
accept its next input. The ADC binary number is compared with successive
pre stored values in a table with the values arranged in order of increasing
size. Each value in the table corresponds to a boundary between the adjacent
particle size bins. When the ADC number is found to exceed a table value,
the content of a memory address corresponding to the appropriate size bin
is incremented by one. The cycle repeats until either the number of counts
in any size bin exceeds 99 x 10 or a variable preset time is exceeded,
which can be any integral number of minutes between 1 and 99.
The primary consideration in designing the acquisition program segment
was to make its execution time as fast as possible. The result was a program
efficient in execution time, but inefficient in memory storage. Although
the linear search procedure used to locate the proper bin size is generally
considered to be very slow, it is time efficient in the present application
because ambient aerosol size distributions are so strongly biased toward
particles of small size. Similarly, it was important that the ADC be reset
as quickly as possible so that ADC acquisition of the next event could
occur simultaneously with microcomputer sorting of the previous one.
Finally, because it was awkward to deal with 13-bit ADC numbers, no more
than 8 of the most significant bits were used in the search procedure.
Transformation
The data are transformed by multiplying each bin content by either of
two presCored numbers proportional to the average volume or surface area
corresponding to a spherical particle in that bin size. This step is
omitted If a raw number representation of the data is desired.
10
-------
Output
The data are printed on the teletypewriter In a table giving 19 values
of average particle diameter and the number, surface, or volume value (in
4-place floating point decimal form) corresponding to each diameter. The
total numbers of particles of sizes greater and less than an arbitrarily
chosen size are also printed, as well as the data acquisition time interval.
A cassette recorder was not used in this automatic output system, but one
could be used to store data through manual intervention by the operator.
11
-------
SECTION 3
CALIBRATION
The table of pre stored values with which each ADC number is compared
constitutes the calibration constants of the spectrometer system. These
constants depend on the electro-optical properties of the sensor and ADC
components, and on the user's choice of parameters for the size intervals
into which the particles are to be classified. Intervals of equal logarithmic
width were used, because of the resulting desirable features in ambient
aerosol studies (Whitby et al_., 1972b). In choosing the number of size
intervals, the basic consideration was to realize the intrinsic resolution
capability of the sensor, within the constraint imposed by the amount of
microcomputer memory. Accordingly, each decade of particle size was divided
into 12 intervals and centered such that the midpoint (logarithmic) of the
last one occurred at exactly 10 ym. Thus a series of 19 midpoints D. and
20 boundary values D. were generated from the relations
Log D± + 1 = log D± + 1/12
and
log D± = (log D± + 1 + log D1)/2
with D~ = 10 ym. The resulting values of D and D are listed in Table 2.
To convert the boundary values from their representation in terms of
particle size to the corresponding ADC values, a calibration curve was
required. A simple program was written for the microcomputer (The program
12
-------
TABLE 2. SIZE INTERVAL CALIBRATION CONSTANTS
Di
(ym)
0.316
0.383
0.464
0.562
0.681
0.825
1.00
1.21
1.47
1.78
2.15
2.61
3.16
3.83
4.64
5.62
6.81
8.25
10.0
Di
(ym)
0.348
0.422
0.511
0.619
0.750
0.909
1.10
1.33
1.62
1.96
2.37
2.87
3.48
4.22
5.11
6.19
7.50
9.09
11.0
Ch. No.
(Decimal)
^25
34
45
58
74
94
120
156
207
288
416
576
832
1216
1760
2560
3680
5344
7808
Ch. No.
(Hex)
19
22
2D
3A
4A
5E
78
9C
CF
120
1AO
240
340
4CO
6EO
AOO
E60
14EO
1E80
Ch. No.
(Binary)
0000000011001
0000000100010
0000000101101
0000000111010
0000001001010
ooooooi 01 mo
0000001111000
000001 001 1100
0000011001111
0000100100000
0000110100000
0001001000000
00011 01 000000
0010011000000
0011011100000
0101000000000
01 noon ooooo
1 01 oom ooooo
mi 01 ooooooo
Calib.
Const.
19
22
2D
3A
4A
5E
78
9C
CF
09
OD
12
1A
26
37
50
73
A7
F4
Address
002 F
0035
003B
0041
0047
004D
0053
0059
005 F
OOAB
OOB1
OOB7
OOBD
OOC3
OOC9
OOCF
OOD5
OODB
OOE1
13
-------
listing is given in Appendix B) which converted it to a 256-channel pulse
height analyzer, with which the frequency distribution, or spectrum, of
pulse heights could be obtained for any series of pulses input to the ADC.
(By means of the ADC's digital offset switches, the 256-channel "window"
could be moved to any portion of the ADC's full 8192 channel range.) Indivi-
dual spectra were then obtained by passing several monodisperse polystyrene
latex aerosols through the sensor. All but one of the aerosols (4.96 ym)
were generated with a Collison nebulizer from Dow stock solutions highly
diluted with water, in accordance with the precautions of Fuchs (1973).
The dilution factors ranged from 8000:1 to 150:1 for particle sizes between
0.357 and 2.02 vim. The stock solution for the 4.96 ym aerosol was obtained
from Duke Scientific Corp. (Palo Alto, California) in very dilute form
(about 10 particles/ml). For each aerosol the nebulizer output was diluted
10:1 with clean dry air, and passed through a Kr85 radioactive charge
neutralizer and a 17-liter settling chamber before entering the particle
sensor. A composite spectrum based on most of the individual monodisperse
aerosol measurements is shown in Figure 4. The widths of the peaks are all
dominated by the intrinsic resolution of the particle sensor. The center
channel for each of the peaks is plotted in Figure 5. The curve shown in
Figure 5 is the one supplied with the Climet sensor, but with the vertical
axis linearly scaled to best fit the measured points.
Obtaining the calibration constants from the curve in Figure 5 is
straightforward in principle, but somewhat complicated in practice due to
the decision to deal with no more than 8 of the possible 13 bits constituting
each ADC value. In Table 2 the numerical steps by which the constants were
derived are explicitly indicated. Column 3 lists the ADC channel number,
obtained from the curve in Figure 5, corresponding to each size interval
boundary (column 2). Columns 4 and 5 convert the decimal numbers of column
3 to their hexadecimal and binary representations, respectively. For those
ADC channel numbers whose binary representation involve eight bits or less,
the corresponding calibration constant (column 6) is identical to the
hexadecimal value from column 4. For those numbers requiring more than
eight bits, the corresponding calibration constant Is derived from the
hexadecimal equivalent of the eight most significant bits of the binary
14
-------
tt -
I I I I I" I I I I I I" I I I I I
300
200
CJ
c/5
o
u
100
0.357pm
0.500
. 1.10pm
..• 0.822 pm
-...i,,r i i i i iu.r- i i i i
*» on nn "' nn 4 i
. 2.02pm
20 40
30
60
60
90
90
120 '300
ADC CHANNEL NUMBER
350
Figure 4. Polystyrene latex aerosol calibration spectra. Arrows
indicate the ADC threshold.
-------
10J
GC
LU
CO
o
u
a
-------
representation. In either case that portion of the binary representation
being utilized is underlined in column 5. Finally, column 7 gives the
address in the microcomputer program at which each calibration constant is
stored.
A cautionary note should be added, relating to the calibration procedure.
The set of numbers in column 3, being derived from an experimental curve,
naturally have some degree of uncertainty. In arriving at a final best set
of values, it is important that a candidate set be examined regarding the
widths of the size intervals (i.e., the differences of successive pairs of
entries in column 3) that result from that choice. If the widths are not
a smooth function of particle size, the measured aerosol size distributions
will exhibit "scatter," which is not actually present in the sample itself.
The width vs. size relationship for the calibration constants in Table 2 is
shown in Figure 6.
17
-------
10
0.1
1.0
DIAMETER, pm
Figure 6. Size interval width vs. particle diameter.
18
10
-------
SECTION 4
RESULTS
The spectrometer system has been used to make many measurements of
ambient aerosol size distributions since its assembly. Figure 7 shows
results from a representative measurement performed between 10 and 11 a.m.
EDT on August 9, 1977, on the roof of a three-story building in Research
Triangle Park, North Carolina. The figure presents the results in three
forms: (1) the teletypewriter tabular output, (2) a plot of the tabular
values, and (3) a histogram derived from the counting circuitry of the
Climet Particle Analyzer, which is normally bypassed.
In the teletypewriter output shown in Figure 7, the average particle
diameters (in ym) for each size interval constitute the left column, with
the floating point decimal content (fraction plus power of 10 multiplier)
of each on the right. The content of the smallest size interval (0.32 ym)
is affected by an ADC threshold and should be neglected. It is retained in
the output for diagnostic purposes, to aid in setting the ADC threshold.
The first element of the automatic output is the number of minutes (hexa-
decimal) used during data acquisition. This is followed by a character
that identifies the form of the output, in this case signifying the choice
of a "volume" representation of the data. For convenience the last two
lines of the output give the measured total number of particles below and
above a threshold that may be arbitrarily set at any of the size interval
boundaries. In the present case the threshold is such that the "above
threshold" sum includes all 19 size intervals. The resulting "number"
representation is independent of the representation chosen for the 19 size
intervals. The tabular and plotted values differ by a constant factor
19
-------
20
15
10
CO
E
a
O)
T
V
10.
8.3
6.8
5.6
4.6
3.8
3.2
2.6
2.2
1.8
1.5
1.2
1.0
.83
.68
.56
.46
.38
.32
60
.8100 06
.111307
.1574 07
.1938.07
.2259 07
.2633 07
.2624 07
.2153 07
.1945 07
.1316 07
.9780 06
.8221 06
.6352 06
.7056 06
.1615 07
.3748 07
.6685 07
.7101 07
.5508 05
00000000
>22453268
I I I l 1 I
I I I I I I
0.3
Figure 7.
1.0
3.0
10
DIAMETER, D,
Outdoor ambient aerosol size distribution results. The
histogram was derived from sequential readings recorded
manually from the Climet, while during the same time
interval the microcomputer automatically accumulated
and printed out the tabular data shown. The plotted
points are the same as the tabular data, to within a
calculated proportionality constant.
20
-------
which contains the aerosol flow rate through the sensor and the measuring
time interval.
In Figure 7 the Climet-derived histogram and the microcomputer result
are at least in qualitative agreement, in that their magnitudes are generally
consistent and both show the bimodal character anticipated for outdoor
ambient aerosol volumetric size distributions. There are at least two
reasons for the observed differences between the Climet and microcomputer
results. The first is that each element of the Climet histogram had to be
obtained by taking the difference of two successive integral measurements.
As a result each integral measurement occupied on average only about 20% of
the time during which the microcomputer spectrum was acquired. Thus changes
in the actual aerosol size distribution during the full 1-hr measuring
period could have contributed to measured differences between the two
methods. Secondly, the relative coarseness of the Climet size intervals
3
can cause substantial uncertainty when the volume transformation factors ( D )
are applied. While the total variation in the value of the transformation
factor between the extremes of any microcomputer size interval is 78%, the
corresponding maximum variation across a Climet size interval is about 33
times larger! Both considerations vividly illustrate the improved quality
of data that can be obtained with the modified system.
It should be noted that the results shown in Figure 7 have not been
corrected for the particle size dependent sampling efficiency of the Climet
aerosol Inlet. While this omission has, of course, no effect on the relative
agreement between the results of the two methods shown in the figure, the
general effect of its Inclusion would be to shift the position of the mode
above 1 jim to a larger size (Liu et^ aJL., 1974). In passing, it may be
noted that the latter mode was conspicuously absent in measurements performed
indoors, as anticipated.
21
-------
SECTION 5
DISCUSSION
The spectrometer system described here has a number of desirable
features: (1) a choice of different representations is possible in the data
output, (2) the output data consists of "better" size intervals (a greater
number and more thoughtfully chosen) than are usually available, (3) the
calibration can be easily changed, if the system is used on particles
having unusual index of refraction values, and (4) the system components
have a high degree of substitutability.
The system can be improved in several ways. While teletypewriters
enjoy the advantage of frequent availability in laboratories, their choice
as the output medium is archaic and costly relative to newer arid more
compact printers that are well suited to microcomputer usage. Secondly, the
system's data acquisition rate is limited by the speed of the microcomputer.
For a Junge distribution of aerosol particle sizes (dN/dD « D ) the average
ADC conversion time is about 7 usec, whereas the average time taken by the
microcomputer to process an event is about 65 jjsec. At high aerosol concen-
trations the resulting dead time will allow a fraction of the particles to
pass through the system without being counted. One method to correct for
this loss is to introduce at the ADC Input test pulses of fixed amplitude
and repetition rate concurrently with the Cllmet-generated pulses. Then the
correction factor, F, by which the measured size distribution should be
multiplied is simply
F « RT/N
22
-------
where R is the test pulse repetition rate, T is the data acquisition time,
and N is the number of test pulses actually counted by the system. The
problem of dead time loss can of course be made less severe by utilizing
faster microcomputers, which are now available.
A system similar to the one described could certainly have been assembled
before the advent of microcomputers, through use of a minicomputer, or by
means of hard-wired custom electronic circuitry. With the former solution
the computer coat would be about a factor of 10 greater, while the latter
would involve a very formidable electronic design problem and a relatively
inflexible final product. The approach taken with the system described was
to tailor commercial modules of general utility to the specific application
demanded of the system through the flexibility of an easily alterable
stored program. The attractiveness of such an approach is nicely illustrated
by recalling that the calibration constants required for the spectrometer's
normal operation were obtained through merely using a different microcomputer
program to convert the same system hardware components into a multichannel
pulse height analyzer.
Finally, perhaps the most valuable aspect of our work is the example
it provides of the application of a remarkable new technology to the aerosol
instrumentation field.
23
-------
REFERENCES
Cooke, D.D., and M. Kerker. 1975. Response Calculations for Light-Scattering
Aerosol Particle Counters. Appl. Opt. 14:734.
Fuchs, N.A. 1973. Latex Aerosols - Caution! J. Aerosol Sci. 4:405.
Lewis, C.W. and P.J. Lamothe. 1978. A Microcomputer Modified Particle Size
Spectrometer. J. Aerosol Sci. (to be published).
Liu, B.Y.H., R.N. Berglund, and J.A. Agarwal. 1974. Experimental Studies
of Optical Particle Counters. Atmos. Environ. 8(7):717.
Whitby, K.T., B.Y.H. Liu, R.B. Husar, and N.J. Barsic. 1972a. The Minnesota
Aerosol-Analyzing System Used in the Los Angeles Smog Project. J. Colloid
Sci. 39:136.
Whitby, K.T., R.B. Husar, and B.Y.H. Liu. 1972b. The Aerosol Size Distribu-
tion of Los Angeles Smog. J. Colloid Sci. 39:177.
24
-------
APPENDIX A
PROGRAM SIZER
GENERAL DESCRIPTION
This appendix provides a complete listing of Program Sizer, the micro-
computer software described in general terms in Section 2, which operates
the aerosol size spectrometer. The program is specific to the hardware
configuration also described in Section 2, including the electrical inter-
connections listed in Table 1.
If the program is not present in the microcomputer memory (this will
be the case if the microcomputer's power has been turned off) it must be
loaded following the simple procedure given in the microcomputer manufacturer's
documentation. The program may be loaded either from punched paper tape via
the teletypewriter or from magnetic tape via the audio cassette recorder.
Since the program is in two parts, the complete loading requires two succes-
sive load operations. The program is put into operation by entering the
program's starting address (0100), and pressing the GO key. It can be
stopped by pressing the ST key.
USER OPTIONS
Preset Time
Any integral number of minutes from 1 to 99 may be chosen for the
data acquisition time interval. The choice is determined by entering the
appropriate 2-dlgit decimal number at address OOOB. The default value is
01. However, if the number of particles recorded in any size interval should
exceed 99 x 10 , the output cycle will immediately occur even through the
25
-------
Address
0348
0348
0348
Code
88
56
4E
Output C
N 0
—2
N * D (
—I
N * DJ (
preset time has not been reached. In either case the first element of the
automatic teletypewriter output records the decimal number of actual data
acquisition minutes, preceded by the letter "T."
Number , Surface, and Volume Representations
The content of address 0348 determines the output form of the size
distribution:
(number)
« surface area)
<* volume)
The default value is 4E. The output will be preceded by the letters "S" or
"V" if either the surface or volume representations are chosen. Assuming
dead time losses are negligible the output can be converted to more conven-
3 3
tional units by a multiplicative factor. For example dV/dlogD (ym /cm ) is
obtained by multiplying the volume output numbers by 0.8881 x 10 /T (minutes),
Spectrum Integrals
In the output the number of particles recorded in all 19 size intervals
are summed into two groups, yielding the total number below ( < ) and above
( > ) an adjustable size threshold. The threshold is determined by the
content of address 0014, whose allowed range is 00 (default value) to 13,,,
lo
inclusively: 00 corresponds to the entire spectrum summed into the ( > )
group, and 13.., corresponds to all summed into the ( < ) group. The
summations are always in a "number" representation, independent of the
representation chosen for the individual size intervals. If either of the
9
two summations exceed 10 - 1, the summation value will be in error. In
this case the letter "0" signifying "overflow" will be printed immediately
before the two summations.
26
-------
PROGRAM SIZER (1)
YES
ADC TEST
1 r
1 r
1
NO
READ DATA
REGISTER 8
RELOAD INTERVAL TIMER
( SMALL \
READ DATA REGISTER A.
CLEAR ADC.
LOCATE PROPER SIZE BIN.
READ DATA REGISTER A.
COMBINE A AND B.
CLEAR ADC.
LOCATE PROPER SIZE BIN.
27
-------
( DATOUT J
PROGRAM SIZER (2)
PRINT DATA ACQUISITION TIME INTERVAL
NXTCHAN V
( FLOAT V
ADD CONTENT OF NEXT SIZE BIN
TO OVERSUM OR UNDERSUM.
IF OVERFLOW, OVER ¥=O.
SUBROUTINE SUBFLT
CONVERT CONTENT OF SIZE BIN
TO FLOATING POINT DECIMAL
MULTIPLICATION INITIALIZATION
SUBROUTINE FPM MULTIPLY
CONTENT OF NEXT SIZE BIN
BY VOLUMETRIC FACTOR
28
-------
( LINE >
( OUTPUT J
PROGRAM SIZER (3)
PRINT NEXT SIZE BIN
AND CONTENT
29
-------
ADDRESS CODE
LABEL
ASSEMBLY
COMMENT
0000
0002
0005
0006
0008
OOOB
OOOC
OOOF
0012
0013
0014
A9 E4 TIM
8D 07 17
C8
DO 12
4C BC 17
01 PRESET
XX XX XX
XX XX XX
XX
XX TCOUNT
00 THRESH
LDA #E4
STA 1707
I NY
BNE ADCTEST
JMP INCTIM
TIMER SERVICING ROUTINE
RELOAD INTERVAL TIMER
INCREMENT 0.2345 SEC. COUNTER
IF NOT FULL, GO TO ADCTEST
GO TO INCREMENT 1 MIN. COUNTER
01 =PRESET TIME (MIN.)
UNUSED
UNUSED
UNUSED
NUMBER OF PARTICLE SIZE
INTERVALS INCLUDED IN
UNDERSUM (MAX.
1316>
30
-------
ADDRESS CODE
LABEL
ASSEMBLY
COMMENT
0015
0018
001 A
001 D
001 F
0021
0023
0026
0029
002C
002E
0030
0032
0034
0036
0038
003A
003C
003E
0040
0042
0044
0046
0048
004A
004C
004E
0050
0052
0054
0056
0058
AD 05 17 LOOP
DO E6
AD 02 17 ADCTEST
10 F6
29 3E
DO 71
AD 00 17 SMALL
EE 02 17
CE 02 17
A2 00
C9 19
90 33
A2 04
C9 22
90 2D
A2 08
C9 2D
90 27
A2 OC
C9 3A
90 21
A2 10
C9 4A
90 IB
A2 14
C9 5E
90 15
A2 18
C9 78
90 OF
A2 1C
C9 9C
LDA 1705
BNE TIM
LDA 1702
BPL LOOP
AND #3E
BNE LARGE
LDA 1700
INC 1702
DEC 1702
LDX #00
CMP #19
BCC ADD
LDX #04
CMP #22
BCC ADD
LDX #08
CMP #2D
BCC ADD
LDX #OC
CMP #3A
BCC ADD
LDX #10
CMP #4A
BCC ADD
LDX #14
CMP #5E
BCC ADD
LDX #18
CMP #78
BCC ADD
LDX #1C
CMP #9C
31
DATA ACQUISITION ROUTINE
IF TIMER FLAG SET, GO TO
TIMER SERVICING ROUTINE
TEST PB7 (ADC READY)
IF NOT SET, GO TO LOOP
IF SET, MASK PB1-5
IF NON-ZERO, JUMP TO LARGE
LOAD LO ORDER ADC WORD
CLEAR ADC
IF ADC WORD IS LESS THAN
1ST (LOWEST) THRESHOLD
GO TO ADD
2ND
3RD
4TH
5TH
6TH
7TH
8TH
-------
ADDRESS CODE
LABEL
ASSEMBLY
COMMENT
005A
005C
005E
0060
0062
0064
0065
0066
0069
006B
006E
0070
0073
0075
0078
007A
007D
007F
0082
0084
0087
0089
008C
008E
0090
0091
0094
0095
0096
0098
009B
009E
90 09
A2 20
C9 CF
90 03
A2 24
EA
18 ADD
BD 00 02
69 01
9D 00 02
90 A5
BD 01 02
69 00
9D 01 02
90 9B
BD 02 02
69 00
9D 02 02
90 91
BD 03 02
69 00
9D 03 02
C9 99
DO 85
D8
4C 00 03
OA LARGE
OA
85 E8
AD 00 17
EE 02 17
CE 02 17
BCC ADD
LDX #20
CMP #CF
BCC ADD
LDX #24
NOP
CLC
LDA 0200.X
ADC #01
STA 0200, X
BCC LOOP
LDA 0201, X
ADC #00
STA 0201.X
BCC LOOP
LDA 0202.X
ADC #00
STA 0202.X
BCC LOOP
LDA 0203.X
ADC #00
STA 0203.X
CMP #99
BNE LOOP
CLD
JMP DATOUT
ASL
ASL
STA TEMPB
LDA 1700
INC 1702
DEC 1702
9TH
10TH
DECIMAL INCREMENT ROUTINE
ADD 1 TO LEAST SIGNIFICANT
BYTE OF SELECTED CHANNEL
PROPAGATE CARRY BIT, IF
NON-ZERO
PROPAGATE CARRY BIT, IF
NON-ZERO
PROPAGATE CARRY BIT, IF
NON-ZERO
CHANNEL CONTENT=99xl06?
NO, GET NEXT EVENT
YES, CLEAR DECIMAL MODE, AND
GO TO DATOUT
TRANSFER PB1-5 INTO
A3-7 AND FILL AO-2 WITH O'S
LOAD LO ORDER ADC WORD
CLEAR ADC
32
-------
ADDRESS CODE LABEL ASSEMBLY COMMENT
OOA1
OOA2
OOA3
OOA4
OOA5
OOA6
OOA8
OOAA
OOAC
OOAE
OOBO
OOB2
OOB4
OOB6
OOB8
OOBA
OOBC
OOBE
OOCO
OOC2
OOC4
OOC6
OOC8
OOCA
OOCC
OOCE
OODO
OOD2
OOD4
OOD6
OOD8
OODA
OODC
4A
4A
4A
4A
4A
05 E8
A2 24
C9 09
90 B7
A2 28
C9 OD
90 Bl
A2 2C
C9 12
90 AB
A2 30
C9 1A
90 A5
A2 34
C9 26
90 9F
A2 38
C9 37
90 99
A2 3C
C9 50
90 93
A2 40
C9 73
90 8D
A2 44
C9 A7
90 87
LSR
LSR
LSR
LSR
LSR
ORA TEMPB
LDX #24
CMP #09
BCC ADD
LDX #28
CMP #OD
BCC ADD
LDX #2C
CMP #12
BCC ADD
LDX #30
CMP #1A
BCC ADD
LDX #34
CMP #26
BCC ADD
LDX #38
CMP #37
BCC ADD
LDX #3C
CMP #50
BCC ADD
LDX #40
CMP #73
BCC ADD
LDX #44
CMP #A7
BCC ADD
33
TRANSFER PA5-7 INTO
AO-2 AND FILL A3-7
WITH O'S
8 MSB'S OF ADC WORD IN A.
IF ADC WORD IS LESS THAN
10TH THRESHOLD,
GO TO ADD
11TH
12TH
13TH
14TH
15TH
16TH
17TH
18TH
-------
ADDRESS CODE
LABEL
ASSEMBLY
COMMENT
OODE
OOEO
OOE2
OOE4
OOE7
OOE8
OOE9
OOEA
OOEB
OOEC
OOED
OOEE
OOEF
OOF2
OOFS
OOFS
OOFB
OOFE
A2 48
C9 F4
90 81
4C 15 00
XX
XX
XX
02
XX
02
XX
02
XX XX XX
XX XX XX
XX XX XX
XX XX XX
XX XX XX
XX XX
TEMPA
TEMP B/
EXP
SUMPNTL/
PLIERPNTL
SUMPNTH/
PLIERPNTH
FLTPNTL/
CANDPNTL
FLTPNTH/
CANDPNTH
DATPNTL/
PRODPNTL
DATPNTH/
PRODPNTH
LDX #48
CMP #F4
BCC ADD
JMP LOOP
IF ADC WORD IS LESS THAN
19TH THRESHOLD
GO TO ADD
DISCARD OTHERWISE
TEMPORARY STORAGE
ADDRESSES
THREE POINTER ADDRESSES
ADDRESSES OOEF -
OOFF NOT AVAILABLE
FOR USER PROGRAMS
34
-------
ADDRESS CODE
LABEL
ASSEMBLY
COMMENT
0100
0101
0103
0104
0107
01 OA
01 OC
01 OF
0111
0114
0116
0119
011A
one
011E
01 IF
0122
0125
0128
01 2A
0120
01 2E
0130
0133
0135
0138
D8 START
A2 FF
9A
20 2F IE
20 2F IE
A9 01
8D 03 17
A9 00
8D 01 17
AO 54
99 00 02 AGAIN
88
10 FA
85 13
A8
8D 02 17
EE 02 17
CE 02 17
A9 E4
8D 07 17
F8
A9 00
8D FA 17
A9 1C
8D FB 17
4C 15 00
CLD
LDX #FF
TXS
JSR CRLF
JSR CRLF
.LDA #01
STA 1703
LDA #00
STA 1701
LDY #54
STA 0200, Y
DEY
BPL AGAIN
STA TCOUNT
TAY
STA 1702
INC 1702
DEC 1702
LDA #E4
STA 1707
SED
LDA #00
STA UFA
LDA #1C
STA 17FB
JMP LOOP
STARTING ADDRESS, 'CLEAR DECIMAL
MODE
INITIALIZE STACK
CARRIAGE RETURN, LINE FEED
PBO=OUTPUT (ADC CLEAR)
PB1-5 = INPUTS (ADC MSB'S)
PB7 = INPUT (ADC READY)
PAO-7 = INPUTS (ADC LSB's)
SET TO ZERO:
SPECTRUM (19X4 BYTES),
OVERSUM (4 BYTES),
UNDERSUM (4 BYTES),
OVER, TCOUNT,
Y
CLEAR ADC
SET TIMER FOR
0.2345 SEC.
SET DECIMAL MODE
SET UP INTERRUPT VECTOR
FOR NMI
BEGIN DATA ACQUISITION
35
-------
ADDRESS CODE
LABEL
ASSEMBLY
COMMENT
01 3B
01 3C
01 3D
01 3F
0141
0143
0146
0148
OKA
01 4D
014E
0150
0152
0154
0155
0158
01 5A
01 5C
01 5E
0161
0162
0164
0167
01 6A
01 6C
01 6E
01 6F
0170
0172
0175
0178
01 7B
48
08
86 E7
84 E8
A9 03
8D E4 01
AO 06
A9 00
99 E7 01
88
10 FA
AO 02
Bl E9
88
99 E5 01
DO F8
AO 01
Bl EB
8D EF 01
C8
Bl EB
8D EE 01
AD E5 01
29 OF
FO 13
A8
18
A2 03
BD EC 01
7D E8 01
9D E8 01
CA
FPM
LDP
CKPLIER
SETX
SUM
PHA
PHP
SIX TEMPA
STY TEMPB
LDA #03
STA CNTSHIFT
LDY #06
LDA #00
STA CNTEXP.Y
DEY
BPL
LDY #02
LDA (PLIERPNTL).Y
DEY
STA PLIERL.Y
BNE LDP
LDY #01
LDA (CANDPNTL).Y
STA CANDL
I NY
LDA (CANDPNTL),Y
STA CANDH
LDA PLIERL
AND #OF
BEQ DECCNTSHIFT
TAY
CLC
LDX #03
LDA CANDSRH,X
ADC PRODI,X
STA PRODI,X
DEX
DECIMAL FLOATING POINT
MULTIPLY SUBROUTINE
(DECIMAL MODE
PREVIOUSLY SET)
INITIALIZE SHIFT COUNTER.
SET TO ZERO:
CANDSRH, CANDSRL,
PRODI, PROD2,
PROD3, PROD4,
CNTEXP.
LOAD PLIERH
AND PLIERL
INTO RESIDENT
STORAGE
LOAD CANDL
AND CANDH
INTO RESIDENT
STORAGE
CHECK 4 LSB'S
OF PLIERL
Y = ADDITION COUNTER
ADD ALL 4 BYTES
OF CAND TO PROD
36
-------
ADDRESS CODE
LABEL
ASSEMBLY
COMMENT
017C
017E
017F
0181
0184
0186
0188
018A
018B
018E
018F
0191
0194
0197
0198
019A
019C
019E
01AO
01 Al
01 A3
01A6
01A8
01AB
01 AD
01AF
01 BO
01B2
01B5
01B6
01B8
01B9
01BB
10 F4
88
DO EE
CE E4 01
30 16
AO 04
A2 03
18
3E EC 01
CA
10 FA
4E E6 01
6E E5 01
DECCNTSHIFT
NEXTDIG
ROCAND
DO EE
FO CB
AO 00
Bl E9
18
71 EB
8D E7 01
A9 FO
2C E8 01
DO IE
AO 04
18
A2 03
3E E8 01
CA
10 FA
LJD
ADDEXP
CKMSD
DIGSHIFT
BITSHIFT
DO F4
38
DECEXP
BPL SUM
DEY
BNE SETX
DEC CNTSHIFT
BMI LJD
LDY #04
LDX #03
CLC
ROL CANDSRH.X
DEX
BPL ROCAND
LSR PLIERH
ROR PLIERL
DEY
BNE NEXTDIG
BEQ CKPLIER
LDY #00
LDA (PLIERPNTL).Y
CLC
ADC (CANDPNTL).Y
STA CNTEXP
LDA #FO
BIT PRODI
BNE STOREXP
LDY #04
CLC
LDX #03
ROL PRODI,X
DEX
BPL BITSHIFT
DEY
BNE DIGSHIFT
SEC
REPEAT ADDITIONS
FOR Y TIMES.
BRANCH IF ALL 4 DIGITS
OF PLIER HAVE BEEN USED
Y = 4 BIT COUNTER
X = 4 BYTE COUNTER
SHIFT CAND
LEFT 1 BIT
REPEAT FOR ALL 4
BYTES
SHIFT PLIER
RIGHT 1 BIT
REPEAT FOR 4
BITS.
ADD EXPONENTS
OF PLIER AND
CAND
CHECK 4 MSB'S
OF PROD
BRANCH IF ?« 0
4 BITS FOR EACH BCD
DIGIT
PROD CONTAINS 4 BYTES
SHIFT PROD LEFT
1 BIT. REPEAT FOR
ALL 4 BYTES
REPEAT FOR 4 BITS
DECREMENT EXPONENT
37
-------
ADDRESS CODE
LABEL
ASSEMBLY
COMMENTS
01 BC
01BF
Old
01 C4
01 C6
01 C8
01 CB
01 CE
01 DO
01 D2
01 D5
01 D7
01 D8
01 DB
01 DD
01 OF
01 El
01 E2
01 E3
01 E4
01 E5
01 E6
01 E7
01 E8
01 E9
01 EA
01 EB
01 EC
01 ED
01 EE
01 EF
01 FO
01 F3
AD E7 01
E9 01
8D E7 01
DO EO
FO 03
XX XX XX
AD E7 01
91 ED
AO 02
AD E8 01
91 ED
88
AD E9 01
91 ED
A6 E7
A4 E8
28
68
60
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX XX XX
XX XX XX
STOREXP
CNTSHIFT
PLIERL
PLIERH
CNTEXP
PRODI
PROD2
PROD3
PROD4
CANDSRH
CANDSRL
CANDH
CANDL
LDA CNTEXP
SBC #01
STA CNTEXP
BNE CKMSD
BEQ STOREXP
LDA CNTEXP
STA (PRODPNTL),Y
LDY #02
LDA PRODI
STA (PRODPNTL),Y
DEY
LDA PROD2
STA (PRODPNTL).Y
LDX TEMPA
LDY TEMPB
PLP
PLA
RTS
FOR EACH DIGIT
SHIFTED
UNUSED
(Y = 0)
EXPONENT STORED AT LOWEST
ADDRESS
HI STORED AT HIGHEST ADDRESS
LO STORED AT MIDDLE ADDRESS
RETURN FROM SUBROUTINE
TWELVE TEMPORARY
STORAGE ADDRESSES
USED BY MULTIPLY
SUBROUTINE
UNUSED
UNUSED
38
-------
ADDRESS CODE LABEL ASSEMBLY COMMENTS
01F6 XX XX XX UNUSED
01F9 XX XX XX UNUSED
01FC XX XX UNUSED
01FE XX RESERVED FOR
01FF XX STACK STACK OPERATION
39
-------
ADDRESS CODE
LABEL
ASSEMBLY
COMMENT
0200
XX XX XX SPECTRUM
024B
024C
024F
0250
0253
0254
XX
XX XX XX OVERSUM
XX
XX XX XX UNDERSUM
XX
XX OVER
ADDRESSES
0200 - 024B
COMPRISE THE
ACCUMULATED
PARTICLE SIZE
SPECTRUM,
ORGANIZED AS
191Q FOUR BYTE
BCD INTEGERS
FOUR BYTE SUM
ABOVE THRESHOLD
FOUR BYTE SUM
BELOW THRESHOLD
IF f 0, OVERFLOW OCCURRED
-------
ADDRESS CODE LABEL ASSEMBLY COMMENT
0255 00 16 03 DCUBE TABLE OF VOLUME
0258 00 62 05 TRANSFORMATION
025B 00 00 10 FACTORS FOR EACH
025E 00 78 17 SIZE BIN,
0261 00 62 31 STORED IN
0264 00 23 56 REVERSE DECIMAL
0267 01 00 10 FLOATING POINT
026A 01 78 17 FORMAT.
026D 01 62 31 FOR EXAMPLE
0270 01 23 56 THE FIRST
0273 02 00 10 FACTOR IS
0276 02 78 17 0.0316 x 10°
0279 02 62 31 = (0.3162)3
027C 02 23 56
027F 03 00 10
0282 03 78 17
0285 03 62 31
0288 03 23 56
028B 04 00 10
41
-------
ADDRESS CODE LABEL ASSEMBLY COMMENT
028E 32 33 2E TABLE TABLE OF
0291 38 33 2E AVE. PARTICLE
0294 36 34 2E DIA. (IN
0297 36 35 2E MICROMETERS)
029A 38 36 2E FOR EACH
029D 33 38 2E SIZE BIN,
02AO 30 2E 31 STORED IN
02A3 32 2E 31 REVERSE
02A6 35 2E 31 ASCII
02A9 38 2E 31 FORMAT.
02AC 32 2E 32 FOR EXAMPLE
02AF 36 2E 32 THE FIRST
02B2 32 2E 33 ENTRY
02B5 38 2E 33 CORRESPONDS
02B8 36 2E 34 TO 0.32
02BB 36 2E 35 SINCE
02BE 38 2E 36 32 = 2
02C1 33 2E 38 33 = 3
02C4 2E 30 31 2E = .
-------
ADDRESS CODE LABEL ASSEMBLY COMMENT
02C7 00 00 10 DSQUARE TABLE OF
02CA 00 68 14 SURFACE
02CD 00 54 21 TRANSFORMATION
02DO 00 62 31 FACTORS FOR
02D3 00 42 46 EACH SIZE BIN,
02D6 00 13 68 STORED IN
02D9 01 00 10 REVERSE DECIMAL
02DC 01 68 14 FLOATING POINT
02DF 01 54 21 FORMAT
02E2 01 62 31 FOR EXAMPLE
02E5 01 42 46 THE FIRST
02E8 01 13 68 FACTOR IS
02EB 02 00 10 0.1000 x 10°
02EE 02 68 14 = (0.3162)2
02F1 02 54 21
02F4 02 62 31
02F7 02 42 46
02FA 02 13 68
02FD 03 00 10
43
-------
ADDRESS CODE
LABEL
ASSEMBLY
COMMENT
0300
0301
0303
0306
0309
030B
030E
0311
0312
0314
0316
0318
031A
031C
031 E
0320
0322
0324
0326
0328
032A
032B
032D
0330
0332
0334
0335
0337
0339
D8 DATOUT
A9 54
20 AO IE
20 9E IE
A5 13
20 3B IE
20 2F IE
F8
A9 00
85 ED
85 EB
A2 00
A9 4C NXTCHAN
E4 14
BO 02
A9 50
85 E9 STR
AO 00 SUM
A9 04
85 E8
18
Bl ED AGAIN
99 4A 03
71 E9
91 E9
C8
C6 E8
DO F2
90 03
CLD
LDA #54
JSR OUTCH
JSR OUTSP
LDA TCOUNT
JSR PRTBYT
JSR CRLF
SED
LDA #00
STA DATPNTL
STA FLTPNTL
LDX #00
LDA #4C
CPX THRESH
BCS STR
LDA #50
STA SUMPNTL
LDY #00
LDA #04
STA TEMPB
CLC
LDA ( DATPNTL ),Y
STA SCRATCHL.Y
ADC ( SUMPNTL ),Y
STA (SUMPNTL), Y
INY
DEC TEMPB
BNE AGAIN
BCC FLOAT
SUMMING ROUTINE
CLEAR DECIMAL MODE
PRINT "T"
PRINT TCOUNT
CARRIAGE RETURN, LINE FEED
SET DECIMAL MODE
INITIALIZE:
DATPNTL
AND FLTPNTL
SET SIZE BIN COUNTER
SET SUMPNT TO
ADDRESS OF
OVERSUM (024C)
OR ADDRESS OF
UNDERSUM (0250)
SET INDEX REGISTER
4 BYTE COUNTER
ADD NO. OF COUNTS IN NEXT
SIZE BIN (4 BYTES)
TO OVERSUM OR UNDERSUM
IF EITHER SUM > 4 BYTES,
-------
ADDRESS CODE
LABEL
ASSEMBLY
COMMENT
033B
033E
0341
0342
0344
0346
0347
034A
034B
034C
034D
EE 54 02
20 80 17
E8
EO 13
DO D4
D8
4C 4E 03
XX
XX
XX
XX
FLOAT
SCRATCHL
SCRATCHL+1
SCRATCHL+2
SCRATCHL+3
INC OVER
JSR SUBFLT
INX
CPX #13
BNE NXTCHAN
CLD
JMP MULT
INCREMENT OVER
GO TO FLOATING POINT
CONVERSION SUBROUTINE
1316 = 191Q SIZE BINS
CLEAR DECIMAL MODE
GO TO MULTIPLY ROUTINE
FOUR BYTE
STORAGE REGISTER
REFERENCED BY
SUBROUTINE SUBFLT
45
-------
ADDRESS CODE
LABEL
ASSEMBLY
COMMENT
MULTIPLY ROUTINE
034E
0350
0352
0354
0356
0358
035A
035C
035F
0362
0364
0366
0368
036A
036B
036E
036F
0370
0372
0375
0377
0379
037B
037D
037E
037F
0381
0383
0385
0387
A9 55 MULT
85 E9
A9 56
DO 06
A9 C7 ENTR2
85 E9
A9 53
20 AO IE CHAR
20 2F IE
A9 00
85 EB
85 ED
AO 13
F8 CALL
20 3B 01
D8
88
DO 03
4C 88 03
A2 04
F6 E9 INCP
F6 E9
F6 E9
CA
CA
10 F6
30 E7
XX XX
XX XX
XX
LDA #55
STA E9
LDA #56
BNE CHAR
LDA #C7
STA E9
LDA #53
JSR OUTCH
JSR CRLF
LDA #00
STA EB
STA ED
LDY #13
SED
JSR FPM
CLD
DEY
BNE #03
JMP OUTPUT
LDX #04
INC E9,X
INC E9,X
INC E9,X
DEX
DEX
BPL INCP
BMI CALL
LOAD PLIERPNTL WITH
ADDRESS OF DCUBE
ASCII "V"
LOAD PLIERPNTL WITH
ADDRESS OF DSQUARE
ASCII "S"
PRINT "V" OR "S"
INITIALIZE:
CANDPNTL AND
PRODPNTL
191Q SIZE BINS
SET DECIMAL MODE
MULTIPLY
CLEAR DECIMAL MODE
IF ALL BINS DONE
GO TO OUTPUT
IF NOT DONE,
INCREMENT
PLIERPNTL,
CANDPNTL, AND
PRODPNTL
THREE TIMES
DO NEXT MULTIPLICATION
UNUSED
UNUSED
UNUSED
46
-------
ADDRESS CODE
LABEL
ASSEMBLY
COMMENT
0388
038A
038C
038E
0390
0392
0394
0396
0398
039B
039E
03AO
03A2
03A4
03A7
03AA
03AC
03AF
03B2
03B5
03B8
03BB
03BE
03CO
03C2
03C5
03C7
03C9
03CC
03CF
03D1
03D3
03D5
A9 00 OUTPUT
85 ED
A9 38
85 E7
85 E8
A9 03 LINE
85 E9
A6 E7 ASCII
BD 8E 02
20 AO IE
C6 E7
C6 E9
DO F2
20 9E IE
20 9E IE
A9 2E
20 AO IE
20 F6 03
20 F6 03
20 9E IE
20 F6 03
20 2F IE
A5 E8
10 DO
AD 54 02
FO 08
A9 4F
20 AO IE
20 2F IE
A9 53 SET
85 E8
A9 02
85 E9
LDA #00
STA ED
LDA #38
STA TEMPA
STA TEMPB
LDA #03
STA COUNTER
LDX TEMPA
LDA TABLE, X
JSR DUTCH
DEC TEMPA
DEC COUNTER
BNE ASCII
JSR OUTSP
JSR OUTSP
LDA #2E
JSR DUTCH
JSR OUTBYT
JSR OUTBYT
JSR OUTSP
JSR OUTBYT
JSR CRLF
LDA TEMPB
BPL LINE
LDA OVER
BEQ SET
LDA #4F
JSR OUTCH
JSR CRLF
LDA #53
STA TEMPB
LDA #02
STA COUNTER
47
OUTPUT ROUTINE
INITIALIZE DATPNTL
38lg = 561Q =
3 x NO. OF BINS - 1
3 CHARACTER COUNTER
ASCII TABLE ADDRESS = 028E
PRINT NEXT ASCII CHARACTER
PROCEED AFTER 3 CHARACTERS
PRINT 2 SPACES
ASCII "."
PRINT "."
PRINT HI ORDER BYTE
PRINT LO ORDER BYTE
PRINT SPACE
PRINT EXPONENT
PROCEED AFTER 191Q LINES
CHECK FOR OVERFLOW
ASCII "0"
PRINT "0" IF OVERFLOW
END ADDRESS OF
UNDERSUM = 0253
2 SUM COUNTER
-------
ADDRESS
03D7
03D9
03DB
03DD
03 EO
03E3
03E6
03 E8
03EA
03ED
03EF
03F1
03F3
03F6
03 F8
03 FA
03FD
03FF
CODE LABEL
A9 3C
A2 04 SUMPRT
86 E7
20 AO IE
20 9E IE
20 F6 03 RPT
C6 E7
DO F9
20 2F IE
A9 3E
C6 E9
DO E6
4C 00 01
A4 E8 OUTBYT
B1 ED
20 3B IE
C6 E8
60
ASSEMBLY
LDA #3C
LDX #04
SIX TEMPA
JSR DUTCH
JSR OUTSP
JSR OUTBYT
DEC TEMPA
BNE RPT
JSR CRLF
LDA #3E
DEC COUNTER
BNE SUMPRT
JMP START
LDY TEMPB
LDA (ED),Y
JSR PRTBYT
DEC TEMPB
RTS
COMMENT
ASCII " < "
4 BYTES PER SUM
PRINT " < " OR " > "
PRINT 1 SPACE
PRINT NEXT BYTE
PROCEED AFTER 4 BYTES
ASCII " > "
AFTER PRINTING OF
UNDERSUM AND OVERSUM,
RESTART ACQUISITION
SUBROUTINE TO
PRINT ONE BYTE
RETURN FROM SUBROUTIN
48
-------
ADDRESS CODE
LABEL
1780 A9 08 SUBFLT
1782 85 E8
1784 A9 FO MASK
1786 2C 4D 03
1789 DO 15
178B AO 04
1780 OE 4A 03 SHIFT
1790 2E 4B 03
1793 2E 4C 03
1796 2E 4D 03
1799 88
179A DO Fl
179C C6 E8
179E DO E4
17AO AO 00 STORE
17A2 A5 E8
17A4 91 EB
17A6 C8 BACK
17A7 B9 4B 03
17AA 91 EB
17AC CO 02
17AE DO F6
17BO AO 03
17B2 E6 EB MORE
17B4 E6 ED
17B6 88
17B7 DO F9
17B9 E6 ED
17BB 60
ASSEMBLY
LDA #08
STA EXP
LDA #FO
BIT SCRATCHL+3
BNE STORE
LDY #04
ASL SCRATCHL
ROL SCRATCHL+1
ROL SCRATCHL+2
ROL SCRATCHL+3
DEY
BNE SHIFT
DEC EXP
BNE MASK
LDY #00
LDA EXP
STA (FLTPNTL),Y
I NY
LDA SCRATCHL+1,Y
STA (FLTPNTL),Y
CPY #02
BNE BACK
LDY #03
INC FLTPNTL
INC DATPNTL
DEY
BNE MORE
INC DATPNTL
RTS
COMMENT
DECIMAL FLOATING POINT
CONVERSION ROUTINE
08 = INITIAL BIAS
FOR EXPONENT
IF ANY OF 4 MSB'S
OF SCRATCH i 0,
GO TO STORE
OTHERWISE,
SHIFT 4 BYTE CONTENT
OF SCRATCH LEFT
BY 4 BITS
DECREMENT EXPONENT
GO TO MASK IF EXPONENT i 0
STORE AT 3 SEQUENTIAL
ADDRESSES IN ORDER:
EXPONENT AT LOWEST ADDRESS
LO ORDER AT MIDDLE ADDRESS
HI ORDER AT HIGHEST ADDRESS
INCREMENT:
FLTPNTL 3 TIMES
DATPNTL 4 TIMES
RETURN FROM SUBROUTINE
49
-------
ADDRESS CODE
LABEL
ASSEMBLY
COMMENT
17BC
17BD
17BF
17C1
17C3
17C5
17C7
17CA
17CD
18
A5 13
69 01
85 13
C5 OB
DO 03
4C 00 03
4C 1A 00
XX XX XX
INCTIM
CONTIN
CLC
LDA TCOUNT
ADC #01
STA TCOUNT
CMP PRESET
BNE CONTIN
JMP DATOUT
JMP ADCTEST
INCREMENT 1 MIN. COUNTER
PRESET TIME REACHED?
YES
NO
UNUSED
17EB
XX
UNUSED
49a
-------
APPENDIX B
PROGRAM MCA
GENERAL DESCRIPTION
The following program listing is specific to the microcomputer-ADC-tele-
typewriter system configuration described in Section 2, including the
electrical interconnections listed in Table 1. Program MCA converts this
system to a conventional 256-channel pulse height analyzer (Multichannel
Analyzer) with spectrum print-out capability. The program consists of two
segments, data acquisition and spectrum printout. Their starting addresses
are 0000 and OOAO, respectively.
USER OPTIONS
Maximum Channel Count
In the present program data acquisition is terminated when the number
of counts in any one of the 256 channels reaches 9900. The channel number
(a hexadecimal number between 00 and FF) for which the condition occurred
is then automatically printed. The maximum count may be changed to any
decimal integral multiple (between 01 and 99) of 100 by appropriately
changing the content of the two addresses 006D and 0088.
50
-------
Output Spectrum Range
In the present program the output segment prints the entire spectrum
from channel number 0 to FF (255._), in the form of 10 channels per line
with the hexadecimal channel number of the following channel content beginning
each line. Any smaller subset of the full spectrum may be chosen for
output by changing the initial and final channel numbers, contained at
addresses 0161 and 0162, respectively. If these channel numbers are mistakenly
entered in reverse order an error message ("E") will be printed and the
program will halt at address 0161 for operator inspection of its contents.
The sample output reproduced below corresponds to initial and final channel
numbers 30 (48.. ~) and 3E (62 0), resulting from the input of an electronic
pulser centered at channel number 3B (59-,.).
3B
30 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
3A 0000 9900 0000 0000 0000
Restarting
The execution of Program MCA halts after completion of each acquisition
or output cycle. So long as the operator is content to alternate the two
cycles only the GO key need be pressed to start execution of the other
cycle. If it is desired however to immediately repeat the same cycle, or
to exercise one of the previous options, then the proper starting address
for the cycle must be entered before GO.
51
-------
READ DATA REGISTER B
READ DATA REGISTER A.
CLEAR ADC.
INCREMENT PROPER CHANNEL.
PROGRAM MCA (1)
NO
YES
PRINT CHANNEL NUMBER
/ ADCTST J
HALT
52
-------
PROGRAM MCA (2)
53
-------
ADDRESS CODE
LABEL
ASSEMBLY
COMMENT
0000
0002
0005
0008
OOOB
OOOD
0010
0013
0016
0017
001 A
001 D
001 F
0022
0024
0027
0029
002C
002D
002F
0031
0034
0035
0037
003A
003D
0040
0041
0044
0046
0048
A9 1C STARTIN
8D FB 17
8D FD 17
8D FF 17
A9 00
8D FA 17
8D FC 17
8D FE 17
D8
20 2F IE
20 2F IE
A9 01
8D 03 17
A9 00
8D 01 17
AO 00
99 00 02 ZER02
88
DO FA
AO 00
99 00 03 ZER03
88
DO FA
8D 02 17
EE 02 17 RESET
CE 02 17
F8
AD 02 17 ADCTST
10 FB
29 3E
DO FO
LDA fIC
STA NMIH
STA RSTH
STA IRQH
LDA #00
STA NMIL
STA RSTL
STA IRQL
CLD
JSR CRLF
JSR CRLF
LDA #01
STA 1703
LDA #00
STA 1701
LDY #00
STA 0200, Y
DEY
BNE ZER02
LDY #00
STA 0300, Y
DEY
BNE ZER03
STA 1702
INC 1702
DEC 1702
SED
LDA 1702
BPL ADCTST
AND #3E
BNE RESET
STARTING ADDRESS FOR
DATA ACQUISITION
INITIALIZE INTERRUPT
VECTORS
CLEAR DECIMAL MODE
CARRIAGE RETURN, LINE FEED
DEFINE I/O:
PBO = OUTPUT (ADC CLEAR)
PB1-5 = INPUTS (ADC MSB'S)
PB7 = INPUT (ADC READY)
PAO-7 = INPUTS (ADC LSB'S)
CLEAR MEMORY ADDRESSES
0200-03FF
CLEAR ADC
SET DECIMAL MODE
TEST PB7 (ADC READY)
IF NOT SET, TEST AGAIN
IF SET, MASK PB1-5
RESET IF ADC > 8 BITS
54
-------
ADDRESS CODE
LABEL
ASSEMBLY
COMMENT
004A
004D
0050
0053
0055
0056
0058
0059
005A
005D
005F
0062
0064
0067
0069
006C
006E
0070
0073
0074
0075
0078
007A
007D
007F
0082
0084
0087
0089
008B
008C
008E
0091
AD 00 17 SMALL
EE 02 17
CE 02 17
85 EE
OA
BO IB
AA
18
BD 00 02
69 01
9D 00 02
90 DD
BD 01 02
69 00
9D 01 02
C9 99
DO Dl
4C 8B 00
AA CRYSET
18
BD 00 03
69 01
9D 00 03
90 C2
BD 01 03
69 00
9D 01 03
C9 99
DO B6
D8 CHAN
A5 EE
20 3B IE
00 00
LDA 1700
INC 1702
DEC 1702
STA TEMP
ASL
BCS CRYSET
TAX
CLC
LDA 0200.X
ADC #01
STA 0200.X
BCC ADCTST
LDA 0201.X
ADC #00
STA 0201.X
CMP #99
BNE ADCTST
JMP CHAN
TAX
CLC
LDA 0300.X
ADC #01
STA 0300.X
BCC ADCTST
LDA 0301.X
ADC #00
STA 0301.X
CMP #99
BNE ADCTST
CLD
LDA TEMP
JSR PRTBYT
BRK 00
55
LOAD LO ORDER ADC WORD
CLEAR ADC
MULTIPLY ADC WORD X2
BRANCH IF CARRY SET
IF CARRY NOT SET,
ADD 1 TO LEAST
SIGNIFICANT BYTE
OF SELECTED CHANNEL
ON PAGE TWO
PROPAGATE CARRY
BIT IF NON-ZERO
CHANNEL CONTENT = 9900?
NO, GET NEXT EVENT
YES, GO TO CHAN
IF CARRY SET,
ADD 1 TO LEAST
SIGNIFICANT BYTE
OF SELECTED CHANNEL
ON PAGE THREE
PROPAGATE CARRY
BIT IF NON-ZERO
CHANNEL CONTENT « 9900?
NO, GET NEXT EVENT
CLEAR DECIMAL MODE
PRINT CHANNEL WITH
MAXIMUM COUNT
HALT
-------
ADDRESS CODE LABEL ASSEMBLY COMMENT
0093 4C AO 00 JMP STARTOUT OUTPUT SPECTRUM
0096 XX XX XX UNUSED
0099 XX XX XX UNUSED
009C XX XX XX UNUSED
009F XX UNUSED
56
-------
ADDRESS CODE
LABEL
ASSEMBLY
COMMENT
OOAO
OOA1
OOA2
OOA5
OOA8
OOAA
OOAD
OOAE
OOBO
OOB3
OOB5
OOB7
OOBA
OOBD
OOBF
OOC1
OOC3
OOC5
OOC7
OOC8
OOCA
OOCC
OOCE
OODO
OOD2
OOD4
OOD7
D8
38
AD 62 01
ED 61 01
BO 03
4C 57 01
18
69 01
8D 65 01
A9 01
85 ED
AD 61 01
8D 63 01
85 EC
06 EC
BO 04
A9 00
85 ED
18
A5 EC
69 01
85 EC
A5 ED
69 02
85 ED
20 2F IE
4C 00 01
STARTOUT CLD
SEC
LDA FIN
SBC INIT
BCS 03
JMP ERROR
CLC
ADC #01
STA TOT
LDA #01
STA MEMH
LDA INIT
STA CURRENT
STA MEML
ASL MEML
BCS 04
LDA #00
STA MEMH
CLC
LDA MEML
ADC #01
STA MEML
LDA MEMH
ADC #02
STA MEMH
JSR CRLF
JMP NEWLINE
STARTING ADDRESS
FOR DATA OUTPUT
CALCULATE TOT
= NO. OF CHANNELS
TO BE OUTPUT
ERROR MESSAGE
IF TOT < 0
CALCULATE MEML, MEMH
MEML = LO ORDER
ADDRESS OF
INITIAL CHANNEL
TO BE OUTPUT
MEMH = HI ORDER
ADDRESS
REMAINDER OF
PROGRAM IN PAGE 1
57
-------
ADDRESS CODE LABEL ASSEMBLY COMMENT
OODA XX XX XX UNUSED
OODD XX XX XX UNUSED
OOEO XX XX XX UNUSED
OOE3 XX XX XX UNUSED
OOE6 XX XX XX UNUSED
OOE9 XX XX XX UNUSED
OOEC XX MEML TEMPORARY STRORAGE
OOED XX MEMH ADDRESSES
OOEE XX TEMP
OOEF XX XX XX ADDRESSES OOEF -
OOF2 XX XX XX OOFF NOT AVAILABLE
OOFS XX XX XX FOR USER PROGRAMS
OOFS XX XX XX
OOFB XX XX XX
OOFE XX XX
58
-------
ADDRESS CODE
LABEL
ASSEMBLY
COMMENT
0100
0103
0105
0108
01 OB
01 OE
0111
0114
0116
0118
011B
one
01 IE
0120
0122
0124
0126
0128
01 2A
01 2C
012F
0132
0134
0135
0137
0139
01 3B
01 3D
01 3F
0141
0144
0147
20 2F IE NEWLINE
A9 OA
8D 64 01
AD 63 01
20 3B IE
20 9E IE
20 9E IE NEWCHAN
AO 00
Bl EC
20 3B IE
38
A5 EC
E9 01
85 EC
A5 ED
E9 00
85 ED
AO 00
Bl EC
20 3B IE
CE 65 01
FO IB
18
A5 EC
69 03
85 EC
A5 ED
69 00
85 ED
EE 63 01
CE 64 01
FO 03
JSR CRLF
LDA #OA
STA COUNT
LDA CURRENT
JSR PRTBYT
JSR OUTSP
JSR OUTSP
LDY #00
LDA (MEML),Y
JSR PRTBYT
SEC
LDA MEML
SBC #01
STA MEML
LDA MEMH
SBC #00
STA MEMH
LDY #00
LDA (MEML),Y
JSR PRTBYT
DEC TOT
BEQ END
CLC
LDA MEML
ADC #03
STA MEML
LDA MEMH
ADC #00
STA MEMH
INC CURRENT
DEC COUNT
BEQ 03
OA]6 = TEN
CHANNELS PER LINE
PRINT CHANNEL NO.
OF NEXT OUTPUT
PRINT 1 SPACE
PRINT 1 SPACE
PRINT 2 MSD'S
OF CHANNEL CONTENT
DECREMENT
MEML, MEMH
PRINT 2 LSD'S
OF CHANNEL CONTENT
GO TO END IF
ALL CHANNELS PRINTED
INCREMENT
MEML, MEMH
X3
GO TO NEWLINE IF
LINE CONTAINS
59
-------
ADDRESS CODE
LABEL
ASSEMBLY
COMMENT
0149
01 4C
01 4F
0152
0154
0157
01 5A
01 5C
01 5F
0161
0162
0163
0164
0165
4C
4C
20
00
4C
20
A9
20
00
00
FF
XX
XX
XX
11
00
2F
00
00
2F
45
AO
00
01
01
IE
00
IE
IE
END
ERROR
INIT
FIN
CURRENT
COUNT
TOT
JMP
JMP
JSR
BRK
JMP
JSR
LDA
JSR
BRK
NEWCHAN TEN CHANN
NEWLINE IF NOT, G
CRLF
00 HALT
STARTIN
CRLF
#45 PRINT "E"
DUTCH
00 HALT
60
-------
TECHNICAL REPORT DATA
(Please read Instructions on the reverse before completing)
1. REPORT NO.
EPA 600/2-78-099
3. RECIPIENT'S ACCESSION NO.
4. TITLE.AN.
A "
[-MODIFIED PARTICLE SIZE SPECTROMETER
Description and Program Listings
5. REPORT DATE
May 1978
6. PERFORMING ORGANIZATION CODE
7. AUTHOR(S)
C. Lewis
8. PERFORMING ORGANIZATION REPORT NO.
9. PERFORMING ORGANIZATION NAME AND ADDRESS
(Same as Box 12)
10. PROGRAM ELEMENT NO.
1AD712 A-2H (FY-77)
11. CONTRACT/GRANT NO.
12. SPONSORING AGENCY NAME AND ADDRESS
Environmental Sciences Research Laboratory
Office of Research and Development
U.S. Environmental Protection Agency
Research Triangle Park, N.C. 27711
RTF, NC
13. TYPE OF REPORT AND PERIOD COVERED
M 9/7R-17/77
PONSORTfl
14. SPONSORING AGENCY CODE
EPA/600/09
15. SUPPLEMENTARY NOTES
16. ABSTRACT
A fully automated aerosol particle size spectrometer system is described
that consists of a light scattering particle sensor, an analog to digital
converter, and a microcomputer with associated printout device. The system
is capable of acquiring a differential particle size distribution, printing
the resulting spectrum in one of three representations, and repeating the
procedure at preselected intervals. An example of the application of the
system for measuring an outdoor aerosol size distribution is presented.
The appendices contain documented microcemputer program listings and
flow charts for Program Sizer (the program that operates the spectrometer
system and the principal result of this study) and Program MCA (a program
that converts part of the spectrometer system to a conventional 256-channel
pulse height analyzer).
7.
KEY WORDS AND DOCUMENT ANALYSIS
DESCRIPTORS
*Air pollution
'''Aerosols
"''Particle size distribution
* Spectrometers
'"'Computers
'"'Computer systems programs
b.lDENTIFIERS/OPEN ENDED TERMS
c. COS AT I Field/Group
13B
07D
14B
09B
3. DISTRIBUTION STATEMENT
RELEASE TO PUBLIC
19. SECURITY CLASS (ThisReport)
UNCLASSIFIED
21. NO. OF PAGES
69
20. SECURITY CLASS (Thispage)
UNCLASSIFIED
22. PRICE
EPA Form 2220-1 (9-73)
61
------- |