296/317
10 - Second Application: a Sailing Computer
The schematic above shows how the three LCD components are driven. Each segment and
the backplane of each component is connected to an output of a eight-bit, serial-in, parallel-
out, shift register. All shift registers are cascaded. Thus the whole display is driven using only
two wires: data and clock. At each clock pulse, the data bit is shifted by one place. After 96
clock pulses, the first bit is output at the farthest output of the shift register, and all following
bits appear at the successive outputs, supplying each segment with either a zero or a one.
Sending this data would consume a lot of core time, if it were to be performed entirely by soft-
ware. Luckily, the ST7 has a very useful peripheral, the Serial Peripheral Interface.
The SPI is able to send each of the eight bits of one byte serially, producing a clock pulse for
each bit sent. The process is started when the SPI Data Register is written to, and the data is
output at the MOSI pin if the SP I is set to Master mode. This way, the whole display is re-
freshed by sending only one byte for each digit of the display, that is twelve bytes altogether.
The clock frequency may be chosen from 1/2 to 1/64 of the core clock. Here, we shall use the
fastest clock, that means that sending eight bits will take 16 core cycles.
Each of the right-hand three digits is composed of seven segments, and a decimal point. The
left-hand digit is only capable of disp, -, plus a one, plus a symbol (an arrow).
The relationship between the byte sent and the pattern displayed depends on the actual wiring
of the display board. The coding of the various patterns for each case and for the board used
in this application is shown in the picture below.
The SPI must be configured in master mode. In this mode, the
SS
pin must be set to a high
level. This can be done either by connecting the corresponding pin (which is also
PC7
) to the
supply voltage and configuring that pin as an input, or by leaving that pin unconnected and
configuring it as an output, while the corresponding bit in the Data Register is set to one.
Содержание 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 ...