Browse Source

修改串口4接收(未完成)

pingche_yh4
ysw 4 years ago
parent
commit
0222b530d7
  1. BIN
      si4/soft_gsm_main.si4project/soft_gsm_main.sip_sym
  2. BIN
      si4/soft_gsm_main.si4project/soft_gsm_main.sip_xab
  3. BIN
      si4/soft_gsm_main.si4project/soft_gsm_main.sip_xad
  4. BIN
      si4/soft_gsm_main.si4project/soft_gsm_main.sip_xc
  5. BIN
      si4/soft_gsm_main.si4project/soft_gsm_main.sip_xf
  6. BIN
      si4/soft_gsm_main.si4project/soft_gsm_main.sip_xr
  7. BIN
      si4/soft_gsm_main.si4project/soft_gsm_main.sip_xsb
  8. BIN
      si4/soft_gsm_main.si4project/soft_gsm_main.sip_xsd
  9. BIN
      si4/soft_gsm_main.si4project/soft_gsm_main.siproj
  10. BIN
      si4/soft_gsm_main.si4project/soft_gsm_main.siwork
  11. 36
      source/app/app_common.c
  12. 26
      source/app/app_drv.c
  13. 2
      source/app/app_task_485.c
  14. 5
      source/app/app_task_gm35.h
  15. 8
      source/app/app_task_rfid.c
  16. 5
      source/app/app_task_tcp.c
  17. 2
      source/app/app_task_tcp_control.c
  18. 4
      source/app/main.c
  19. 3
      source/bsp/bsp_config.c

BIN
si4/soft_gsm_main.si4project/soft_gsm_main.sip_sym

Binary file not shown.

BIN
si4/soft_gsm_main.si4project/soft_gsm_main.sip_xab

Binary file not shown.

BIN
si4/soft_gsm_main.si4project/soft_gsm_main.sip_xad

Binary file not shown.

BIN
si4/soft_gsm_main.si4project/soft_gsm_main.sip_xc

Binary file not shown.

BIN
si4/soft_gsm_main.si4project/soft_gsm_main.sip_xf

Binary file not shown.

BIN
si4/soft_gsm_main.si4project/soft_gsm_main.sip_xr

Binary file not shown.

BIN
si4/soft_gsm_main.si4project/soft_gsm_main.sip_xsb

Binary file not shown.

BIN
si4/soft_gsm_main.si4project/soft_gsm_main.sip_xsd

Binary file not shown.

BIN
si4/soft_gsm_main.si4project/soft_gsm_main.siproj

Binary file not shown.

BIN
si4/soft_gsm_main.si4project/soft_gsm_main.siwork

Binary file not shown.

36
source/app/app_common.c

@ -15,19 +15,21 @@ U32 code key_rfid_map[KEY_RFID_MAP_SIZE] =
/// key, rfid /// key, rfid
//0x01,1, ///S1 ///key_map[0] key_map[1] //0x01,1, ///S1 ///key_map[0] key_map[1]
//0x02,11, ///S2 ///key_map[n] key_map[n+1] //0x02,11, ///S2 ///key_map[n] key_map[n+1]
0x03,0x01000001, ///呼叫 0x02,0x02000020, ///呼叫 S2
0x04,0x02000001, ///分诊 0x12,0x02000001, ///分诊 S12
0x08,0x01000003, ///一线 0x03,0x03010301, ///一线 S3 医生1
0x09,0x01000004, ///采血 0x03,0x03010302, ///一线 S3 医生2
0x0a,0x01000005, ///心电 0x16,0x02000059, ///采血 S13
0x0B,0x02000003, ///CT 0x04,0x02000025, ///心电 S4
0x0f,0x01000007, ///二线 0x17,0x02000003, ///CT S14
0x10,0x01000008, ///谈话 0x08,0x03020301, ///二线 S5 医生1
0x11,0x01000009, ///签字 0x08,0x03020302, ///二线 S5 医生2
0x12,0x0100000A, ///团注 0x18,0x01000008, ///谈话 S15
0x16,0x02000005, ///介入 0x09,0x01000009, ///签字 S6
0x17,0x0100000C, ///置鞘(穿刺) 0x1D,0x02000060, ///团注 S16
0x18,0x0100000D, ///病房 0x0A,0x02000005, ///介入 S7
0x1F,0x0100000C, ///置鞘(穿刺) S17
0x0B,0x02000023, ///病房 S8
//0x1d,9, ///S16 //0x1d,9, ///S16
//0x1f,10, ///S17 //0x1f,10, ///S17
//0x1e,0 /// 清零按键,无需亮� //0x1e,0 /// 清零按键,无需亮�
@ -64,7 +66,7 @@ void L2_register_init()
{ {
U8 i = 0; U8 i = 0;
G.p.slaverId = 0x10; G.p.slaverId = 0x10;
G.p.wisdom_car_no = 0x92; //第一台车91,第二台车92 G.p.wisdom_car_no = 0x93; //第一台车91,第二台车92
G.p.thrombolytic_ratio = 9; //0.9 G.p.thrombolytic_ratio = 9; //0.9
G.p.bolus_ratio = 1; //0.9 G.p.bolus_ratio = 1; //0.9
G.p.hold_ratio = 9; //0.1 G.p.hold_ratio = 9; //0.1
@ -76,9 +78,9 @@ void L2_register_init()
G.asga.xaxis = G.asga.yaxis = G.asga.zaxis = 0; G.asga.xaxis = G.asga.yaxis = G.asga.zaxis = 0;
G.rfidval = G.rfidHospitalNo = 0; G.rfidval = G.rfidHospitalNo = 0;
for(i=0;i<4;i++) for(i=0;i<6;i++)
{ {
G.weight[i] = 0; G.rfid[i] = 0;
} }
for(i=0;i<MD_SLAVER_INFO_MAX;i++) for(i=0;i<MD_SLAVER_INFO_MAX;i++)
@ -162,7 +164,7 @@ void L2_register_init()
G.ccmd_slaver_info[3].slaver = SLAVER_TCP_SERVER_ID; //�务� G.ccmd_slaver_info[3].slaver = SLAVER_TCP_SERVER_ID; //�务�
G.ccmd_slaver_info[3].oper = MODBUS_OPER_WRITE_M; G.ccmd_slaver_info[3].oper = MODBUS_OPER_WRITE_M;
G.ccmd_slaver_info[3].reg = 0x10; G.ccmd_slaver_info[3].reg = 0x10;
G.ccmd_slaver_info[3].regnum = 0x13; G.ccmd_slaver_info[3].regnum = 0x0B;
G.ccmd_slaver_info[3].bytes = G.ccmd_slaver_info[3].regnum * 2; G.ccmd_slaver_info[3].bytes = G.ccmd_slaver_info[3].regnum * 2;
G.ccmd_slaver_info[3].buf = (U8*)&G.jing_weight; G.ccmd_slaver_info[3].buf = (U8*)&G.jing_weight;
G.ccmd_slaver_info[3].mask = 0; G.ccmd_slaver_info[3].mask = 0;

26
source/app/app_drv.c

@ -45,7 +45,7 @@ void L3_task_a9_rcv_handle(TS_Handle_PH3 *p)
L3_protocol_handler_uart0_fun(&ccmodbus,1); L3_protocol_handler_uart0_fun(&ccmodbus,1);
} }
} }
#endif
U8 array[D_s_SSTR_0D0A_len+1]; U8 array[D_s_SSTR_0D0A_len+1];
@ -69,6 +69,30 @@ void L3_UARTcom4_exp_protocol(TS_Handle_0d0a *p)
#endif #endif
} }
} }
#endif
void L3_UARTcom4_exp_protocol(TS_Handle_PH3 *p)
{
if (1 == p->ok ) //收到消息
{
if(L3_checkCrc16(&p->ts_ccmodbus)) //CRC校验
{
if(p->ts_ccmodbus.slaver == G.p.wisdom_car_no ) //平车ID
{
switch(p->ts_ccmodbus.oper) //操作码0x10
case MODBUS_OPER_WRITE_M:
L3_protocol_handler_uart4_fun(&p->ts_ccmodbus);
}
}
g_at_send_status.gprs_last_recv_stmp = s_nos_tick.t_1s;
L3_protocol_handler_uart4_fun(p->buf+1);
p->ok = 0;
}
}
//FF FE 05 00 00 28 FC CC 从FF开始校验 //FF FE 05 00 00 28 FC CC 从FF开始校验
int L3_checkCrc16(TS_PH3_ccmodbus *ccmodbus) int L3_checkCrc16(TS_PH3_ccmodbus *ccmodbus)

2
source/app/app_task_485.c

@ -98,7 +98,7 @@ void L3_task_485_handle(TS_485 *s)
//G.rfid = G._keyled; //G.rfid = G._keyled;
U32 rfid = key_rfid_map_out(G._keyled); U32 rfid = key_rfid_map_out(G._keyled);
G.rfid[0] = D_CAR_HOSPITAL_NO >> 8 & 0xFF; G.rfid[0] = D_CAR_HOSPITAL_NO >> 8 & 0xFF;
G.rfid[0] = D_CAR_HOSPITAL_NO >> 0 & 0xFF;; G.rfid[1] = D_CAR_HOSPITAL_NO >> 0 & 0xFF;;
G.rfid[2] = rfid >> 24 & 0xFF; G.rfid[2] = rfid >> 24 & 0xFF;
G.rfid[3] = rfid >> 16 & 0xFF; G.rfid[3] = rfid >> 16 & 0xFF;
G.rfid[4] = rfid >> 8 & 0xFF; G.rfid[4] = rfid >> 8 & 0xFF;

5
source/app/app_task_gm35.h

@ -24,9 +24,8 @@
#define AT_INS_CCID "AT+CCID\r\n" //SIM卡查询指令 #define AT_INS_CCID "AT+CCID\r\n" //SIM卡查询指令
#define AT_INS_CREG "AT+CREG?\r\n" //网络查询指令 #define AT_INS_CREG "AT+CREG?\r\n" //网络查询指令
#define AT_INS_GPRS "AT+CGATT=1;+CGDCONT=1,\"IP\",\"CMNET\";+CGACT=1,1\r\n" //GPRS操作指令 #define AT_INS_GPRS "AT+CGATT=1;+CGDCONT=1,\"IP\",\"CMNET\";+CGACT=1,1\r\n" //GPRS操作指令
#define AT_INS_CIPSTART "AT+CIPSTART=\"TCP\",\"www.tall.wiki\",8195\r\n" //#define AT_INS_CIPSTART "AT+CIPSTART=\"TCP\",\"www.tall.wiki\",8195\r\n"
//#define AT_INS_CIPSTART "AT+CIPSTART=\"TCP\",\"weizezhao.imwork.net\",49809\r\n" //连接服务器 #define AT_INS_CIPSTART "AT+CIPSTART=\"TCP\",\"test.tall.wiki\",38195\r\n" //连接服务器
//#define AT_INS_CIPSTART "AT+CIPSTART=\"TCP\",\"test.tall.wiki\",49000\r\n" //连接服务器
#define AT_INS_CIPSEND "AT+CIPSEND\r\n" //发送数据 #define AT_INS_CIPSEND "AT+CIPSEND\r\n" //发送数据
#define AT_INS_CLOSED "AT+CIPCLOSE\r\n" //主动关闭连接 #define AT_INS_CLOSED "AT+CIPCLOSE\r\n" //主动关闭连接
#define AT_INS_CIPSTATUS "AT+CIPSTATUS\r\n" //查询连接状态 #define AT_INS_CIPSTATUS "AT+CIPSTATUS\r\n" //查询连接状态

8
source/app/app_task_rfid.c

@ -14,8 +14,8 @@ void L3_task_rfid_init(void)
U8 rfid_start_pkg[] = {0xBB,0x00,0x27,0x00,0x03,0x22,0xFF,0xFF,0x4A,0x7E}; U8 rfid_start_pkg[] = {0xBB,0x00,0x27,0x00,0x03,0x22,0xFF,0xFF,0x4A,0x7E};
U8 rfid_stop_pkg[] = {0xBB,0x00,0x28,0x00,0x00,0x28,0x7E}; U8 rfid_stop_pkg[] = {0xBB,0x00,0x28,0x00,0x00,0x28,0x7E};
U8 newrfid_start_pkg[] = {0xA0,0x0D,0x01,0x8A,0x00,0x32,0x01,0x32,0x02,0x32,0x03,0x32,0x00,0xFA,0x00}; //U8 newrfid_start_pkg[] = {0xA0,0x0D,0x01,0x8A,0x00,0x32,0x01,0x32,0x02,0x32,0x03,0x32,0x00,0xFA,0x00};
U8 newrfid_stop_pkg[] = {0xA0,0x04,0x01,0x74,0x00,0xE7}; //U8 newrfid_stop_pkg[] = {0xA0,0x04,0x01,0x74,0x00,0xE7};
void L1_enable_rfid() void L1_enable_rfid()
@ -23,7 +23,7 @@ void L1_enable_rfid()
//L0_uart0_sendArray(rfid_start_pkg,10); //L0_uart0_sendArray(rfid_start_pkg,10);
//L0_uart3_sendArray(rfid_start_pkg,10); //L0_uart3_sendArray(rfid_start_pkg,10);
//L0_uart0_sendArray(newrfid_start_pkg,15); //L0_uart0_sendArray(newrfid_start_pkg,15);
L0_uart3_sendArray(newrfid_start_pkg,15); L0_uart3_sendArray(rfid_start_pkg,15);
} }
void L1_disable_rfid() void L1_disable_rfid()
@ -31,7 +31,7 @@ void L1_disable_rfid()
//L0_uart0_sendArray(rfid_stop_pkg,7); //L0_uart0_sendArray(rfid_stop_pkg,7);
//L0_uart3_sendArray(rfid_stop_pkg,7); //L0_uart3_sendArray(rfid_stop_pkg,7);
//L0_uart0_sendArray(newrfid_stop_pkg,6); //L0_uart0_sendArray(newrfid_stop_pkg,6);
L0_uart3_sendArray(newrfid_stop_pkg,6); L0_uart3_sendArray(rfid_stop_pkg,6);
} }
#define D_task_rfid_send 0x51 #define D_task_rfid_send 0x51

5
source/app/app_task_tcp.c

@ -40,11 +40,14 @@ void L3_task_tcp_handle(TS_tcp *s)
} }
else else
{ {
P55 = 0;
L2_task_go(D_task_tcp_switch_next_slaver); L2_task_go(D_task_tcp_switch_next_slaver);
} }
TTSS_Task_step(D_task_tcp_send_modbus_pkg) //发送包 TTSS_Task_step(D_task_tcp_send_modbus_pkg) //发送包
L3_gm35_send_data((U8*)&s->loopPkg,s->pkglen); //L3_gm35_send_data((U8*)&s->loopPkg,s->pkglen);
L0_uart4_sendArray((U8*)&s->loopPkg, s->pkglen);
L0_uart0_sendArray((U8*)&s->loopPkg, s->pkglen);
s->sendStamp = s_nos_tick.t_1s; s->sendStamp = s_nos_tick.t_1s;
if(G.ccmd_slaver_info[s->slaverIndex].mask == 1) if(G.ccmd_slaver_info[s->slaverIndex].mask == 1)
{ {

2
source/app/app_task_tcp_control.c

@ -32,7 +32,7 @@ void L3_task_tcp_control_handle(TS_tcp_control *s)
L2_task_go(D_task_tcp_control_02); L2_task_go(D_task_tcp_control_02);
TTSS_Task_step(D_task_tcp_control_02) TTSS_Task_step(D_task_tcp_control_02)
if(g_at_send_status.conn_ok) if(/*g_at_send_status.conn_ok*/1)
{ {
//3s一次发送数据包 //3s一次发送数据包
if(s_nos_tick.t_1s - ts_tcp_control.tcp_send_stmp >= 3) if(s_nos_tick.t_1s - ts_tcp_control.tcp_send_stmp >= 3)

4
source/app/main.c

@ -125,7 +125,7 @@ void main(void)
//----------------------------------------------- //-----------------------------------------------
//系统主循环 //系统主循环
//----------------------------------------------- //-----------------------------------------------
P55 = 1;
while(9) while(9)
{ {
if(1 == s_nos_tick.t1s_heatbeart) if(1 == s_nos_tick.t1s_heatbeart)
@ -160,7 +160,7 @@ void main(void)
L3_UARTcom3_exp_protocol(&s_uart3_rec); L3_UARTcom3_exp_protocol(&s_uart3_rec);
//gm35维持连接 //gm35维持连接
L3_task_gm35_core_handle(); //L3_task_gm35_core_handle();
//解析串口4协议(gsm模块收到的at响应消息+服务器发送消息) //解析串口4协议(gsm模块收到的at响应消息+服务器发送消息)
L3_UARTcom4_exp_protocol(&s_uart4_at_rec); L3_UARTcom4_exp_protocol(&s_uart4_at_rec);

3
source/bsp/bsp_config.c

@ -230,7 +230,7 @@ void L1_s2b_gm35(unsigned char sbufreg)
{ {
s_uart4_tcp_rec.reg = sbufreg; s_uart4_tcp_rec.reg = sbufreg;
L1_s2b_PH3(&s_uart4_tcp_rec); L1_s2b_PH3(&s_uart4_tcp_rec);
#if 0
if(0 == s_uart4_tcp_rec.head) if(0 == s_uart4_tcp_rec.head)
{ {
s_uart4_at_rec.reg = sbufreg; s_uart4_at_rec.reg = sbufreg;
@ -240,6 +240,7 @@ void L1_s2b_gm35(unsigned char sbufreg)
{ {
s_uart4_at_rec.head = 0; s_uart4_at_rec.head = 0;
} }
#endif
} }
void L1_uart_tpc_config(void) void L1_uart_tpc_config(void)

Loading…
Cancel
Save