OKI单片机——ML610Q4XX Melody Driver

0

本文作者:xjtudll  发布于:2017-8-30  分类:技术心得  点击:


clip_image002

配置流程:

(1) Select a buzzer mode by setting the BZMD bit of the melody 0 control register (MD0CON) to “1”.

(MD0CON寄存器的BZMD位置一)。

(2) Select a buzzer output mode using the melody 0 tempo code register (MD0TMP).

(设置旋律节奏编码寄存器MD0TMP)。

(3) Select a duty of the High level width of the buzzer output waveform using the melody 0 tone length code register(MD0LEN).

(设置Buzzer高电平宽度和波形长度寄存器MD0LEN)。

(4) Set the buzzer output frequency in the melody 0 scale code register (MD0TON).

(设置波形输出频率寄存器MD0TON)。

(5)Set bit 2 (ENMLT) of the frequency control register 1(FCON1) to “1” to enable the low-speed double clock.

(频率控制寄存器1FCON1的ENMLT位置1,使能低速时钟(32K×2))。

(6) When the M0RUN bit of the melody 0 control register (MD0CON) is set to “1”, the waveform equivalent to the buzzer sound that is set from the MD0 pin is output.

(旋律控制寄存器MD0CON的M0RUN位置1,波形通过MD0脚输出)。

/***********************************************/

* @brief 输出4K频率的方波

* @details

/***********************************************/

void Buzzer_Mode(void)

{

//--配置P50--//

P50DIR = 0;//P50 pin: Output (initial value)

P50C0 = 1;//P50 pin: In CMOS output mode

P50MD1 = 0;//Melody 0 output

P50MD0 = 1;

BZMD = 1;//Buzzer mode

MD0TMP = 0X03;//Continuous sound output;连续输出

MD0LEN = 8; // 8/16 Duty

MD0TON = 0X00; // 4.096 kHz (initial value)

ENMLT = 1; // 32.767K X 2

M0RUN = 1;//Starts MD0 output.

}

本文标签: OKI  单片机  
本文Url: http://www.xjtudll.cn/Exp/468/ (出自: 鸟的天空)
我要引用: 点击这里获取该日志的TrackBack引用地址

相关文章:

467. OKI单片机——ML610Q4XX系统时钟切换  (2017-8-23 12:36:50)

462. MOS-N 场效应管 双向电平转换电路 -- 适用于低频信号电平转换的简单应用  (2017-7-15 9:55:6)

456. 电路板上的“黑疙瘩”,里面究竟有什么?  (2017-5-31 19:27:30)

453. OKI编译器 Fatal ERR F025 解决  (2017-5-1 16:34:5)

430. USB转串口 漏电给MCU,如何处理  (2016-12-18 15:9:28)

353. ML610Q4xx LCD Simulate仿真  (2015-3-19 12:12:30)

352. OKI-如何卸载U8Devtool  (2015-3-17 14:7:52)

351. CC2541功耗测试结果  (2015-2-17 9:56:25)

285. 多字节乘法--汇编实现原理  (2013-9-30 14:59:30)

283. 二进制逆序(字节反转)  (2013-9-23 16:22:37)

0 Comments

Write a comment ?