15.5
Program Example for Buzzer Output
This section shows an program example for buzzer output.
■
Program Example for Buzzer Output
● Processing specification
Suppose that the buzzer output of 3.052 kHz is output to the BZ pin and then the buzzer output is cut off.
12
If 2
/F
CH
follows:
Buzzer output frequency: 12.5 MHz/2
● Coding example
BZCR
;-------------------Main program-----------------------------------------------------------------
; ----------------------------------------------------------------------------------------------------------
is selected when the oscillation (F
EQU
0018H
CSEG
:
MOV
BZCR,#00000010 ; Buzzer output on (3.052 kHz / Oscillation of 12.5 MHz)
:
:
:
MOV
BZCR,#00000000 ; Buzzer output off (I/O port or PPG output)
:
:
ENDS
END
) is 12.5 MHz, the buzzer output frequency is calculated as
CH
12
= 12.5 MHz/4096 = 3.052 kHz
; Address of the buzzer register
; [CODE SEGMENT]
CHAPTER 15 BUZZER OUTPUT
345