视频地址如下,大家可以先看下效果
https://v.youku.com/v_show/id_XNjM4MzAxMzU1Ng==.html
主要是用了DMG80480C043_01WTC的屏幕,用了智能公元的语音模组 和屏幕用串口4进行连接,通信。 屏幕工程如下:
屏幕的代码如下:
INIT_CPU(); T2_Init(); UART4_Init(); EA=1;
void UART4_Init(void) { //UART4 波特率设置: //BODE2_DIV_H =CPU 主频/(8*波特率) 。 //206438400/8/115200=224=0xe0 //206438400/8/921600=28=0x1C //206438400/8=25804800/230400=112=0x70
SCON2T=0x80; SCON2R=0x80; BODE2_DIV_H=0x00; //FCLK/(8*DIV) BODE2_DIV_L=0xe0;//; 921600 波特率 // BODE2_DIV_H=0x00; //FCLK/(8*DIV) // BODE2_DIV_L=0x70;
//ES3T=1; ES2R=1; EA=1; }
void Process(void) { OneMsHandle(); TenMsHandle(); }
bool uartHandle(u8 *Tdata,u8 len) { unsignedint cmd=0; charvol=0,source=0; charTouchKey[2]={0,0};
cmd=Tdata[2];
switch(cmd) { case1://大厅灯开 TouchKey[1]=1; write_dgusii_vp(0x3003,TouchKey,1); break;
case2://大厅灯关 TouchKey[1]=0; write_dgusii_vp(0x3003,TouchKey,1); break;
case3://厨房灯开 TouchKey[1]=3; write_dgusii_vp(0x3004,TouchKey,1); break;
case4://厨房灯关 TouchKey[1]=0; write_dgusii_vp(0x3004,TouchKey,1); break;
case5://卧室开 TouchKey[1]=5; write_dgusii_vp(0x3005,TouchKey,1); break;
case6://卧室关 TouchKey[1]=0; write_dgusii_vp(0x3005,TouchKey,1); break;
case7://空调开 TouchKey[1]=7; write_dgusii_vp(0x3006,TouchKey,1); break;
case8://空调关 TouchKey[1]=0; write_dgusii_vp(0x3006,TouchKey,1); break;
case9://电视机开 TouchKey[1]=9; write_dgusii_vp(0x3007,TouchKey,1); break;
case10://电视机关 TouchKey[1]=0; write_dgusii_vp(0x3007,TouchKey,1); break;
case11://热水器开 TouchKey[1]=11; write_dgusii_vp(0x3008,TouchKey,1); break;
case12://热水器关 TouchKey[1]=0; write_dgusii_vp(0x3008,TouchKey,1); break;
case13://电风扇开 TouchKey[1]=13; write_dgusii_vp(0x3009,TouchKey,1); break;
case14://电风扇关 TouchKey[1]=0; write_dgusii_vp(0x3009,TouchKey,1); break;
case15://去湿机开 TouchKey[1]=15; write_dgusii_vp(0x300A,TouchKey,1); break;
case16://去湿机关 TouchKey[1]=0; write_dgusii_vp(0x300A,TouchKey,1); break; }
returntrue; }
语音模组设置如下:
如果想了解SDK 自已下载SDK去了解
|