www
.mcu.com.cn
122
/
239
Rev.
1.00
CMS80F731x Reference Manual
16.3 Feature Description
When using a buzzer, you need to configure the corresponding port as a buzzer-driven output. For example, configure the
P16 as a buzzer drive output port, the configuration is as follows:
P16CFG = 0x04; The P16 is configured as a buzzer drive output
By configuring the Related Registers of the buzzer drive module, it is possible to set the different frequencies at which the
buzzer drive outputs. For example:
1)
Set Fsys= 8MHz, BUZCKS < 1:0>=01, and BUZDIV=125
The buzzer drive output frequency is: Fbuz = 8MHz / (2 * 125) / 16 = 2KHz
2)
Set Fsys=16MHz, BUZCKS < 1:0>=11, and BUZDIV=125
The buzzer drive output frequency is: Fbuz = 16MHz / (2 * 125) / 64 = 1KHz
3)
Set Fsys=24MHz, BUZCKS < 1:0>=11, and BUZDIV=94
The buzzer drive output frequency is: Fbuz = 24MHz / (2 * 94) / 64 = 2KHz
Different system clock frequencies and buzzer-driven clock divide ratios can be selected to obtain different output
frequencies. The buzzer drive output frequency is shown in the following table:
BUZCKS<1:0>
Fbuz@Fsys=8MHz
Fbuz@Fsys=16MHz
Fbuz@Fsys=24MHz
Fbuz@Fsys=48MHz
00
2KHz~500KHz
4KHz~1MHz
6KHz~1.5MHz
12KHz~3MHz
01
1KHz~250KHz
2KHz~500KHz
3KHz~750KHz
6KHz~1.5MHz
10
0.5KHz~125KHz
1KHz~250KHz
1.5KHz~375KHz
3KHz~750KHz
11
0.25KHz~62.5KHz
0.5KHz~125KHz
0.75KHz~187.5KHz
1.5KHz~375KHz