SN8P2740 Series
ADC, OP-amp, Comparator 8-Bit Micro-Controller
SONiX TECHNOLOGY CO., LTD
Page 107
Version 2.0
1
1
1
2
2
2
2K/4K BUZZER GENERATOR
12.1 OVERVIEW
The MCU builds in Buzzer generator to drive external buzzer device. The buzzer generator purpose is to drive 2KHz or
4KHz buzzer. Adjusting buzzer output frequency is through BZM register. The buzzer output pin is shared with GPIO.
When BZEN = 1, the pin outputs buzzer carry signal. When BZEN = 0, the pin returns to GPIO last condition (input
mode, output high or output low status).
Fcpu
BZrate [1:0]
Fcpu/256
Fcpu/512
Fcpu/1024
Fcpu/2048
BZEN
GPIO
Pin
The buzzer frequency is divided from Fcpu (instruction cycle) controlled by BZrate bits, and Fcpu decides the buzzer
frequency. The selection table is as following.
BZrate [1:0]
Buzzer Rate
Division
Buzzer Rate
Fcpu = 1MHz
Fcpu = 2MHz
Fcpu = 4MHz
00
Fcpu/256
4KHz
8KHz
16KHz
01
Fcpu/512
2KHz
4KHz
8KHz
10
Fcpu/1024
1KHz
2KHz
4KHz
11
Fcpu/2048
0.5KHz
1KHz
2KHz
The buzzer target frequency is 2KHz and 4KHz. It is important to choice a good Fcpu rate to obtain the correct buzzer
frequency. The above table shows 2KHz/4KHz buzzer frequency configurations.
12.2 BZM REGISTER
0DCH
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
BZM
BZEN
BZrate1
BZrate0
-
-
-
-
-
Read/Write
R/W
R/W
R/W
-
-
-
-
-
After reset
0
0
0
-
-
-
-
-
Bit 7
BZEN:
Buzzer output control bit.
0 = Disable BZ output and BZ output pin transfers to I/O last status.
1 = Enable BZ output and disable GPIO function.
Bit[6:5]
BZrate[1:0]:
Buzzer rate control bits.
00 = Fcpu/256
01 = Fcpu/512
10 = Fcpu/1024
11 = Fcpu/2048
Note:
1. If BZEN=0, the buzzer output pin is GPIO mode and returns to last status after disabling buzzer
output.
2. If BZEN=1, the buzzer output pin is buzzer output function and isolates the GPIO function.