Custom Fuzzy Logic Programming - Motorola HC12 Refrence Manual

Table of Contents

Advertisement

If the WAV instruction is interrupted, the internal temporary registers TMP3, TMP2,
and TMP1 need to be stored on the stack so the operation can be resumed. Since the
WAV instruction included initialization in cycle 2.0, the recovery path after an interrupt
needs to be different. The wavr pseudo-instruction has the same opcode as WAV, but
it is on the first page of the opcode map so there is no page prebyte ($18) like there is
for WAV. When WAV is interrupted, the PC is adjusted to point at the second byte of
the WAV object code, so that it will be interpreted as the wavr pseudo-instruction on
return from the interrupt, rather than the WAV instruction. During the recovery se-
quence, the PC is readjusted in case another interrupt comes before the weighted av-
erage operation finishes.
The resume sequence includes recovery of the temporary registers from the stack (2.1
through 4.1), and reads to get the operands for the current iteration. The normal WAV
flow is then rejoined at cycle 7.0.
Upon normal completion of the instruction (cycle 12.0), the PC is adjusted so it points
to the next instruction. The results are transferred from the TMP registers into CPU
registers in such a way that the EDIV instruction can be used to divide the sum-of-
products by the sum-of-weights. TMP3 : TMP2 is transferred into Y : D and TMP1 is
transferred into X.

9.7 Custom Fuzzy Logic Programming

The basic fuzzy logic inference techniques described above are suitable for a broad
range of applications, but some systems may require customization. The built-in fuzzy
instructions use 8-bit resolution and some systems may require finer resolution. The
rule evaluation instructions only support variations of MIN-MAX rule evaluation and
other methods have been discussed in fuzzy logic literature. The weighted average of
singletons is not the only defuzzification technique. The CPU12 has several instruc-
tions and addressing modes that can be helpful when in developing custom fuzzy logic
systems.
9.7.1 Fuzzification Variations
The MEM instruction supports trapezoidal membership functions and several other va-
rieties, including membership functions with vertical sides (infinite slope sides). Trian-
gular membership functions are a subset of trapezoidal functions. Some practitioners
refer to s-, z-, and π-shaped membership functions. These refer to a trapezoid butted
against the right end of the x-axis, a trapezoid butted against the left end of the x-axis,
and a trapezoidal membership function that isn't butted against either end of the x-
axis, respectively. Many other membership function shapes are possible, if memory
space and processing bandwidth are sufficient.
Tabular membership functions offer complete flexibility in shape and very fast evalua-
tion time. However, tables take a very large amount of memory space (as many as 256
bytes per label of one system input). The excessive size to specify tabular member-
ship functions makes them impractical for most microcontroller-based fuzzy systems.
The CPU12 instruction set includes two instructions (TBL and ETBL) for lookup and
interpolation of compressed tables.
MOTOROLA
9-26
FUZZY LOGIC SUPPORT
CPU12
REFERENCE MANUAL

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cpu12

Table of Contents