Side Menu

PM66串行放音程序示例

2017-5-6 11:04| 发布者: admin| 查看: 887| 评论: 0

摘要: 下载地址:《PM66串行放音程序示例》#include#define uchar unsigned char#define uint unsigned intsbit K1 = P2^7;sbit K2 = P2^6;sbit O1 = P2^5;void delay (int z){uchar x,y;for(x=z;x0;x--)for(y=110;y0;y--) ...
下载地址:《PM66串行放音程序示例


#include
#define uchar unsigned char
#define uint unsigned int
sbit K1 = P2^7;
sbit K2 = P2^6;
sbit O1 = P2^5;
void delay (int z)
{
uchar x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void delay_1 (int c)
{
uchar a;
for(a=c;a>0;a--)
;
}
void sp (uchar k1_data)
{
uchar i;
K1 =0;
delay(50);
K1 = 1;
delay(5);
K2 = 0;
for(i=0;i<8;i++)
{
if((k1_data&0x01)==1)
{
K1 = 1;
}
else
{
K1 = 0;
}
delay_1(50);
K2 = 1;
delay_1(50);
k1_data = k1_data>>1;
K2 = 0;
}
K1 = 1;
K2 = 1;
}
void main (void)
{
uint h;
while(1)
{
for(h =0x00;h<0x0a;h++)   //发送从0x00地址到0x0a地址的声音
{ K1 = 1;
K2 = 1;
sp(h);
delay(20);  
while(O1 == 1);//判断忙信号
delay_1(50);
}
}
}


鲜花

握手

雷人

路过

鸡蛋