Browse Source

添加继电器初始化

master
zhangsan 5 years ago
parent
commit
722bc88bb1
  1. 5
      keilp/cc_as_stc02_gsm_main.uvproj
  2. BIN
      si4/soft_gsm_main.si4project/soft_gsm_main.sip_sym
  3. BIN
      si4/soft_gsm_main.si4project/soft_gsm_main.sip_xm
  4. BIN
      si4/soft_gsm_main.si4project/soft_gsm_main.siwork
  5. 6
      source/app/app_task_485_control.c
  6. 2
      source/app/main.c
  7. 73
      source/bsp/bsp_relay.c

5
keilp/cc_as_stc02_gsm_main.uvproj

@ -491,6 +491,11 @@
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\source\bsp\bsp_gm35.c</FilePath> <FilePath>..\source\bsp\bsp_gm35.c</FilePath>
</File> </File>
<File>
<FileName>bsp_relay.c</FileName>
<FileType>1</FileType>
<FilePath>..\source\bsp\bsp_relay.c</FilePath>
</File>
</Files> </Files>
</Group> </Group>
<Group> <Group>

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_xm

Binary file not shown.

BIN
si4/soft_gsm_main.si4project/soft_gsm_main.siwork

Binary file not shown.

6
source/app/app_task_485_control.c

@ -22,9 +22,9 @@ void L3_task_485_control_handle(TS_485_control *s)
TTSS_Task_step(D_task_485_control_01) TTSS_Task_step(D_task_485_control_01)
if(s->total_weight_pool != G.total_weight) if(s->total_weight_pool != G.total_weight)
{ {
G.thrombolytic_val = G.total_weight / 100 * G.p.thrombolytic_ratio; G.thrombolytic_val = G.total_weight / 10 * G.p.thrombolytic_ratio / 10;
G.bolus_val = G.thrombolytic_val / 10 * G.p.bolus_ratio; G.bolus_val = G.thrombolytic_val * G.p.bolus_ratio / 10;
G.hold_val = G.thrombolytic_val / 10 * G.p.hold_ratio; G.hold_val = G.thrombolytic_val * G.p.hold_ratio / 10;
G.md_slaver_info[2].mask = 1; G.md_slaver_info[2].mask = 1;
s->total_weight_pool = G.total_weight; s->total_weight_pool = G.total_weight;

2
source/app/main.c

@ -53,7 +53,7 @@ stc5ac32s
void L0_main_init(void) void L0_main_init(void)
{ {
//L2_relay_init(); L2_relay_init();
///step : 1>>>>>>>>>引脚选择相关>>>>>>>>> ///step : 1>>>>>>>>>引脚选择相关>>>>>>>>>
L0_pin_config(); L0_pin_config();

73
source/bsp/bsp_relay.c

@ -58,6 +58,7 @@ void _CBC_HANDLER(U8 oper)
} }
} }
#if 0
struct _s_relay_oper s_relay_oper[RELAY_NUM] = struct _s_relay_oper s_relay_oper[RELAY_NUM] =
{ {
//status这里全部为RELAY_BI,如果系统看门狗重启,值会保存在flash_page0,从而读取设定 //status这里全部为RELAY_BI,如果系统看门狗重启,值会保存在flash_page0,从而读取设定
@ -86,8 +87,9 @@ U8 L2_relay_convert_and_do(int i,int val)
} }
return oper; return oper;
} }
#endif
#if 1 #if 0
void L1_relay_on(vU8 n,vU8 val) void L1_relay_on(vU8 n,vU8 val)
{ {
U8 i = 0; U8 i = 0;
@ -114,7 +116,7 @@ void L1_relay_on(vU8 n,vU8 val)
} }
} }
} }
#else //#else
void L1_relay_on(vU8 n,vU8 val) void L1_relay_on(vU8 n,vU8 val)
{ {
U8 i = 0; U8 i = 0;
@ -151,6 +153,7 @@ void L1_relay_on(vU8 n,vU8 val)
} }
#endif #endif
#if 0
void L2_do_relay(U8 *buf) void L2_do_relay(U8 *buf)
{ {
U8 val = buf[0], index = buf[1] ,i = 0; U8 val = buf[0], index = buf[1] ,i = 0;
@ -178,6 +181,41 @@ void L2_do_relay(U8 *buf)
} }
} }
} }
#endif
#if 0
//全关(断开)
void L2_relay_poweroff_all(void)
{
_CBC_HANDLER(RELAY_KAI);
L1_relay_on(RELAY_PC, RELAY_KAI);
L1_relay_on(RELAY_PRINTER, RELAY_KAI);
L1_relay_on(RELAY_PRINTER_1, RELAY_KAI);
}
void L2_relay_poweron_all(void)
{
U8 i = 0;
_CBC_HANDLER(RELAY_BI);
for(i=0;i<RELAY_NUM;i++)
{
if(s_relay_oper[i].relay == RELAY_CBC)
{
continue;
}
else if(s_relay_oper[i].relay == RELAY_PC)
{
//开机,短路2-3s
L1_relay_on(s_relay_oper[i].relay, RELAY_BI);
}
else
{
L1_relay_on(s_relay_oper[i].relay, s_relay_oper[i].relay_initial);
}
}
}
#endif
void L2_relay_init(void) void L2_relay_init(void)
{ {
@ -216,34 +254,3 @@ void L2_relay_init(void)
BITN_0(P6M1,BITN5);BITN_1(P6M0,BITN5); BITN_0(P6M1,BITN5);BITN_1(P6M0,BITN5);
_CBC_HANDLER(RELAY_BI); //闭合 _CBC_HANDLER(RELAY_BI); //闭合
} }
//全关(断开)
void L2_relay_poweroff_all(void)
{
_CBC_HANDLER(RELAY_KAI);
L1_relay_on(RELAY_PC, RELAY_KAI);
L1_relay_on(RELAY_PRINTER, RELAY_KAI);
L1_relay_on(RELAY_PRINTER_1, RELAY_KAI);
}
void L2_relay_poweron_all(void)
{
U8 i = 0;
_CBC_HANDLER(RELAY_BI);
for(i=0;i<RELAY_NUM;i++)
{
if(s_relay_oper[i].relay == RELAY_CBC)
{
continue;
}
else if(s_relay_oper[i].relay == RELAY_PC)
{
//开机,短路2-3s
L1_relay_on(s_relay_oper[i].relay, RELAY_BI);
}
else
{
L1_relay_on(s_relay_oper[i].relay, s_relay_oper[i].relay_initial);
}
}
}
Loading…
Cancel
Save