Lesson 11: Advanced Topics
From "AMERICAN LABORATORY"
by David G. Larsen, Peter R. Rony, Jonathan A. Titus and Christopher A. Titus
Direct Memory Access
DIRECT MEMORY ACCESS is a technique that allows a computer user direct access
to individual memory locations without first having to go through the computer's central
processing unit. The direct memory access, or DMA, interfacing technique has a number of applications
but few microcomputer users fully understand its use, and even fewer have fully implemented
it for scientific data acquisition or control purposes.
Calculation shows that a very simple software routine, one that will input an eight-bit data point
and transfer it to a memory location, will take many microseconds. Further, if additional
points are to be taken and stored in some sort of a sequential file, additional software steps are
needed for housekeeping tasks that count the number of data points, increment the address
pointer, etc. When these additional software steps are introduced into the test program, an
eight-bit data point may be acquired only every 30-40 usee. In many cases, however, higher data
acquisition or data transfer rates are required. The idea of providing the computer user with a direct
access to the memory section of the computer is not new. A direct memory access scheme was
provided for in the Digital Equipment Corporation's PDP-8 series of minicomputers.
Read More: Direct Memory Access.pdf [44.5KB]
Real Time Clocks: An Introduction
IN MANY microcomputer applications
it is necessary to have
the computer perform actions
at accurately timed intervals.
This allows the computer to make
accurate measurements of an
analog signal at 100-msec intervals,
for example. The period of
100 msec may be timed through
the use of a time-delay loop in
which software commands are
used, or through the use of an external
clock.
At this point, it must be realized
that while a time-delay software
routine may generate a delay
of the required accuracy, the
computer can do nothing else
while it is performing the timing
software steps. This is a serious
limitation. Although probably
less obvious, the time-delay software
steps may be interrupted by
an external device that requires
immediate servicing by the computer.
The overall effect is to
lengthen the time required for the
time-delay software steps. The
actual time delay would be the
sum of the time spent in the software
steps and the time spent servicing
the external interrupt.
In most instances in which accurate
periods are required, an
external circuit is used to time the
necessary periods with as little interaction
between the computer
and the external clock as possible.
Such clocks are immune to
external interrupts and to
changes in the normal flow of a
program. Once started, they continue
to time a period until it is
completed and the time is up. In
this way, the clock runs parallel
with the computer, allowing the
computer to perform other tasks
and service interrupts while the
clock is running. This type of an
external clock is often called a
real-time clock, since its time is
real, in that it cannot be altered
or delayed by events that would
normally affect a program.
Read More: Real Time Clocks An Introduction.pdf [127KB]
Real Time Clocks: Hardware and Software
IN OUR last column, we described
real-time clocks and their characteristics.
In this column, we will
describe some of the hardware devices
and software instructions that
can be used to build and use a realtime
clock.
Perhaps the simplest clock that
can be built is a free-running realtime
clock. The schematic for one of
these devices is shown in Figure 1.
The "heart" of this circuit is the
Mostek Corporation MK5009, which
is driven by a I-MHz quartz crystal.
This device contains a number of divide-
by-IO counters, and you can select
which divide-by-IO counter will
drive the MK5009's output. There
are four digital inputs to the device
that are used to select the required
decade counter. The truth table for
these inputs and the resulting output
frequencies are listed in Table 1. For
input values greater than 1000" the
MK5009 generates frequencies that
are not multiples of ten.
Read More: Real Time Clocks Hardware And Software.pdf [127KB]
Sorting
QUITE OFTEN, a program will execute much. faster if the values it accesses are
sorted. Sorting also is useful when data values or alphanumeric strings have to be' output to a printer or a
cathode-ray tube (CRT) in a specific order. Sorting is defined as the rearrangement of data values in a list,
table, record, or file in an ascending or descending order. If the data values consist of alphanumeric
strings, then the strings will be sorted in alphabetic or alphanumeric order.
A number of different methods can be used to sort data, including: straight insertion sort, binary insertion
sort, Shell's sort, bubble sort, quick sort, heap sort, merge-exchange sort, and two-way merge
sort. In general, all of these sorting methods can be classified as one of the following sorting methods: insertion
method, exchange method, selection method, merge method, distribution method.
This column discusses only the exchange method of sorting numeric values. Specifically, this column is
concerned with the bubble sort method. This method is perhaps one of the slowest methods that can be used.
However, it is probably easier to write a bubble sort subroutine than any other type of sort subroutine.
Read More: Sorting.pdf [127KB]