
94 CHAPTER 9. ANALOG TO DIGITAL CONVERSION
where
D The converted digital value
V Measured voltage
V RL Lower limit voltage
V RH Upper limit voltage
b· · ·c rounded down value
Note: If the input voltage is below the lower limit, then the converted value would
be zero and if the input voltage is above the upper limit, the converted value would
be 255. Again, it is not a good idea to go outside the two limits.
9.3 Electrical Connections
1. To measure any analog voltage, you first need to provide the lower and upper
limit. These are connected to the HC11 to the pins labelled V RL and V RH.
Connect V RL to ground (zero volts) and V RH to five volts. Double check
both these connection before applying power!
2. Now you can measure the analog voltage connected to any of the PORT
E pins. Connect the voltage you want to measure to one of the PORT E
pins. In this experiment, we will measure the voltage available at PE7
2
and
measure it using pin #3 of PORT E. You can now change the voltage using the
potentiometer on the board. Do not use the power supply in the electronics
lab as the test voltage. You can accidentally exceed the five volt limit.
9.4 Decisions, decisions ...
9.4.1 Multiplexing
HC11 provides several options for analog to digital conversions. Every time you
perform a conversion, HC11 will actually perform four conversions in sequence,
and store the converted values in ADR1, ADR2,ADR3,and ADR4 at addresses $1031 to
$1031. You as a programmer can decide how you want to use the four measure-
ments. You can take four measurements of the same input pin. These measure-
ments will be taken 32 E-clock ticks apart or 16 microseconds apart on a standard
HC11 running 2 MHz clock. You can expect your for readings to be almost equal.
This is the non-multiplexed mode. In the multiplexed mode, the four measure-
ments are performed on four different PORT E pins. Here you can either pick the
2
This instruction is specifically for FOX11 board. For other boards, connect a 10K poten-
tiometer between five volts and ground. Connect the wiper of the potentiometer to pin #3 of
PORT E.
Kommentare zu diesen Handbüchern