Browse Source

feature:1. 串口接收数据正常 2.语音模块测试完成,播放音频文件正常

master
Zhangwen 4 months ago
parent
commit
2dfddbef29
  1. 4
      .vscode/settings.json
  2. 34
      keilp/cc_as_stc02_ps5ws.uvprojx
  3. 132
      source/app/main.c
  4. 3
      source/bsp/bsp_config.c
  5. 5
      source/bsp/bsp_config.h
  6. 2
      source/bsp/bsp_oid.c
  7. 2
      source/ctask/time.c
  8. 4
      source/msp/UART2.c

4
.vscode/settings.json

@ -17,6 +17,8 @@
"eeprom.h": "c", "eeprom.h": "c",
"uart2.h": "c", "uart2.h": "c",
"clib.h": "c", "clib.h": "c",
"uart0.h": "c" "uart0.h": "c",
"stdio.h": "c",
"uart3.h": "c"
} }
} }

34
keilp/cc_as_stc02_ps5ws.uvprojx

@ -444,34 +444,39 @@
<GroupName>msp</GroupName> <GroupName>msp</GroupName>
<Files> <Files>
<File> <File>
<FileName>time.c</FileName> <FileName>eeprom.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\source\msp\time.c</FilePath> <FilePath>..\source\msp\eeprom.c</FilePath>
</File> </File>
<File> <File>
<FileName>eeprom.c</FileName> <FileName>iic_sim.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\source\msp\eeprom.c</FilePath> <FilePath>..\source\msp\iic_sim.c</FilePath>
</File>
<File>
<FileName>UART0.C</FileName>
<FileType>1</FileType>
<FilePath>..\source\msp\UART0.C</FilePath>
</File> </File>
<File> <File>
<FileName>msp_uart2.C</FileName> <FileName>UART2.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\source\msp\msp_uart2.C</FilePath> <FilePath>..\source\msp\UART2.c</FilePath>
</File> </File>
<File> <File>
<FileName>msp_uart0.C</FileName> <FileName>UART3.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\source\msp\msp_uart0.C</FilePath> <FilePath>..\source\msp\UART3.c</FilePath>
</File> </File>
<File> <File>
<FileName>msp_uart_x.c</FileName> <FileName>UART4.C</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\source\msp\msp_uart_x.c</FilePath> <FilePath>..\source\msp\UART4.C</FilePath>
</File> </File>
<File> <File>
<FileName>msp_uart3.c</FileName> <FileName>UARTX.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\source\msp\msp_uart3.c</FilePath> <FilePath>..\source\msp\UARTX.c</FilePath>
</File> </File>
</Files> </Files>
</Group> </Group>
@ -498,6 +503,11 @@
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\source\ctask\tick.c</FilePath> <FilePath>..\source\ctask\tick.c</FilePath>
</File> </File>
<File>
<FileName>time.c</FileName>
<FileType>1</FileType>
<FilePath>..\source\ctask\time.c</FilePath>
</File>
</Files> </Files>
</Group> </Group>
<Group> <Group>

132
source/app/main.c

@ -1,70 +1,3 @@
//////////////////////////////////////////////////////////////////////////
/// COPYRIGHT NOTICE
/// Copyright (c) 2015, 传控科技
/// All rights reserved.
///
/// @file main.c
/// @brief main app
///
///(本文件实现的功能的详述)
///
/// @version 1.1 CCsens technology
/// @author CC
/// @date 20150102
/// @note
///
/// @version 1.2 CCsens technology
/// @author CC
/// @date 20180903
/// @note cc_gsm_PD03SM_vh03_m10_debug01
//20160413 CC-ACC-VH02
//20170111 CC-ls_02
//
//20170608 cc_as_stc01_main
//
//20180903 cc_gsm_PD03SM_vh03_m10_debug01
//
//
/// @version 1.3 CCsens technology
/// @author CC
/// @date 20180903
/// @note add calibrationg function
/// @version 1.4 CCsens technology
/// @author CC
/// @date 20190101
/// @note add calibrationg function
//////////////////////////////////////////////////////////////////////////
/// 下面是一个含有两个参数的函数的注释说明(简述)
///
/// 这里写该函数的详述信息
/// @param a 被测试的变量(param描述参数)
/// @param s 指向描述测试信息的字符串
/// @return 测试结果(return描述返回值)
/// @see Test() (本函数参考其它的相关的函数,这里作一个链接)
/// @note (note描述需要注意的问题)
/************************************************
stc5ac32s
c200
c200<val<cff
cff 5 线
cam cam
cam
************************************************/
//===============================================
//寄存器头文件
//===============================================
#include "main.h" #include "main.h"
void L0_main_init(void) void L0_main_init(void)
@ -81,8 +14,11 @@ void L0_main_init(void)
L0_uart3_buf_init(); L0_uart3_buf_init();
//Lc_delay_ms(100); //Lc_delay_ms(100);
L1_tick_init(); L1_tick_init();
//P53口初始化为 推挽输出 //P53口初始化为 推挽输出
L0_PW_3V3_INIT(); L0_PW_3V3_INIT();
// 控制3v3输出
L0_PW_3V3_ON();
//开启全局中断 //开启全局中断
EA = 1; EA = 1;
@ -95,7 +31,7 @@ void L0_main_init(void)
#endif #endif
//系统时钟初始化 //系统时钟初始化
L0_timer0_Init(); L0_timer0_Init();
L0_key_init(); // L0_key_init();
//G初始化 //G初始化
L3_param_init(); L3_param_init();
//R初始化 //R初始化
@ -111,7 +47,7 @@ void L0_main_init(void)
//按键任务初始化 //按键任务初始化
// L0_key_init(); // L0_key_init();
//笔头任务初始化 //笔头任务初始化
// L1_oid_init(); L1_oid_init();
//语音模块初始化 //语音模块初始化
// L3_task_speech_init(); // L3_task_speech_init();
//tcp轮询任务初始化 //tcp轮询任务初始化
@ -124,9 +60,14 @@ void L0_main_init(void)
//=============================================== //===============================================
void main(void) void main(void)
{ {
//int i; int i;
U8 code open[9] = {0x7E,0x07,0xA3,0x43,0x30,0x30,0x39,0x86,0xEF}; // U8 code open[9] = {0x7E,0x07,0xA3,0x43,0x30,0x30,0x39,0x86,0xEF};
U8 buletooth[7] = {0x7E,0x05,0xED,0x00,0x00,0xF2,0xEF}; // U8 buletooth[7] = {0x7E,0x05,0xED,0x00,0x00,0xF2,0xEF};
U8 broadcast_first[7] = {0x7E,0x05,0xA2,0x00,0x01,0xA8,0xEF};
U8 broadcast_second[7] = {0x7E,0x05,0xA2,0x00,0x02,0xA9,0xEF};
U8 broadcast_third[7] = {0x7E,0x05,0xA2,0x00,0x03,0xAA,0xEF};
U8 broadcast_fourth[7] = {0x7E,0x05,0xA2,0x00,0x04,0xAB,0xEF};
//初始化 //初始化
L0_main_init(); L0_main_init();
@ -134,44 +75,49 @@ void main(void)
L0_id_get_rom(G.mcu_id); L0_id_get_rom(G.mcu_id);
//打印版本信息 //打印版本信息
L0_uart0_sendArray("v1.0",4); L0_uart0_sendArray("v1.0",4);
L0_uart0_0d0a();
L0_uart0_sendstr("KEY1-TEST"); L0_uart0_sendstr("KEY1-TEST");
Lc_delay_ms(3000); Lc_delay_ms(3000);
L0_uart3_sendArray((U8 *)&open , 9);
// L0_uart3_sendArray((U8 *)&buletooth , 7);
// L0_uart0_sendArray((U8 *)&buletooth , 7);
// 控制wifi_3v3输出 // // 控制3v3输出
L0_PW_3V3_ON(); // L0_PW_3V3_ON();
#if 0
for(i =0;i<100;i++)
{
//Lc_delay_ms(100);
L0_uart3_sendArray((U8 *)&open , 9);
Lc_delay_ms(100);
}
#endif
while(1) while(1)
{ {
L1_Oid_readoid(); L1_Oid_readoid();
if(1 == s_nos_tick.t1s_heartbeat)//1s if(1 == s_nos_tick.t1s_heartbeat)//1s
{ {
s_nos_tick.t1s_heartbeat = 0;//置0清空 s_nos_tick.t1s_heartbeat = 0;//置0清空
D_print_heartbeat() D_print_heartbeat()
{///这个地方可以放置心跳的打印信息 {
///如果其他的打印存在,并且关闭了这个打印的话,这个打印会临时被关闭,下一次打开
L0_uart0_uc('.'); L0_uart0_uc('.');
// L0_uart2_sendArray((U8 *)&buletooth , 7); if(i == 5)
{
i = 0;
L0_uart3_sendArray((U8 *)&broadcast_first , 7);
} }
i++;
} }
}
// 串口2的 接收数据 测试
// if(ts_uart[uNum2].r.ok == 1)
// {
// ts_uart[uNum2].r.ok = 0;
// L0_uart0_sendArray(ts_uart[uNum2].r.buf, D_recv2_max);
// }
// 串口3的 接收数据 测试
if(ts_uart[uNum3].r.ok == 1)
{
ts_uart[uNum3].r.ok = 0;
L0_uart0_uc('@');
// L0_uart0_sendArray(ts_uart[uNum3].r.buf, D_recv3_max);
}
// if(L3_tick_interval(100L))/////10ms // if(L3_tick_interval(100L))/////10ms
// {L2_tick_stamp(); // {L2_tick_stamp();

3
source/bsp/bsp_config.c

@ -46,7 +46,8 @@ void L0_board_config(void)
//BITN_1(P_SW2 ,BITN0);// rxd2 p4.0 txd2 p4.2 //BITN_1(P_SW2 ,BITN0);// rxd2 p4.0 txd2 p4.2
//uart3 //uart3
P_SW2 = 0x00;// RXD3_2/P0.0, TXD3_2/P0.1 // P_SW2 = 0x00;// RXD3 P0.0, TXD3 P0.1
BITN_0(P_SW2 ,BITN1);
//uart4 //uart4
//BITN_1(P_SW2 ,BITN2);// rxd4 p5.2 txd4 p5.3 //BITN_1(P_SW2 ,BITN2);// rxd4 p5.2 txd4 p5.3

5
source/bsp/bsp_config.h

@ -132,12 +132,15 @@
#define D_uart0_BRT BRT_115200 #define D_uart0_BRT BRT_115200
#define D_uart0_SBIT SBIT_1 #define D_uart0_SBIT SBIT_1
#define D_PIN_UART0 PIN_UART0_Rxd_30_Txd_31 #define D_PIN_UART0 PIN_UART0_Rxd_30_Txd_31
#define D_uart2_BRT BRT_115200 #define D_uart2_BRT BRT_115200
#define D_uart2_SBIT SBIT_1 #define D_uart2_SBIT SBIT_1
#define D_PIN_UART2 PIN_UART2_Rxd_10_Txd_11 //wifi模块 #define D_PIN_UART2 PIN_UART2_Rxd_10_Txd_11 //wifi模块
#define D_uart3_BRT BRT_115200 #define D_uart3_BRT BRT_115200
#define D_uart3_SBIT SBIT_1 #define D_uart3_SBIT SBIT_1
#define D_PIN_UART3 PIN_UART3_Rxd_00_Txd_01 //声音模块 #define D_PIN_UART3 PIN_UART3_Rxd_00_Txd_01 //声音模块
#define D_uart4_BRT BRT_115200 #define D_uart4_BRT BRT_115200
//485配置 //485配置
@ -269,7 +272,7 @@
#define D_Cdelay_200us 20 #define D_Cdelay_200us 20
#define D_Cdelay_1us 1 ////while p21翻转时测定 500k 2us 一个指令 #define D_Cdelay_1us 1 ////while p21翻转时测定 500k 2us 一个指令
#define L0_delay_1us() Lc_delay_nop(0) // 5个nop() 100ns 50个nop() 1us (20)=10us (2)1.5us #define L0_delay_1us() Lc_delay_nop(0) // 5个nop() 100ns 50个nop() 1us (20)=10us (2)1.5us
// #define L0_delay_10us() Lc_delay_nop(4) // 5个nop() 100ns 50个nop() 1us (20)=10us (2)1.5us #define L0_delay_10us() Lc_delay_nop(4) // 5个nop() 100ns 50个nop() 1us (20)=10us (2)1.5us
#define L0_delay_40us() Lc_delay_nop(18) // 5个nop() 100ns 50个nop() 1us (20)=10us (2)1.5us #define L0_delay_40us() Lc_delay_nop(18) // 5个nop() 100ns 50个nop() 1us (20)=10us (2)1.5us
//xx //xx
#endif//D_sys_MainFre) #endif//D_sys_MainFre)

2
source/bsp/bsp_oid.c

@ -458,7 +458,7 @@ void L2_oid_ParseF1(void)
///组成,整数部分 14bit,小数部分 8bit ///组成,整数部分 14bit,小数部分 8bit
G.pen_t = 0; G.pen_t = 0;
ts_oid.last_time = s_nos_tick.t_1s; ts_oid.last_time = s_nos_tick.t_1s;
ts_oid.Xint = ts_oid.rec.d16[3]&0x3fff; ts_oid.Xint = ts_oid.rec.d16[3] & 0x3fff;
if(ts_oid.Xint < 300)///取决于图片 fixme: cc if(ts_oid.Xint < 300)///取决于图片 fixme: cc
{ {

2
source/ctask/time.c

@ -40,7 +40,7 @@ void timer0_isrHandle (void) D_SERVE_TIMER0
L1_tick_tick(); ///系统中的1sflag 和以10ms为颗粒的延时使用 为tdelay服务 L1_tick_tick(); ///系统中的1sflag 和以10ms为颗粒的延时使用 为tdelay服务
//串口回调 //串口回调
for(i=0; i< SERIAL_MAX_NUM; i++) for(i = 0; i < SERIAL_MAX_NUM; i++)
{ {
if(ts_uart[i].tp_handler != NULL) if(ts_uart[i].tp_handler != NULL)
{ {

4
source/msp/UART2.c

@ -1,5 +1,5 @@
#include "uart2.h" #include "uart2.h"
//#include "uartx.h" #include "uartx.h"
//TS_Handle_PH3 s_uart2_tcp_rec; //TS_Handle_PH3 s_uart2_tcp_rec;
@ -66,7 +66,7 @@ void INTERRUPT_uart2(void) D_SERVE_uart2 // using 2
} }
if (L0_uart2_IntTI()) //如果是U0发送中断 if (L0_uart2_IntTI()) //如果是U0发送中断
{ {
L0_uart2_IntTIClear(); //清除å�‘é€�ä¸­æ–­æ ‡å ¿— L0_uart2_IntTIClear(); //清除发送中断标� ��
if (ts_uart[uNum2].s.max != ts_uart[uNum2].s.now) if (ts_uart[uNum2].s.max != ts_uart[uNum2].s.now)
{ {
S2BUF = ts_uart[uNum2].s.p[ts_uart[uNum2].s.now]; S2BUF = ts_uart[uNum2].s.p[ts_uart[uNum2].s.now];

Loading…
Cancel
Save