
ML610Q421/ML610Q422/ML610421 User’s Manual
Chapter 23 Melody Driver
23 – 7
23.3 Description of Operation
23.3.1 Operation of Melody Output
Melody is output in the following procedure.
(1) Select melody mode by setting the BZMD bit of the melody 0 control register (MD0CON) to “0”.
(2) Set a melody tempo in the melody 0 tempo code register (MD0TMP).
(3) Set a tone length code in the melody 0 tone length code register (MD0LEN).
(4) Set a scale code in the melody 0 scale code register (MD0TON).
(5) Set bit 2 (ENMLT) of the frequency control register 1(FCON1) to “1” to enable the 2
×
low-speed clock.
(6) When the M0RUN bit of the melody 0 control register (MD0CON) is set to “1”, the tone length code and scale
code are transferred to the tone length buffer and scale buffer and melody output is started from the MD0 pin. At
the same time, a melody 0 interrupt (MD0INT) is requested. When an interrupt occurs and program is passed to the
interrupt routine, the interrupt request flag is cleared.
The melody 0 signal output pin (MD0) is assigned as the secondary function of Port 2. See Chapter 19, “Port 2,” for
the secondary function settings of Port 2.
In the software processing after melody 0 interrupt, the tone length code and the scale code of the note that are output
next are set to MD0LEN and MD0TON, respectively. When there is no next note to be output, rest data “00H” is set in
MD0TON, the M0RUN bit is set to “0” by the software processing after the next melody 0 interrupt, and melody output
is terminated.
By setting the M0RUN bit to “0”, melody can be terminated forcibly during melody output.
In the case the melody is forcibly terminated, meldy circuit must be reset once by setting DMD0 bit of BLKCON3
register to “1”. Then if you want continue to use the melody function, reset the DMD0 bit to “0” and restart operating
from the aforementioned procedure (1).
Figure 23-2 shows the operation waveform of the melody driver.
Figure 23-2 Operation Waveform of Melody Driver
M0RUN
MD0INT
XX
1st sound
2nd sound
XX
1st sound
waveform
2nd sound
3rd sound
3rd sound
Final sound
Rest data
Final sound
Rest data
MD0LEN
MD0TON
Tone length/Tone buffer
Melody output waveform
MD0*
2nd sound
waveform
3rd sound
waveform
1st sound
Final sound
waveform
Содержание ML610421
Страница 1: ...ML610Q421 ML610Q422 ML610421 User s Manual Issue Date Feb 9 2015 FEUL610Q421 06...
Страница 15: ...Chapter 1 Overview...
Страница 44: ...Chapter 2 CPU and Memory Space...
Страница 49: ...Chapter 3 Reset Function...
Страница 53: ...Chapter 4 MCU Control Function...
Страница 69: ...Chapter 5 Interrupts INTs...
Страница 93: ...Chapter 6 Clock Generation Circuit...
Страница 110: ...Chapter 7 Time Base Counter...
Страница 121: ...Chapter 8 Capture...
Страница 129: ...Chapter 9 1 kHz Timer 1kHzTM...
Страница 135: ...Chapter 10 Timers...
Страница 160: ...Chapter 11 PWM...
Страница 172: ...Chapter 12 Watchdog Timer...
Страница 180: ...Chapter 13 Synchronous Serial Port...
Страница 195: ...Chapter 14 UART...
Страница 216: ...Chapter 15 I2 C Bus Interface...
Страница 231: ...Chapter 16 NMI Pin...
Страница 237: ...Chapter 17 Port 0...
Страница 246: ...Chapter 18 Port 1...
Страница 252: ...Chapter 19 Port 2...
Страница 259: ...Chapter 20 Port 3...
Страница 270: ...Chapter 21 Port 4...
Страница 282: ...Chapter 22 Port A...
Страница 290: ...Chapter 23 Melody Driver...
Страница 304: ...Chapter 24 RC Oscillation Type A D Converter...
Страница 327: ...Chapter 25 Successive Approximation Type A D Converter...
Страница 338: ...Chapter 26 LCD Drivers...
Страница 371: ...Chapter 27 Battery Level Detector...
Страница 378: ...Chapter 28 Power Supply Circuit...
Страница 381: ...Chapter 29 On Chip Debug Function...
Страница 384: ...Appendixes...
Страница 435: ...Revision History...