9 led control with u08led.h, 10 software adc module u08adc.c, Led control with u08led.h – Motorola USB08 User Manual

Page 52: Software adc module u08adc.c, Software module descriptions

Advertising
background image

Designer Reference Manual

USB08 Evaluation Board

52

Software Module Descriptions

MOTOROLA

Software Module Descriptions

NOTE:

It has to be pointed out for completeness, that with the KBI module of the
MC68HC908JB8 not only single keys but also extensive key fields in
matrix arrangement can be easily scanned.

3.9 LED Control with U08LED.H

Controlling the three light-emitting diodes (LED) attached to port D is
easy. For initialization, the data direction of the used port pins PTD[0..2]
has to be switched to an output state. The initialization as well as the
switching of the LEDs is performed via four macros. Therefore, a header
file is enough for the realization of these functions. A special C module
is not required in this case.

The LEDs are addressed, beginning with a 1. The switching on of the
first LED (at PTD[0]) takes place, for example, by means of:

onLED(1);

3.10 Software ADC Module U08ADC.C

Although the MC68HC908JB8 does not have an integrated ADC, it is
nevertheless possible to measure analog values (and in particular
resistance values) in a simple way. For this purpose, an RC combination
is attached to a conventional digital port pin and the load time of the
capacitor is measured. The working principle is shown in

Figure 3-2

.

Figure 3-2. Measurement of Resistor Values Using a Digital Input

V

CC

R

C

GND

S

E

Advertising