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

OKI单片机——ML610Q4XX Melody Driver

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

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

IIS+PHP环境下文件上传没法访问问题

PHP运行环境:IIS FastCGI 在IIS FastCGI方式运行时,经过浏览器请求的Web资源有2类,一个是经由php_cgi.exe产生的内容,一部分是静态资源,由IIS返回给用户。 这2类用户有区别,前者是IIS_IUSERS,后者是Authenticated User或者是Anonym...

QQ for Mac老提示密码错误

这段时间,一直在折腾黑苹果,好不容易将黑苹果装的差不多了,下了个QQ for Mac,安装什么的都很顺利,但是就是死活登陆不上。 1、检查过大小写,确认过密码,没错。在Windows下可以使用;在Mac系统中,Web QQ也可使用。 2、采用复制粘贴的方法将密码粘贴到密码框,依旧提示密码错误。...

12点是AM还是PM

12点是AM还是PM

中午12点是AM还是PM,有很多人会搞混。有说是AM的,也有说是PM的。 先说说AM和PM的含义吧 AM:ante meridiem(来自拉丁文) PM:post meridiem(来自拉丁文) 那么12点究竟是AM还是PM呢?一般习惯说中午十二点为12 PM, 深夜十二点为12 AM,正式用法是&...

固定电容标称容量及误差

电容器上标有的电容数是电容器的标称容量。电容器的标称容量和它的实际容量会有误差。常用固定电容允许误差的等级见表1。 表1 固定电容允许误差等级 误差 ±2%...

Eclipse导入Android工程,出现default与Displaying的问题解决

Eclipse导入android工程时出现如下提示: [15:04:03 - XXX] 'default' is not a best match for any device/locale combination.  [ 15:04:03 - XXX] Displaying it wi...

c# winform 查看网络图片

引用网址:https://blog.csdn.net/weixin_30462049/article/details/99170485 /// <summary>         /// ...

发表评论

访客

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