beautypg.com

3 general structure of the m68hc08 firmware, General structure of the m68hc08 firmware – Motorola USB08 User Manual

Page 44

background image

Designer Reference Manual

USB08 Evaluation Board

44

Software Module Descriptions

MOTOROLA

Software Module Descriptions

3.3 General Structure of the M68HC08 Firmware

The firmware of the M68HC08 consists of several source code modules
which are embedded into a common compiler project. The main()
function is contained in the module

U08MAIN.C

. It controls the program

sequence via an endless loop (as usual in embedded software). The
module

U08KEY.C

settles the scanning of the input keys. Control of the

light-emitting diodes (LED) on the board is done using simple C macros;
no special C module is required for this purpose. The module

U08ADC.C

is responsible for reading of the resistive sensors.

These modules are supported by the file

VECJB8.C

, which contains the

interrupt and reset vectors. The four C source code modules are merged
into a common compiler project. In addition, the assembler module

CRTSJB8.S

which contains the C startup code is required.

The control of keys, LEDs, and analog-to-digital (A/D) transmitters are
support functions to the demonstration project because the main
attention is paid to the communication interface. The communication
functions are implemented directly by means of “#include” instructions in
the main module

U08MAIN.C

.

Two ways of communication are implemented in the demonstration:
RS232 or USB. The selection takes place by defining USE_USB_PIPE
in the head of the main module. If this macro is defined,

U08USB.C

automatically becomes a part of the main module; otherwise, the RS232
communication module

U08232.C

is merged.

If the USB implementation in the file

U08USB.C

is used, the file

U08DESC.C

is also translated at the same time. It contains the static

data for all necessary USB descriptors.

For each of the C files

U08KEY.C

,

U08ADC.C

,

U08USB.C

, and

U08232.C

there is a corresponding header file (* H) with the same base

name. The functions for controlling the LEDs on the board are contained
as macros in the file

U08LED.H

. In several cases, the header

MC68HC08JB8.H contains the register and bit mask definitions required
by the MC68HC908JB8 microcontroller (MCU).