标题:
单片机电子贺卡源程序(红外+串口屏+MP3)
[打印本页]
作者:
绝版
时间:
2019-11-6 19:20
标题:
单片机电子贺卡源程序(红外+串口屏+MP3)
#include "stc12c5a60s2.H"
#include "hongwai.h"
#include "him.h"
#include "speek.h"
extern unsigned char irtime;//红外用全局变量
extern unsigned char IRcord[4];
extern unsigned char irdata[33];
extern bit irpro_ok,irok;
extern bit fasong;
extern uchar receive[35];
extern unsigned char jm;
extern unsigned char TF_MP3_2[] = {"E:\\1-歌曲\\缘分一道桥.mp3"};//泡沫
extern unsigned char TF_MP3_3[] = {"E:\\1-歌曲\\泡沫.mp3"}; //攀登
extern unsigned char TF_MP3_1[] = {"E:\\1-歌曲\\攀登.mp3"}; //缘分
void Delay1000ms() //@11.0592MHz 延时1s
{
unsigned char i, j, k;
i = 43;
j = 6;
k = 203;
do
{
do
{
while (--k);
} while (--j);
} while (--i);
}
void main()
{
EA = 1;
EX0init();
TIM0init();
init();
while(1)//主循环
{
// if(receive[2] == 0x02) //第一首
// {
// Delay1000ms();
// UartInit();
// SYN_VOL_Control(0x01);
// Delay1000ms();
// SYN_MP3(TF_MP3_3);
// Delay1000ms();
// Delay1000ms();
// Delay1000ms();
// Delay1000ms();
// receive[2] = 0x00;
// }
// if(receive[2] == 0x06) // 第二首
// {
// Delay1000ms();
// UartInit();
// SYN_VOL_Control(0x01);
// Delay1000ms();
// SYN_MP3(TF_MP3_2);
// Delay1000ms();
// Delay1000ms();
// Delay1000ms();
// Delay1000ms();
// receive[2] = 0x00;
// }
// if(receive[2] == 0x04) // 第三首
// {
// Delay1000ms();
// UartInit();
// SYN_VOL_Control(0x01);
// Delay1000ms();
// SYN_MP3(TF_MP3_1);
// Delay1000ms();
// Delay1000ms();
// Delay1000ms();
// Delay1000ms();
// receive[2] = 0x00;
// }
// if(receive[2] == 0x03) //暂停
// {
// Delay1000ms();
// UartInit();
// SYN_VOL_Control(0x01);
// Delay1000ms();
// SYN_TTS("已暂停");
// Delay1000ms();
// Delay1000ms();
// Delay1000ms();
// Delay1000ms();
// receive[2] = 0x00;
// }
if(irok) //如果接收好了进行红外处理
{
Ircordpro();
irok=0;
}
if(irpro_ok) //如果处理好后进行工作处理,如按对应的按键后显示对应的数字等
{
Ir_work();
}
if((jm == 0x0C) || (receive[2] == 0x02)) //1
{
send_string("page 1"); //第一首
UART_Send_END();
Delay1000ms();
UartInit();
SYN_VOL_Control(0x01);
Delay1000ms();
SYN_MP3(TF_MP3_3);
Delay1000ms();
Delay1000ms();
Delay1000ms();
Delay1000ms();
receive[2] = 0x00;
jm = 0;
}
if((jm == 0x18) || (receive[2] == 0x06) ) //2
{
send_string("page 4"); //第2
UART_Send_END();
Delay1000ms();
UartInit();
SYN_VOL_Control(0x01);
Delay1000ms();
SYN_MP3(TF_MP3_2);
Delay1000ms();
Delay1000ms();
Delay1000ms();
Delay1000ms();
receive[2] = 0x00;
jm = 0;
}
if((jm == 0x5E) || (receive[2] == 0x04)) //3
{
send_string("page 2"); //第三首
UART_Send_END();
Delay1000ms();
UartInit();
SYN_VOL_Control(0x01);
Delay1000ms();
SYN_MP3(TF_MP3_1);
Delay1000ms();
Delay1000ms();
Delay1000ms();
Delay1000ms();
receive[2] = 0x00;
jm = 0;
}
if(jm == 0x09) //EQ
{
send_string("page 0"); //返回主页面
UART_Send_END();
jm = 0;
}
if(jm == 0x44) //<< 录音
{
send_string("page 5");
// Delay1000ms();
// UartInit();
// SYN_VOL_Control(0x01);
// Delay1000ms();
// SYN_MP3(TF_MP3_2);
// Delay1000ms();
// Delay1000ms();
// Delay1000ms();
// Delay1000ms();
UART_Send_END();
jm = 0;
}
if((jm == 0x43) || (receive[2] == 0x03)) //停
{
send_string("page 3"); //
UART_Send_END();
Delay1000ms();
UartInit();
SYN_VOL_Control(0x01);
Delay1000ms();
SYN_TTS("已暂停");
Delay1000ms();
Delay1000ms();
Delay1000ms();
Delay1000ms();
receive[2] = 0x00;
jm = 0;
}
if(jm == 0x40) // >> 播音
{
send_string("page 6"); //
UART_Send_END();
jm = 0;
}
}
}
复制代码
电子贺卡.zip
2019-11-6 19:20 上传
点击文件名下载附件
下载积分: 黑币 -5
53.29 KB, 下载次数: 17, 下载积分: 黑币 -5
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1