当前位置:首页 > 技术心得 > 正文内容

OKI单片机——ML610Q4XX Melody Driver

xjtudll8年前 (2017-08-30)技术心得3800

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.

}

扫描二维码推送至手机访问。

版权声明:本文由鸟的天空发布,如需转载请注明出处。

本文链接:http://xjtudll.cn/Exp/468/

标签: OKI单片机
分享给朋友:

“OKI单片机——ML610Q4XX Melody Driver” 的相关文章

带锁存移位寄存器(verilog)

带锁存移位寄存器(verilog)

带锁存的移位寄存器 rclk——锁存时钟 sclk——移位时钟 din——输入数据 dout——输出数据 [shiftBitNumbers——移位寄存器位数 module shi...

Android手机Google服务耗电过多

手机:三星I9000 操作系统:Android 2.3.3 (Lida ROM) 现象:电池使用时间很短,经常莫名其妙就没电了。查看电量消耗,60%(甚至更多)为“Google框架服务”占用。 病因: 通过网络搜索,发现是因为曾经禁止了“Google框架服务&rd...

Keil单工程多Target的配置方法

Keil单工程多Target的配置方法

实现功能: 通过切换target实现不同的编译设置,而无需建立多个工程 需求背景: 调试一些算法,想使用STM32F107VCT6,但是发现STM32F107不能仿真,只有STM32F103可以仿真。 由于没有STM32F107VCT6实物,所以初期只能使用STM32F103仿真了。 STM32F1...

sqlserver查询数据的所有表名和行数

https://www.cnblogs.com/luxj/p/9227385.html //查询所有表名select name from sysobjects where xtype='u' select * from sys.tables //查询数据库中所有的表名及行数 SELECT a....

大胆假设,小心求证

今天,捣鼓利尔达心电DEMO仪,主要是为了验证自己写的心率处理程序是否正确。结果,怎么捣鼓电压都不正常。用锂电池通过一个3V的LDO给系统供电。供电前,测试LDO输出电压正常,3.04V,结果一接上电路板,电压立马被拉至2V,有时甚至1.5V。从现象来看,首先怀疑的是DEMO板存在短路现象,电流过大...

NSButton——设定背景图片Scale

NSButton——设定背景图片Scale

参考资料: http://stackoverflow.com/questions/5851923/how-to-scale-axes-independently-at-runtime-on-an-nsbutton 代码方式: NSButton *someButton; NSButtonCell...

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。