Frequency of F4 and Its Octave
Frequency of F4 and Its Octave
November 2000
Contents
SOUND
Sound Waves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Three Elements of Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
ANALOG AND DIGITAL
Analog and Digital Devices Waves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Analog and Digital Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
BINARY NUMBERS
Decimal and Binary Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Parallel and Serial Data Transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . 9
DIGITAL RECORDING
Outline of Digital Recording Waves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9
Process of Digital Recording . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
ELECTRONIC KEYBOARDS
Type of Electronic Keyboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Outline of Electronic Keyboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . 13
Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . 14
CPU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 15
System Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . .. . 19
DAC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .... . . . . . 21
Key Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ... . . . . . 21
Page
SOUND
SOUND WAVES
Sound is a wave motion of varying pressure in air. The pressure variations result from the mechanical vibra-
tions of a source producing the sound, for example a vibrating tuning fork.
440 Hz
equals 440 Hz.
Time
Fig. 1
SOUND
Fig. 2
-1-
Pitch
Pitch is used to describe the highness or lowness of a sound. A piccolo produces a high pitch sound, and a
bass tuba produces a low pitch sound. In musical instruments, pitch is the frequency of the sound wave
produced. Pitch determines the position of a sound on musical scale as shown in Fig.3. Every pitch is named
with a capital letter A to G and a number 0 to 8 as shown in Fig. 4. The standard pitch is 440 Hz for the tone
A4.
Middle C
Semitone
C#4 D#4 F#4 G#4 A#4
C4 D4 E4 F4 G4 A4 B4 C5
Octave
Fig. 3
# # #
# #
Pitch name C4 C#4 D4 D#4 E4 F4 F#4 G4 G#4 A4 A#4 B4 C5
Frequency 277.17 311.12 370.00 415.31 466.16
(Hz) 261.63 293.66 329.63 349.23 392.00 440.00 493.88 253.25
Standard pitch
Octave
Semitone
Fig. 4
Octave The octave is a unit representing a span of frequencies having a ratio of 2 to 1. One octave above
A3 (220 Hz) is A4 (440 Hz), and one octave above A4 (440 Hz) is A5 (880 Hz). One octave is equal to 12
semitones because there are 12 musical tones within the octave.
Semitone The interval between two musical tones. The basic frequency ratio of the semitone is equal to the
twelfth root of 2. (The twelfth root of 2 is 1.059463.) The frequency of A#4 can get by multiplying the frequency
of A4 (440 Hz) by 1.059463.
The frequency of A#4 = 440 Hz x 1.059463 = 466.16 Hz
Timbre
Timbre is quality of a sound. We can judge that two sounds produced with a piano and a organ are dissimilar
even if two sounds have the same loudness and pitch. Timbre depends on the waveform of the sound pro-
duced by an instrument as shown in Fig. 5.
-2-
Frequency range of 88-key piano
D#6
E6
D6
1318.51
1174.66
) Frequency ratio is 1.059463
G#4 415.31 Hz
C#6 1046.50
C6
B5 987.77 ) Frequency ratio is 1.059463
A#5 G4 392.00 Hz
A5 880.00
G#5 783.99 One semitone
G5
F#5 968.46
F5
E5 659.26
D#5 587.33
D5
C#5 523.25 Cent
C5
B4 493.33 The cent is a musical unit representing a frequency
A#4 440.00
A4
G#4 variation in the logarithm. The frequency variation
G4 392.00
F#4
F4 349.23 of 100 cents is equal to a semitone. The cent is
E4 329.63 used for tuning musical instruments.
D#4 293.66
D4 Example: 440 Hz plus 20 cents
C#4 261.63
C4 Antilogarithm of 20 cents is 1.01162 in Table 1.
B3 246.94
A#3
A3 220.00 440 Hz x 1.01162 = 445.11 Hz
G#3 196.00
G3
F#3 174.61
F3 Antilogarithm
E3 164.81 Cent Plus Minus
D#3 146.83
D3 1 1.00058 0.99942
C#3 130.81 2 1.00116 0.99884
C3
B2 123.47 3 1.00173 0.99827
A#2 110.00 4 1.00231 0.99769
A2
G#2 98.00 5 1.00290 0.99711
G2
F#2 87.31 6 1.00347 0.99654
F2
7 1.00405 0.99597
E2 82.41
D#2 8 1.00463 0.99539
D2 73.42
C#2 9 1.00521 0.99482
C2 65.41 10 1.00579 0.99424
B1 61.74 15 1.00870 0.99137
A#1 55.00 20 1.01162 0.98851
A1
G#1 49.00 25 1.01454 0.98567
G1
F#1 43.65 30 1.01748 0.98282
F1
E1 41.20 35 1.02042 0.97998
D#1 36.71 40 1.02337 0.97716
D1
C#1 45 1.02633 0.97434
C1 32.70
50 1.02930 0.97153
B0 30.87
A#0 A0 27.50
Table 1
Fig. 6 -3-
Fundamental and harmonic frequencies
The fundamental frequency is the lowest frequency of a sound. A sound includes higher frequencies than the
fundamental. Those higher frequencies are called harmonics, which frequencies are exact multiples of the
fundamental; twice the fundamental frequency on the second harmonic, three times of the fundamental on
the third harmonic. However, the amplitude of each harmonic decreases in inverse proportion to the har-
monic number. For instance, the fundamental sine wave and all harmonics make up a saw-tooth waveform as
shown in Fig. 7. The other hand, the fundamental sine wave and odd harmonics make up a square waveform.
Fundamental
Complex waveform
3rd harmonic
2nd harmonic
Fig. 7
The higher harmonics must be included in the sound, which otherwise would not have its characteristic
timbre. It is the harmonics that make one source of sound different from another source.
Volume
Volume is the intensity of a sound. Volume depends on the amplitude of sound waves. Greater amplitude
means a louder sound. In the sound wave, more amplitude means greater changes in air pressure. In a
corresponding electrical sound signal, more amplitude means greater changes in voltage.
Fig. 8
Envelope Envelope
Loudness envelope is a curve drawn to pass through the
peaks of a sound waveform as shown in Fig. 9. The overall
loudness of a sound changes during its length. Envelope of
each musical sound has a typical shape as shown in Fig. 10.
However ,the same instrument produces the sound having
different quality by changing its envelope.
Fig. 9
-4-
Typical envelope
Fig. 10
Attack Decay
Four stages of envelope
A basic envelope consists of four stages, attack,
Sustain
decay, sustain and release as shown in Fig. 11.
Release
Changing of attack stage, a fast attack to a slow,
this thing gives an obvious effect on quality of sound.
Fig. 11
Physical variables
1.0 2.0 (rotation)
Continuous
Reading
0 3.0
Volts
Voltage
Fig. 12
A digital multimeter provides a direct reading of the measured value of voltage. The digital meter having four-
digit display with a floating decimal is more accurate than the analog meter.
Fig. 13
-5-
ANALOG AND DIGITAL SIGNALS
Sine wave The sine wave is an example of analog signal; its value in-
crease or decrease gradually, and the changes are smooth
and continuous.
Its amplitude represents information content.
Fig. 14
The digital signal is a train of pulses as shown in Fig. 16. The +5 V level is called the HIGT voltage, then the 0
V level becomes the LOW voltage. The HIGH and LOW levels represent the binary digits 1 and 0, also the
train of pulses represent binary number 10101 as shown in Table 1.
Table 1
Digital systems deal only with the binary numbers “zero” and “one” because binary numbers can be repre-
sented easily by “on - off” switch position within a electronic circuit.
BINARY NUMBERS
10 is the base and each position to the left of the decimal point corresponds to a power of 10.
10 3 10
2 10 1 10 0
Quantity
Thousands Hundreds Tens Digits o to 9
1 9 9 7 1997
Table 2
-6-
Binary Numbers
In the binary number system, there are two digits, 0 and 1. The binary place values are in powers of 2 starting
with 1s, then 2s, 4s, 8s and so on. Only binary numbers are used in digital circuits. The reason for using
binary numbers is that digital circuits operate with squarewave pulse waveform. The pulses have only two
amplitudes. The “on,” or HIGH, state can be represented by binary 1, and the “off,” or LOW, state as binary 0.
The total number of fingers on both hands is written 1010 since
1 0
1 x 23 + 0 x 22 + 1 x 2 + 0 x 2
( 8 + 0 + 2 + 0 = 10 . . . . Decimal number )
3 2 1 0
2 2 2 2 Quantity
Eights Fours Twos Digits o or 1
1 0 1 0 1010
Table 3
8
bit Eight bits can be arranged in 2 = 256 different combinations.
8 bits 1 1 0 0 0 1 0 1 = byte
bit
Fig. 17
Data to be sent 1 1 0 0 0 1 0 1
Line D7 +5 V
Line D6 +5 V
Line D5 0V
8-bit Line D4 0V
microprocessor Line D3 0V
Line D2 +5 V
Line D1 0V
Line D0 +5 V
Fig. 18
-7-
Number Conversion
Binary - to - decimal conversion
To convert a binary number to its decimal equivalent, add the decimal equivalents of each position occupied
by a 1.
For example,
7 6 2
11000101 --> 2 + 2 + 0 + 0 + 0 + 2 + 0 + 2 0 = 128 + 64 + 4 + 1 = 197
Hexadecimal Notations
The number of years of in a century can be written Decimal Binary Hex
100D. In binary notation, this would be written 0 0000 0
01100100B. The suffix B is used whenever neces- 1 0001 1
sary to avoid confusion. 2 0010 2
Decimal Binary 3 0011 3
100D <--> 01100100B 4 0100 4
5 0101 5
8-bit numbers are difficult for humans to deal with. 6 0110 6
Hexadecimal numbers are most commonly used in 7 0111 7
microprocessor work. In the hexadecimal notation, 8 1000 8
each group of four bits is represented by a single 9 1001 9
hexadecimal number. Since four bits can take on six- 10 1010 A
teen different numbers, we supplement the ten deci- 11 1011 B
mal digits 0 to 9 with the letters A, B, C, D, E, and F. 12 1100 C
For example, 13 1101 D
Binary Hexadecimal Decimal 14 1110 E
10100100B <--> A4H <--> 164D 15 1111 F
16 10000 10
1010 0100 32 100000 20
10D --> AH 4D --> 4H 64 1000000 40
128 10000000 80
256 100000000 100
512 1000000000 200
1024 10000000000 400
2048 100000000000 800
Table 4
-8-
PARALLEL AND SERIAL DATA TRANSFER
Binary numbers can be transferred in one of two forms, parallel form and serial. In digital devices, data is
transferred in parallel form to obtain higher performance. In the transmission of data by telephone lines or
radio, it is better to have the data in serial form, so only one line or channel is needed.
9 3
1 0 0 1 0 0 1 1
1 0 0 1 0 0 1 1
Serial data transfer takes time but it
Serial data transfer needs only one line.
9 3
1 1
D0 1 1 Parallel data transfer
D1 0 1 needs four lines but it is 0 1
0 0 faster.
D2 0 0
D4 1 0
1 0
Parallel data transfer
Fig. 19
DIGITAL RECORDING
134 10000110
256 175 10101111
207 11001111
231 11101010
200 Audio waveform 246 11110110
253 11111101
243 11110011
211 11010011
205 11001101
100 215 11010111
220 11011100
198 11000110
159 10011111
115 01110011
0 ... ........
... ........
134
175
207
231
246
253
243
211
205
215
220
198
159
115
77
55
62
76
71
39
16
23
41
67
104
... ........
Memory
Numbers corresponding to voltage
Decimal numbers Binary numbers
Fig. 20
-9-
To replay the recorded sound, the numbers are turned back into voltage levels, and the original waveform
reconstructed from the numbers. A digital recording can be re-recorded over and over again, copied, and
re-copied, the sound will be as perfect as the first recording, with no degradation.
>
>
>
>
The low pass filter transmits only an audio signal, since high frequencies over 20 kHz become a noise.
The sample & hold circuit cuts an audio waveform into brief time intervals, and freezes the voltage level.
The ADC (Analog to Digital Converter) converts the voltage level into a digital signal. The ADC chooses the
binary number that most closely represents the voltage level from possible values, then provides pulse code
to the processor.
Sampling Quantization
256 (8-bit ADC)
232
200 231 231: Closest number
230
229
Coding 1 1 1 0 1 0 1 0 1
0
(8 bits give 256 different numbers.) (Pulse Code)
Fig. 22
The processor encodes an off-set binary number into an appropriate code, then stores the code onto the
memory. If necessary, the code is modulated into a certain symbol by the processor before storing.
The memory stores information of the recorded sound data.
- 10 -
Sampling frequency: Frequency of time intervals is called “Sampling frequency” or “Sampling rate.” The
sampling frequency determines the highest frequency that an audio waveform can be recorded without
distortion. The sampling frequency should be at least twice the highest frequency found in the waveform.
Sampling frequency
Distortion
4:1
Fig. 24
Resolution: Resolution is used to refer the number of possible values that can be represented by a ADC.
Resolution is expressed as the number of bits, which equals to the bits of the output binary number from the
ADC. Resolution determines signal-to-noise ratio of a digital recording system.
Maximum
voltage level 8-bit resolution 16-bit resolution
1.0 V
256 Noise 65536 Noise
231 59046
231 59046
3.9062 mV 0.0156 mV
230 59045
Fig. 25
Memory Size
Memory size depends on sampling frequency, resolution and sampling length. Higher sampling frequency
and resolution make better quality of the recorded sound. However they requires the larger memory size.
For example: Record 5-octave notes (61 keys) with sampling frequency 44.1 kHz, 16-bit resolution,
sampling length 5 seconds, stereo
Memory size= 61 x 16 x 44.1 x 1000 x 5 x2 = 51 M bytes
- 11 -
ELECTRONIC KEYBOARDS
Synthesizer
Containing oscillators, an analog synthesizer first generates the basic oscillations all different in
shapes of waveform. The machine creates a complex waveform by combining the oscillations, it
then changes the harmonic content of the complex waveform by removing undesired harmonics
with filters. Finally the machine controls the amplitude using envelope generators. Those
processes are controlled by the internal controllers.
The synthesizer allows the player access to the controllers so that he can design the processes.
That is why, analog synthesizers are capable of creating any sound players want. In digital
synthesizers, the internal controllers are replaced with processors. But method of synthesis in
digital system is different among manufacturers.
- 12 -
OUTLINE OF PCM KEYBOARD
PCM sound source keyboards reproduce a sound by reversing process of the digital recording. The principal
components in the instruments are shown in Fig. 27.
Development stage
Microphone
Components in products
Console
& Display
>
ROM
Amp. Filter DAC CPU
(memory)
Key controller
& Keyboard
Fig. 27
The ROM stores information of the recorded musical notes, rhythm patterns and demo tunes in binary form.
The CPU controls the console, and communicates with the key controller. When a key is pressed, the CPU
reads data of the selected tone and key from the ROM. The CPU expands compressed data, and operates
looping function so that the data is reconstructed as like as the original. The CPU decodes the data into pulse
code, then provides to the DAC at specific intervals, which intervals depend on sampling frequency at record-
ing. If more than one key are pressed, the CPU performs that process by data of each key at the same time,
and adds all data in the intervals. The DAC converts the pulse code into a voltage level in time, finally it
reproduces a waveform. The filter transmits only an audio waveform since the stepped waveform output from
the DAC includes higher frequencies than audible.
Fig. 28
- 13 -
MEMORY
In a digital system, instructions and binary data are stored in the memory, an organized arrangement of
memory cells. Each cell is capable of storing one bit of information. In Random-Access-Memory (RAM, now
it is interpreted as read-and-write memory), the computer can store (“write”) data at any selected location
(“address”) and, at any subsequent time, retrieve (“read”) the data. In Read-Only-Memory (ROM), data are
initially and permanently stored by the manufacturer; the computer can read the data at any address, but
cannot alter the stored bits.
In Fig. 29, a 1024 x 1 bit RAM chip could consist of 1024 memory cells arranged in a 32 x 32 matrix. The
address is coded as a 10-bit binary number. A 10-bit binary number is sufficient to define any one of the 1024
bits.
Data
2
A1 Bit at address 2,3
3
(row)
A2 00010 00011
Write
A3 Chip enable
A4 31 Read
0 1 2 3 31
Read / Write
Address decoder
10-bit coded address (column)
A5 A6 A7 A8 A9
Fig. 29
Two decoders translate the coded address and activate one of row-select lines and one of column-select
lines. The cell at the address is selected. There are two control signals “chip enable” and “read/writ”. The chip
enable signal activates the read/write circuits. The read/write signal controls the selection of “set/unset the
cell” (write) or “read the state of the cell” (read). In the write operation, one bit data is transferred from the data
line to the selected cell. In the read operation, the data of the selected cell is transferred to the data line.
Memory Capacity
The 1024 x 1 bit RAM is rather small these day. RAM chips containing 8192 x 8 bits (65536 memory cells) or
more are used in modern designs. A 8192 x 8 bits RAM can be read or written one 8-bit data at a time, using
13-bit address code. The RAM is also called a 64K-bit or a 4K-byte RAM. The capital K is a prefix representing
“computer kilo” of 1024 (210 ), used especially when indicating the size of memory.
Example: What is the memory capacity of a RAM having A0 to A14 address lines and D0 to D7 data lines?
10
A0 to A9 --> 10 lines (2 ) --> 1K
5
A10 to A14 --> 5 lines (2 ) --> 32 1K x 32 x 8 bits = 256K bits = 32K bytes
D0 to D7 --> 8 bits
Type of RAM
There are two type of RAM, the static RAM and dynamic RAM. The static RAM is widely used in electronic
keyboards in having very low power consumption
Memory cells in the dynamic RAM must be refreshed by inputting data again, every millisecond or so. But the
advantage of static RAM is that it has a short access time.
- 14 -
Diagram for a 2048 x 8 bits (2K bytes) static RAM
A0 D0
A0
Address decoder
A1 128 rows Data
x Address bus
A2
(row)
128
A3 16 columns bus D7
R/W Read / Write
A4 Memory size A10 CE1
A5 2048 x 8 bits CE2 Chip enable
A6
Output data
16 x 8 bits
buffer
D0
D1
Input data
controller
Sense amp.
D2 Write amp.
D3
D4 Address decoder
D5 CE1
(column)
D6 Read / Write
CE2
A7 A8 A9 A10
Fig. 30
ROM
RAM will lose the contents of the memory when the power is interrupted. ROM permanently holds the data
stored by manufacturers. The same technologies are used in ROM as in RAM. In general, ROM is simpler
than RAM since fewer control elements are necessary.
CPU
The main component in a digital system is the CPU (Central Processing Unit). Let us start with a basic
computer organization before learning the CPU in electronic keyboards.
A computer is a vast assemblage of simple logic gates and memory devices organized to perform complex
calculations at high speed by automatically processing information in the form of electrical pulses. The infor-
mation consists of data and instructions; a complete set of instructions is called a program. The functional
organization of a basic computer is illustrated in Fig. 31.
Data
Instructions INPUT CONTROL OUTPUT Results
MEMORY
Fig. 31
All communication from the operator to the machine is through the input devices. Each instruction or data is
stored into the computer memory. The CPU fetches the instructions from the memory, decodes them to
arrange the processing circuitry, executes the instructions, and then makes the results available at output
ports. A single chip CPU contains the instruction decoder, controller, accumulator, auxiliary registers, timing
circuits , and I/O buffers as shown in Fig. 32.
- 15 -
Internal diagram of a basic CPU
Registers RESET
Instruction decoder Accumulator
INT
Instruction registers ALU Program counter NMI
WAIT
IORQ
RD
Clock WR
etc.
Control & Timing
Fig. 32
The CPU is connected to the rest of the system by three groups of lines: the data bus, the address bus and
the control bus. Also connected to the buses are the memory and input and output ports. The data bus is used
by the system to transmit binary numbers (data) from point to point. The address bus is used by the CPU to
access to any location of memory or registers of the I/O ports. The control bus is used by the CPU (or other
devices) to indicate status of the system, and to control the system.
Data bus
Memory
CPU (program/data/ Input ports Output ports
PG working storage)
Control bus
Address bus
Fig. 33
- 16 -
System diagram for a high-end keyboard
Keyboard Console
Display/button
Key controller controller I/O ports
Buses ROM
(data storage :
PCM sound data)
ROM
DAC CPU (program storage)
RAM
(working storage)
PG
Analog circuit Digital circuit Memory
Fig. 34
The combination of the CPU, IC memory devices, a DAC, and I/O ports constitutes a high-end keyboard as
shown in Fig. 34. In a low-end keyboard, the CPU is actually made up of those components on a single chip
as shown in Fig 35. In a standard keyboard, the CPU generally contains built-in I/O ports in it. In a high-end
keyboard, the CPU is similar to a microprocessor for a basic computer.
Fig. 35
Signals to CPU
Fundamental signals to the CPU in a basic keyboard is listed below. The power source, clock and reset
signal are essential for the CPU to bring it to life.
POWER: +5 V power source and ground.
CLOCK: A source of accurately timed pulses, used for synchronization in a digital system. A clock governs
timing to execute an instruction in the CPU.
RESET: Reset forces the digital system to zero and gets the CPU ready to start at location zero.
Power, Clock and Reset signals are essential for the CPU to perform any function.
- 17 -
Control signals
INT: Interrupt request accepts the signal generated by an I/O device requiring service.
NMI: Non-maskable interrupt is a high priority interrupt to save program status in case of a power failure; it
forces the CPU to restart in a designated location.
MREQ: Memory request indicates that the address bus holds a valid address for a memory read or write
operation.
RD: Read indicates that the CPU wishes to read data. The device addressed uses this signal to put data
on the data bus.
WR: Write indicates to memory or an I/O device that the data bus holds valid data to be stored.
IORQ: I/O request indicates that the address bus holds a valid address for an I/O read or write.
WAIT: Wait tells the CPU that the device addressed is not ready for a data transfer.
APO: Auto power off signal controls the power supply circuit.
Address and data buses
Address bus: A group of lines used for accessing a memory or an I/O port by the CPU.
Data bus: A group of lines used for transmitting data from one or more source to one or more distinations.
State of CPU
The CPU of a standard keyboard gets into one of three states, dead, suspended and active as shown in Fig.
36, since the keyboards equip with the auto power off function. The CPU is dead at no power source, then
gets into the suspended state when supplying the power source. The CPU becomes active when switching
the power on, and it is changed into active and suspended at every power on or off operation.
Operation: Batteries are set or removed. The power switch is selected on or off.
An adapter is plugged in or out.
Fig. 36
2 3
MNI 3 Power-off subroutine
CPU 2 Power-on subroutine Program
1
RESET
1 Initialize subroutine
Low address
Fig. 37
- 18 -
SYSTEM OPERATION
The illustration in Fig. 37 shows process in system operation of a standard keyboard. Reset signal is provided
to the CPU immediately the power source is applied. The lower address of the memory are generally ROM,
so that the CPU starts executing a program at location zero by receiving the reset signal. The CPU executes
the program, which includes information about the system and instructions to be done first, this operation is
called “initialize.” After that the CPU turns suspended state.
Non-maskable interrupt (NMI) is provided to the CPU when the power switch is pressed. Upon receipt of the
interrupt, the CPU restarts in “power-on subroutine” of the program and sets up the system at the ready to
play. During this operation, the CPU provides the APO signal to the power supply circuit.
The CPU will restart in “power-off subroutine” of the program, and will shut down the power when receiving
NMI signal again.
The illustration in Fig. 37 shows that the entire program is stored into an external ROM. However, in some
keyboards, part of the program or the entire program is stored into the CPU, since the CPU chip contains an
internal ROM to store a program as shown in Fig. 38.
Flow chart
A flow chart is a block diagram representing the structure of the program. The diagram in Fig. 39 shows a
system flow chart example at the initialize and power on.
START When batteries are set or an adapter is plugged in, the CPU
receives power source +5 V then the reset signal.
suspended mode
Fig. 39a
- 19 -
Example: Flow chart of a system containing;
START
CPU (HD6433298) (suspended mode)
DSP (HG51B115FD)
Key controller (HG52E35P) set stack pointer
When pressing the power switch, the CPU initialize system registers
receives the interrupt signal NMI.
(system halt)
clear internal RAM of CPU
initialize DSP
initialize keycontroller
main routine
Fig. 39b
- 20 -
DAC
The resistor network in Fig. 40 is used for a DAC. The output voltage from the network is proportionate to the
place value of the bit (binary count), each successive higher bit applying twice the voltage of the previous bit
as shown in Table 5.
Fig.40 Table 5
The circuits of a DAC consist mainly of two parts: a resistor network for binary input and an op amp as
summing amplifier for the analog output. The diagram in Fig. 41 shows a basic 8-bit DAC. For precise analog
conversion, the bits must be represented by precise voltage, which voltage is called the reference voltage.
R R R R R R R
2R 2R 2R 2R 2R 2R 2R 2R Analog output
2R
Op amp (voltage)
Fig. 42
- 21 -
Key matrix table for a 61-key keyboard
Table 6
A key controller provides a pulse line by line starting from KC0 to KC7, and repeats the sequence at regular
intervals as shown Fig. 43. The pulses are called the “key common signal” or “key scan signal.” Using the key
common signals, the key controller is checking the keyboard at regular intervals to see if a key has been
pressed. When a key is pressed, the key controller checks which key has been pressed according to the key
matrix table. For example, when keys C4, F4 and A4 are pressed, KC0 and KC5 signals flow into KI3 line,
also KC1 signals into KI4. Upon receiving those key input signals, the key controller looks up the key matrix
table, then finds out that keys C4, F4 and A4 has been pressed.
Key common signals
KC0
Key controller KC1
(Internal memory) KC2
Key matrix table KC3
KC4
KC5
KCO ~ KC6
KIO ~
KC7 KC7
KI7
Key input signals
KI0
KI1
Keyboard KI2
(Key matrix) KI3
KI4
KI5
Keys C4, F4 and A4 are pressed. KI6
KI7
- 22 -