9.5. PROCESS OF TAKING A MEASUREMENT 95
pins PE0-PE3 or the pins PE4-PE7. If you chose the first the group of pins then
the voltage in PE0 will be converted and stored in ADR1, the voltage in PE1 will
be converted and stored in ADR2, etc. If you chose the second group of pins then
the voltage in PE4 will be converted and stored in ADR1, the voltage in PE5 will be
converted and stored in ADR2, etc. Note that if you want to measure more than
4 pins then the only way to do it will be to make two sets measurements, one for
for PE0-PE3 and the other for PE4-PE7.
9.4.2 Scanning
To take a measurement, you have to initiate the conversion. Once it is initiated,
HC11 will take 128 E-clock ticks to complete all the four conversion and fill ADR1,
ADR2,ADR3,and ADR4. In the non-scanning mode, the conversion process stops.
In the scanning mode, once the converted data is stored in ADR4, HC11 will
automatically initiate the next round of conversions to fill ADR1, ADR2,ADR3,and
ADR4. In the scanning mode, ADR1, ADR2,ADR3,and ADR4 will always have the most
up to date value of the input voltage. However, scanning consumes more power,
and can be wasteful if you don’t need data at a fast rate.
9.5 Process of taking a measurement
9.5.1 Turning on (powering up) the convetor
Before you can take any measurements, you have to turn on the A/D convertor.
The convertor is normally off. You turn it on by setting bit #7 of OPTION which
is at location $1039. After power up you need to wait 100 microseconds before
you can us the convertor. 100 microseconds is 200 E-clock ticks. You can put
in a delay of 100 microseconds with this following do nothing counting loop (40
times around the loop with each pass taking 5 clock cycles):
LDAA #40
LT
DECA
BNE LT
Note that you need to do this only once in your program.
9.5.2 Initiating a conversion
You initiate a conversion by writing to ADCTL at address $1030. What you write
to the location depends on what choices you make. Bit #5 is the SCAN bit. Set
Kommentare zu diesen Handbüchern