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

OKI单片机——ML610Q4XX Melody Driver

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

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

万年历星期算法分析

 1、 蔡勒公式  w=(y+[y/4]+[c/4]-2*c+[26*(m+1)/10]+d-1)%7             &...

Keil  error C272: '__asm' requires src-control to be active 解决办法

Keil error C272: '__asm' requires src-control to be active 解决办法

问题: 在C代码里加入了__asm语句,例如“__asm POP 7”,编译出现Error error C272: '__asm' requires src-control to be active 解决办法: 右键选中该文件----option for file"...

紫外线擦除程序

无意中得知,tenx十速的TM89系列OTP单片机可以用紫外线擦除程序,这下让我们在初期调试程序的时候节省了不少。以前都是用一个demo板,将程序烧到demo板的EEPROM里,来仿真效果。现在就不用这样折腾了,直接烧录进去,觉得程序有bug,就用紫外线擦除程序,重新烧录。 网上搜了搜关于紫外线擦...

Android Studio: This version of the rendering library is more recent than your version of Android Studio

Android Studio: This version of the rendering library is more recent than your version of Android Studio

Android Studio预览xml布局时,提示: This version of the rendering library is more recent than your version of Android Studio. Please update Android Studio 如图所示...

后缀名为.Q的文件为什么用按键精灵无法打开

后缀名为.Q的文件为什么用按键精灵无法打开

问题:.Q文件无法用按键精灵直接打开 解决办法: 将文件放在按键精灵目录 QMScript文件夹里。然后在按键精灵上刷新就有了 以“我的脚本.Q”为例,...

OKI-如何卸载U8Devtool

OKI-如何卸载U8Devtool

有时候,U8Dev出了点问题,需要重新安装来解决。 卸载与安装一样,都是使用安装程序SetupU8Dev。如图所示: 双击后,弹出一个窗口,有Modify,Repair和Remove三个选项,选择Remove即可(如果之前未安装该软件,是没有Remove选项的)。  ...

发表评论

访客

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