Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
162
Добавлен:
01.03.2016
Размер:
3.56 Mб
Скачать

RM0016

Beeper (BEEP)

 

 

13.2.2Beeper calibration

This procedure can be used to calibrate the LS 128 kHz clock in order to reach the standard frequency output, 1 kHz, 2 kHz or 4 kHz.

Use the following procedure:

1.Measure the LSI clock frequency (refer to Section 12.3.3: LSI clock frequency measurement above).

2.Calculate the BEEPDIV value as follows, where A and x are the integer and fractional part of fLS/8 (in kHz):

BEEPDIV = A-2 when x is less than or equal to A/(1+2*A), else BEEPDIV = A-1

3.Write the resulting BEEPDIV value in the BEEPDIV[4:0] bits in the Beeper control/status register (BEEP_CSR).

13.3Beeper registers

13.3.1Beeper control/status register (BEEP_CSR)

Address offset: 0x00

Reset value: 0x1F

7

6

5

 

4

3

2

1

0

 

 

 

 

 

 

 

 

BEEPSEL[1:0]

BEEPEN

 

 

 

BEEPDIV[4:0]

 

 

 

 

 

 

 

 

 

 

 

 

rw

rw

 

 

 

rw

 

 

 

 

 

 

 

 

 

 

 

Bits 7:6

BEEPSEL[1:0]: Beep selection

 

 

 

 

 

 

These bits are set and cleared by software to select 1, 2 or 4 kHz beep output when calibration is

 

done.

 

 

 

 

 

 

 

 

00: fLS/(8 x BEEPDIV) kHz output

 

 

 

 

 

 

01: fLS/(4 x BEEPDIV) kHz output

 

 

 

 

 

 

1x: fLS/(2 x BEEPDIV) kHz output

 

 

 

 

 

Bit 5

BEEPEN: Beep enable

 

 

 

 

 

 

This bit is set and cleared by software to enable the beep feature.

 

 

0:Beep disabled

1:Beep enabled

Bits 4:0 BEEPDIV[4:0]: Beep prescaler divider

These bits are set and cleared by software to define the Beeper prescaler dividing factor BEEPDIV.

0x00: BEEPDIV = 2 0x0E: BEEPDIV = 16 0x01: BEEPDIV = 30x0F: BEEPDIV = 17

...0x1E: BEEPDIV = 32

Note: This register must not be kept at its reset value (0x1F)

13.3.2Beeper register map and reset values

Table 27.

Beeper register map

 

 

 

 

 

 

 

Address

Register name

7

6

5

4

3

2

1

0

offset

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0x00

BEEP_CSR

BEEP

BEEP

BEEPE

BEEP

BEEP

BEEP

BEEP

BEEP

SEL20

SEL10

N0

DIV41

DIV31

DIV21

DIV11

DIV01

 

 

 

 

 

 

 

 

 

 

 

 

Doc ID 14587 Rev 9

121/454

Соседние файлы в папке Минимум документации STM8_1