Chapter 4
Chapter 4
Chapter 4
Chapter 4
Chapter 4
Register Structure And Format
19
How to Initiate an A/D Conversion
The
PCL-813
A/D
conversion
is
software
controlled,
and
is
based
upon
the
polling
concept.
After
the
A/D
converter
has
been
triggered,
the
application
program
checks
the
Data
Ready
Bit
(DRDY)
of
the
A/
D
status
register.
If
this
bit
is
detected
(high),
then
A/D
conversion
is
in
progress.
When
this
bit
returns
to
low,
then
A/D
conversion
is
completed,
and
the
converted
(binary)
data
may
be
read
by
the
program.
There
are
two
software
methods
to
force
the
A/D
converter
to
execute
a
single
conversion:
by
writing
a
program
yourself
that
writes
the
instruction
directly
to
the
I/O
port,
or
by
writing
a
program
which
utilizes
that
provided
by
the
PCL-813
driver.
We
suggest
that
you
use
the
latter,
the
PCL-813
software
driver,
since:
• It
makes
your
programming
job
easier.
• You
will
obtain
a
more
readable
source
code
which
is
easy
to
debug.
• It
will
enhance
your
program’s
performance.
For
those
who
prefer
to
use
the
first
method,
writing
directly
to
the
I/O
ports
from
within
their
own
application,
we
provide
the
following
step
by
step
procedure:
Step
1:
Set
the
desired
channel
by
specifying
the
MUX
scan
range.
Wait
at
least
5
ms
before
issuing
a
new
command
to
the
PCL-813.
Step
2:
Trigger
the
A/D
conversion
by
writing
any
value
to
BASE+12
of
the
A/D
port,
and
then
wait
at
least
20ms.
Step
3:
Wait
until
the
Data
Ready Signal (Read the A/D high byte
register DRDY bit, D4 of BASE+5) has returned to low.
Step 4:
Obtain the binary data by reading the A/D registers
(BASE+5 and BASE+4). First read the high byte, then the
low byte.
Step 5:
Convert the binary data to an integer value.
Refer to the DEMO01.C program for further details.
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com