| |
Datasheet Home \ Datasheet Details
Download
PDF Abstract Text:
Using the Buzzer Function on the HT49 MCU Series
Program Example
Using the Buzzer Function on the HT49 MCU Series
Introduction
Program Example
Bzfreq can choose the buzzer output frequency range from clock source / 2 ~clock source / 2
Configuration Options
Hardware
connect the buzzer to pins PA.0 and PA.1 PA0 / 1 choose BZ / BZ output
Using the Buzzer Function on the HT49 MCU Series
Application Circuit
The following table shows the range of buzzer output frequencies with different clock
sources and configuration options
Buzzer Frequency Clock Source / 2 Clock Source / 2 Clock Source / 2 Clock Source / 2 Clock Source / 2 Clock Source / 2 Clock Source / 2 Clock Source / 2
Clock Source WDT (12kHz) 3000.0000Hz 1500.0000Hz 750.0000Hz 375.0000Hz 187.5000Hz 93.7500Hz 46.8750Hz 23.4375Hz RTC (32.768kHz) 8192Hz 4096Hz 2048Hz 1024Hz 512Hz 216Hz 128Hz 64Hz System Clock / 4 1MHz / 4 2MHz / 4 4MHz / 4 125000.000Hz 62500.000Hz 31250.000Hz 15625.000Hz 7812.500Hz 3906.250Hz 1953.125Hz 62500.00000Hz 125000.0000Hz 250000.000Hz 31250.00000Hz 62500.0000Hz 15625.00000Hz 31250.0000Hz 7812.50000Hz 3906.25000Hz 1953.12500Hz 976.56260Hz 488.28125Hz 15625.0000Hz 7812.5000Hz 3906.2500Hz 1953.1250Hz 976.5626Hz
Using the Buzzer Function on the HT49 MCU Series
main .section code org 20h start: set pa.0 set pa.1 call delay call delay clr pa.1 clr pa.0 call delay call delay set pa.0 set pa.1 call delay call delay clr pa.0 call delay call delay jmp start
set the buzzer outputs delay
clear the buzzer output delay set the buzzer outputs
delay clear the pa.0 output delay
------------------------------- delay subprogram delay proc mov a, 0ffh mov count1, a mov count2, a loop1 sdz count1 jmp loop1 sdz count2 jmp loop1 ret delay endp end -------------------------------
· Program Instruction Flow
1. First, the buzzer output is disabled, wait for 1 second. 2. The buzzer will emit a sound with BZ and BZ both active for half a second and then stop for 1 second. 3. The buzzer will again emit a sound, but with a lower volume as only BZ will be active, for half a second and will then return to condition 1.
|