314/317
10 - Second Application: a Sailing Computer
which both forces the linker to put any variables declared after this line into the
_ZEROPAGE
segment. It also specifies that all accesses to the corresponding variables must be done using
direct short addressing. The fact that a variable is in the
_ZEROPAGE
section does not imply that
short addressing must be used, so it is necessary to specify
SHORT
as well.
This fine tuning can be done by studying the resulting map file, then calculating the free room
in the
_ZEROPAGE
segment, then moving those variables that are both freqently used and have
a total size that fits the available space.
10.7 CONCLUSION
This application demonstrates a system where two contradictory needs are combined to-
gether:
Data collection and display refresh that have real-time requirements.
Data processing that requires a lot of computing power, but with no particular requirement
regarding speed.
Each of these requirements could be satisfied by means of a proper balance between the in-
terrupts and the main program. The interrupt service functions have been designed so that
they had as little computation as possible to perform, just moving data between memory and
peripherals. The main program then retrieves the data from memory, processes it, and puts
the results in yet another memory storage, so that it can be displayed or sent through the serial
line. The correct functioning relies on appropriate handshaking (for the serial transmission)
and the enforcement of the rules on atomicity (for data transfer from the sensors to the calcu-
lation block).
Although the ST7 is a medium-range 8-bit product, it benefits from the full use of the C lan-
guage, that allowed us to write both the byte-level actions and the floating-point calculations
with the same ease. The only points where building a microcontroller application is trickier
than a PC-based application are the peripheral initializations (for there is no DOS to take it
over) and the m emory mapping with the associated compiling options that require some
thought and some trial and error before actually working on the emulator and then on the pro-
totype.
Содержание ST7 Series
Страница 1: ...ST7 8 BIT MCU FAMILY USER GUIDE JANUARY 1999 1 ...
Страница 238: ...238 317 8 C Language and the C Compiler 08 Burn bmp Then use the EPROMer programmer software as described in Chapter 7 ...
Страница 289: ...289 317 10 Second Application a Sailing Computer 10 befor Bs Rw Vw VMG AlphaR AlphaV Before the wind ...