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

OKI单片机——ML610Q4XX Melody Driver

xjtudll9年前 (2017-08-30)技术心得9660

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” 的相关文章

Android MultiSelectListPreference, java.lang.String cannot be cast to java.util.Set

问题及现象: 尝试添加一个 MultiSelectListPreference到设置界面,MultiSelectListPreference基本代码如下: <MultiSelectListPreference android:title="@string/title" an...

穆斯林朝拜方向计算Qibla Direction

穆斯林朝拜方向计算Qibla Direction

穆斯林礼拜都是朝向麦加的“克尔白”(Kaaba)。在中国,大家都知道是向西。但是,很多人并不清楚到底是向“正”西,还是向朝西的某个角度。精确的方向该如何计算?这个问题就等同于:已知两地(其中一地是麦加)的经度,纬度,如何求方位角。学术的讲法就是大地主题...

安卓弹出Dialog之后,点触摸屏幕任意区域,Dialog消失了的解决方法

参考资料: http://blog.csdn.net/liushuiwen101423/article/details/46412487 http://blog.csdn.net/u012255016/article/details/49888881 http://blog.csdn.net/jds...

黑群晖:certificate has expired or is not yet valid

https://blog.csdn.net/weixin_54655073/article/details/138663733 sudo -imv /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt.baksud...

Windows10 安装软件时提示 the error code is 2503/2502 错误解决办法

Windows10 安装软件时提示 the error code is 2503/2502 错误解决办法

问题内容:Windows10 安装软件时提示“ the error code is 2503/2502”错误代码分析原因:由于安装.msi格式的软件时,无法使用管理员身份运行,导致权限不够,从而引起2503/2502代码的错误解决方法:设置 C:\WINDOWS\TEMP的权限1、依次打开“ 我的电...

浅析电波表——美国WWVB码

浅析电波表——美国WWVB码

参考文献: http://www.nist.gov/pml/div688/grp40/wwvb.cfm http://tf.nist.gov/stations/wwvbtimecode.htm http://en.wikipedia.org/wiki/WWVB 一、WWVB码简介 WWVB与WWV...

发表评论

访客

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