📄 process.i
字号:
}
if (inlet_10s_buff > 0)
inlet_10s_buff --;
if (inlet_20m_buff > 0)
inlet_20m_buff --;
if (inlet_2m_buff > 0)
{
inlet_2m_buff --;
process_left_time --;
}
if (inlet_20m_buff == 0)
{
output_buff &= (~0x04 );
inlet_20m_buff = 1200 ;
inlet_2m_buff = 120 ;
inlet_10s_buff = 10 ;
process_left_time = inlet_2m_buff;
err_buff = 0x06 ;
return;
}
if (water_level_buff >= 4)
{
if (water_buff >= 3)
{
inlet_2m_buff = 0;
if (water_buff == water_level_buff)
{
operation_flag_5.f_bit.fb0 = 1;
output_buff &= (~0x04 );
if ((j == 120 )||(j == 40))
{
inlet_20m_buff = 1200 ;
inlet_2m_buff = 120 ;
process_left_time = 0;
operation_counter ++;
pass_time_counter ++;
return;
}
else if ((j > 120 )&&(operation_flag_5.f_bit.fb1 == 1))
{
inlet_20m_buff = 1200 ;
inlet_2m_buff = 120 ;
process_left_time = 0;
operation_counter ++;
pass_time_counter ++;
return;
}
}
}
}
if (water_buff == water_level_buff)
{
inlet_2m_buff = 0;
output_buff &= (~0x04 );
operation_flag_5.f_bit.fb0 = 1;
if ((j == 120 )||(j == 40))
{
inlet_20m_buff = 1200 ;
inlet_2m_buff = 120 ;
process_left_time = 0;
operation_counter ++;
pass_time_counter ++;
return;
}
else if ((j > 120 )&&(operation_flag_5.f_bit.fb1 == 1))
{
inlet_20m_buff = 1200 ;
inlet_2m_buff = 120 ;
process_left_time = 0;
operation_counter ++;
pass_time_counter ++;
return;
}
}
return;
}
else if ((level)&&(!inlet_time))
{
if (operation_flag_5.f_bit.fb0 != 1)
{
output_buff |= 0x04 ;
}
if (inlet_20m_buff > 0)
inlet_20m_buff --;
if (inlet_2m_buff > 0)
{
inlet_2m_buff --;
process_left_time --;
}
if (water_buff == water_level_buff)
{
inlet_20m_buff = 1200 ;
inlet_2m_buff = 120 ;
output_buff &= (~0x04 );
operation_flag_5.f_bit.fb0 = 1;
return;
}
else if (inlet_20m_buff <= 0)
{
err_buff = 0x06 ;
inlet_20m_buff = 1200 ;
return;
}
}
else if (cycle)
{
if (operation_flag_1.f_bit.fb2 != 1)
{
cycle_buff = cycle;
operation_flag_1.f_bit.fb2 = 1;
}
i = cycle_buff;
i &= 0x80;
if (i != 0)
{
output_buff |= 0x04 ;
if (inlet_2m_buff > 0)
inlet_2m_buff --;
if ((120 - inlet_2m_buff) == 35)
{
output_buff &= (~0x04 );
inlet_2m_buff = 120 ;
cycle_buff = cycle_buff << 1;
if (cycle_buff == 0)
{
mot_cycle_buff = 0x00 ;
output_buff &= (~0x01 );
output_buff &= (~0x10 );
}
pass_time_counter ++;
}
}
else if (i == 0)
{
if (inlet_2m_buff > 0)
inlet_2m_buff --;
if ((120 - inlet_2m_buff) == 30)
{
inlet_2m_buff = 120 ;
cycle_buff = cycle_buff << 1;
pass_time_counter ++;
if (cycle_buff == 0)
{
{
mot_cycle_buff = 0x00 ;
output_buff &= (~0x01 );
output_buff &= (~0x10 );
process_left_time = 0;
operation_flag_1.f_bit.fb2 = 0;
operation_counter += 8;
pass_time_counter ++;
}
}
}
}
}
else
return;
}
void drain( void )
{
output_buff |= 0x02 ;
if (drain_8m_buff > 0)
drain_8m_buff --;
if (process_left_time == 0)
process_left_time = drain_2m_buff;
if ((drain_2m_buff > 0)&&(operation_flag_5.f_bit.fb2 == 0))
{
drain_2m_buff --;
process_left_time --;
}
if (drain_2m_buff == 0)
{
}
if (water_buff == 0)
{
if (drain_2m_buff < 119)
{
if (drain_60s_buff > 0)
{
drain_60s_buff --;
process_left_time = drain_60s_buff;
}
if (drain_60s_buff == 0)
{
drain_60s_buff = 60 ;
drain_8m_buff = 480 ;
drain_2m_buff = 120 ;
process_left_time = 0;
operation_counter ++;
pass_time_counter ++;
save_water_flag_1.f_bit.fb2 = 0;
return;
}
}
else if (drain_2m_buff == 119)
{
operation_flag_5.f_bit.fb2 = 1;
if (drain_10s_buff > 0)
{
drain_10s_buff --;
}
if (drain_20s_buff > 0)
{
drain_20s_buff --;
process_left_time = drain_20s_buff;
}
if (drain_20s_buff == 0)
{
drain_10s_buff = 10 ;
drain_20s_buff = 20 ;
drain_8m_buff = 480 ;
drain_2m_buff = 120 ;
operation_flag_5.f_bit.fb2 = 0;
process_left_time = 0;
operation_counter ++;
pass_time_counter ++;
save_water_flag_1.f_bit.fb2 = 0;
return;
}
else if (drain_10s_buff == 0)
{
if (machine_type == 0x00 )
{
drain_10s_buff = 10 ;
drain_20s_buff = 20 ;
drain_8m_buff = 480 ;
drain_2m_buff = 120 ;
operation_flag_5.f_bit.fb2 = 0;
process_left_time = 0;
operation_counter ++;
pass_time_counter ++;
save_water_flag_1.f_bit.fb2 = 0;
return;
}
}
}
}
else if (drain_8m_buff == 0)
{
drain_8m_buff = 480 ;
drain_2m_buff = 120 ;
drain_10s_buff = 10 ;
drain_20s_buff = 20 ;
drain_60s_buff = 60 ;
process_left_time = drain_2m_buff;
err_buff = 0x02 ;
return;
}
else
return;
}
void soak(unsigned int soak_time)
{
unsigned char i;
if (operation_flag_5.f_bit.fb0 == 0)
{
i = water_level_buff - water_buff;
if (i >= 1)
{
status_buff = 0x03 ;
process_flag_2.f_bit.fb0 = 1;
if (water_buff != water_level_buff)
{
inlet(0, 0, water_level_buff);
return;
}
}
}
if (lid_open)
{
err_buff = 0x03 ;
return;
}
if (soak_time == 10)
{
if ((process_left_time == 0)&&(soak_2_cycle_buff != 1))
process_left_time = soak_time * 60;
process_left_time --;
if (soak_1_cycle_buff != 1)
soak_1();
if ((soak_2_cycle_buff != 1)&&(soak_1_cycle_buff == 1))
soak_2();
else if (soak_2_cycle_buff == 1)
{
pass_time_counter ++;
operation_counter ++;
process_left_time = 0;
}
return;
}
else if (soak_time == 20)
{
if ((process_left_time == 0)&&(soak_3_cycle_buff != 1))
process_left_time = soak_time * 60;
process_left_time --;
if (soak_1_cycle_buff != 1)
soak_1();
if ((soak_2_cycle_buff != 1)&&(soak_1_cycle_buff == 1))
soak_2();
if ((soak_3_cycle_buff != 1)&&(soak_2_cycle_buff == 1)&&(soak_1_cycle_buff == 1))
soak_3();
else if (soak_3_cycle_buff == 1)
{
pass_time_counter ++;
operation_counter ++;
process_left_time = 0;
}
return;
}
else if (soak_time == 30)
{
if ((process_left_time == 0)&&(soak_3_cycle_buff != 2))
process_left_time = soak_time * 60;
process_left_time --;
if (soak_1_cycle_buff != 1)
soak_1();
if ((soak_2_cycle_buff != 1)&&(soak_1_cycle_buff == 1))
soak_2();
if ((soak_3_cycle_buff != 2)&&(soak_2_cycle_buff == 1)&&(soak_1_cycle_buff == 1))
soak_3();
else if (soak_3_cycle_buff == 2)
{
pass_time_counter ++;
operation_counter ++;
process_left_time = 0;
}
return;
}
else if (soak_time == 40)
{
if ((process_left_time == 0)&&(soak_3_cycle_buff != 3))
process_left_time = soak_time * 60;
process_left_time --;
if (soak_1_cycle_buff != 1)
soak_1();
if ((soak_2_cycle_buff != 1)&&(soak_1_cycle_buff == 1))
soak_2();
if ((soak_3_cycle_buff != 3)&&(soak_2_cycle_buff == 1)&&(soak_1_cycle_buff == 1))
soak_3();
else if (soak_3_cycle_buff == 3)
{
pass_time_counter ++;
operation_counter ++;
process_left_time = 0;
}
return;
}
else
return;
}
void wash(unsigned int wash_time)
{
unsigned char i;
unsigned char j;
if (operation_flag_5.f_bit.fb0 == 0)
{
i = water_level_buff - water_buff;
if (i >= 1)
{
status_buff = 0x03 ;
process_flag_2.f_bit.fb0 = 1;
if (water_buff != water_level_buff)
{
inlet(0, 0, water_level_buff);
return;
}
}
}
if (lid_open)
{
err_buff = 0x03 ;
return;
}
if (operation_flag_4.f_bit.fb1 == 1)
{
;
}
if (wash_start_flag == 0)
{
wash_start_flag = 1;
balance_time_buff = 30;
run_stream_time = wash_time;
process_left_time = wash_time + balance_time_buff;
}
if (wash_start_flag == 1)
{
if (run_stream_time > 0)
{
if ((program_buff >= 3)&&(program_buff <= 6)&&(water_level >= 1))
{
if (main_stream_time > 0)
{
stream_buff = 0x11 ;
main_stream_time --;
}
if (main_stream_time == 0)
{
if (ext_stream_time > 0)
{
stream_buff == 0x41 ;
ext_stream_time --;
}
if (ext_stream_time == 0)
{
main_stream_time = 170;
ext_stream_time = 10;
stream_buff = 0x11 ;
}
}
}
else
stream_buff = 0x11 ;
run_stream_time --;
process_left_time --;
}
if (run_stream_time == 0)
{
stream_buff = 0x31 ;
if (balance_time_buff > 0)
{
balance_time_buff --;
process_left_time --;
}
if (balance_time_buff == 0)
{
balance_time_buff == 30;
wash_start_flag = 0;
stream_buff = 0x80 ;
mot_cycle_buff &= 0x00 ;
output_buff &= (~0x01 );
output_buff &= (~0x10 );
operation_counter += 2;
pass_time_counter += 2;
process_left_time = 0;
return;
}
}
return;
}
return;
}
void interm_spin(unsigned int interm_spin_time)
{
static unsigned char interm_spin_cycle;
if (process_left_time == 0)
process_left_time = interm_spin_time;
if (lid_open)
{
err_buff = 0x03 ;
return;
}
if (operation_flag_5.f_bit.fb3 == 1)
{
if (operation_flag_5.f_bit.fb0 == 0)
{
if (operation_flag_2.f_bit.fb6 == 0)
{
operation_flag_2.f_bit.fb6 = 1;
output_buff |= 0x04 ;
inlet_2m_buff = 120 ;
}
if (inlet_2m_buff >= 0)
inlet_2m_buff --;
if (operation_flag_2.f_bit.fb7 == 1)
{
operation_flag_2.f_bit.fb6 = 0;
operation_flag_2.f_bit.fb7 = 0;
operation_flag_3.f_bit.fb6 = 0;
inlet_2m_buff = 120 ;
drain_2m_buff = 120 ;
spin_balance_time_buff = 60;
operation_flag_5.f_bit.fb3 = 0;
}
}
if (operation_flag_5.f_bit.fb0 == 1)
{
if (operation_flag_2.f_bit.fb7 == 0)
{
operation_flag_2.f_bit.fb7 = 1;
output_buff &= (~0x04 );
stream_buff = 0x31 ;
spin_balance_time_buff = 60;
}
if (spin_balance_time_buff > 0)
{
spin_balance_time_buff --;
}
if (spin_balance_time_buff == 0)
{
stream_buff = 0x80 ;
output_buff &= (~0x01 );
output_buff &= (~0x10 );
if (operation_flag_5.f_bit.fb0 != 0)
{
if (operation_flag_3.f_bit.fb6 == 0)
{
operation_flag_3.f_bit.fb6 = 1;
drain_2m_buff = 120 ;
output_buff |= 0x02 ;
}
if(drain_2m_buff >= 0)
drain_2m_buff --;
}
}
}
return;
}
else if (interm_spin_time == 135)
{
if (interm_spin_10s_buff > 0)
{
mot_cycle_buff = 0x0f ;
output_buff |= 0x01 ;
interm_spin_10s_buff --;
process_left_time --;
}
if (interm_spin_10s_buff == 0)
{
mot_cycle_buff = 0x00 ;
output_buff &= (~0x01 );
if (interm_spin_5s_buff > 0)
{
interm_spin_5s_buff --;
process_left_time --;
}
if (interm_spin_5s_buff == 0)
{
interm_spin_10s_buff = 10;
interm_spin_5s_buff = 5;
interm_spin_cycle ++;
if (interm_spin_cycle == 9)
{
interm_spin_cycle = 0;
process_left_time = 0;
operation_counter ++;
pass_time_counter ++;
mot_cycle_buff = 0x0f ;
output_buff |= 0x01 ;
return;
}
}
else
return;
}
else
return;
}
else if (interm_spin_time != 135)
{
if (interm_spin_4s_buff > 0)
{
mot_cycle_buff = 0x0f ;
output_buff |= 0x01 ;
interm_spin_4s_buff --;
process_left_time --;
}
if (interm_spin_4s_buff == 0)
{
mot_cycle_buff = 0x00 ;
output_buff &= (~0x01 );
if (interm_spin_3s_buff > 0)
{
process_left_time --;
interm_spin_3s_buff --;
}
if (interm_spin_3s_buff == 0)
{
interm_spin_4s_buff = 4;
interm_spin_3s_buff = 3;
interm_spin_cycle ++;
if (interm_spin_time == 20)
{
if (interm_spin_cycle == 3)
{
interm_spin_cycle = 0;
process_left_time = 0;
pass_time_counter ++;
operation_counter ++;
mot_cycle_buff = 0x0f ;
output_buff |= 0x01 ;
return;
}
}
else if (interm_spin_time == 30)
{
if (interm_spin_cycle == 4)
{
interm_spin_cycle = 0;
process_left_time = 0;
operation_counter ++;
pass_time_counter ++;
mot_cycle_buff = 0x0f ;
output_buff |= 0x01 ;
return;
}
}
else if (interm_spin_time == 60)
{
if (interm_spin_cycle == 8)
{
interm_spin_cycle = 0;
process_left_time = 0;
operation_counter ++;
pass_time_counter ++;
mot_cycle_buff = 0x0f ;
output_buff |= 0x01 ;
return;
}
}
else if (interm_spin_time >= 255)
{
if (interm_spin_cycle == interm_spin_time/7)
{
interm_spin_cycle = 0;
process_left_time = 0;
operation_counter ++;
pass_time_counter ++;
mot_cycle_buff = 0x0f ;
output_buff |= 0x01 ;
return;
}
}
}
else
return;
}
else
return;
}
}
void spin(unsigned int spin_time)
{
static unsigned int spin_time_buff = 0;
if (process_left_time == 0)
process_left_time = spin_time + 30 + 5;
if (lid_open)
{
err_buff = 0x03 ;
return;
}
if (operation_flag_5.f_bit.fb3 == 1)
{
if (operation_flag_5.f_bit.fb0 == 0)
{
if (operation_flag_2.f_bit.fb6 == 0)
{
operation_flag_2.f_bit.fb6 = 1;
output_buff |= 0x04 ;
inlet_2m_buff = 120 ;
}
if (inlet_2m_buff >= 0)
inlet_2m_buff --;
if (operation_flag_2.f_bit.fb7 == 1)
{
operation_flag_2.f_bit.fb6 = 0;
operation_flag_2.f_bit.fb7 = 0;
operation_flag_3.f_bit.fb6 = 0;
inlet_2m_buff = 120 ;
drain_2m_buff = 120 ;
spin_balance_time_buff = 60;
operation_flag_5.f_bit.fb3 = 0;
}
}
if (operation_flag_5.f_bit.fb0 == 1)
{
if (operation_flag_2.f_bit.fb7 == 0)
{
operation_flag_2.f_bit.fb7 = 1;
output_buff &= (~0x04 );
stream_buff = 0x31 ;
spin_balance_time_buff = 60;
}
if (spin_balance_time_buff > 0)
{
spin_balance_time_buff --;
}
if (spin_balance_time_buff == 0)
{
stream_buff = 0x80 ;
output_buff &= (~0x01 );
output_buff &= (~0x10 );
if (operation_flag_5.f_bit.fb0 != 0)
{
if (operation_flag_3.f_bit.fb6 == 0)
{
operation_flag_3.f_bit.fb6 = 1;
drain_2m_buff = 120 ;
output_buff |= 0x02 ;
}
if(drain_2m_buff >= 0)
drain_2m_buff --;
}
}
}
return;
}
if (spin_time_buff < spin_time)
{
mot_cycle_buff = 0x0f ;
output_buff |= 0x01 ;
spin_time_buff ++;
process_left_time -- ;
}
if (spin_time_buff == spin_time)
{
mot_cycle_buff = 0x00 ;
output_buff &= (~0x01 );
if (inertial_30s_buff > 0)
{
inertial_30s_buff --;
process_left_time --;
}
if (inertial_30s_buff ==0)
{
if (break_5s_buff > 0)
{
output_buff &= (~0x02 );
break_5s_buff --;
process_left_time --;
}
if (break_5s_buff == 0)
{
spin_time_buff = 0;
inertial_30s_buff = 30;
break_5s_buff = 5;
process_left_time = 0;
operation_counter += 3;
pass_time_counter += 3;
}
}
}
return;
}
void soak_1(void)
{
stream_buff = 0x11 ;
if (soak_2m_buff > 0)
soak_2m_buff --;
if (soak_2m_buff == 0)
{
stream_buff = 0x80 ;
mot_cycle_buff &= 0x00 ;
output_buff &= (~0x01 );
output_buff &= (~0x10 );
if (soak_3m_buff > 0)
soak_3m_buff --;
if (soak_3m_buff == 0)
{
soak_2m_buff = 120;
soak_3m_buff = 180;
soak_1_cycle_buff ++;
}
}
}
void soak_2(void)
{
stream_buff = 0x11 ;
if (soak_1m_buff > 0)
soak_1m_buff --;
if (soak_1m_buff == 0)
{
stream_buff = 0x80 ;
mot_cycle_buff &= 0x00 ;
output_buff &= (~0x01 );
output_buff &= (~0x10 );
if (soak_4m_buff > 0)
soak_4m_buff --;
if (soak_4m_buff == 0)
{
soak_1m_buff = 60;
soak_4m_buff = 240;
soak_2_cycle_buff ++;
}
}
}
void soak_3(void)
{
stream_buff = 0x11 ;
if (soak_1m_buff > 0)
soak_1m_buff --;
if (soak_1m_buff == 0)
{
stream_buff = 0x80 ;
mot_cycle_buff &= 0x00 ;
output_buff &= (~0x01 );
output_buff &= (~0x10 );
if (soak_9m_buff > 0)
soak_9m_buff --;
if (soak_9m_buff == 0)
{
soak_1m_buff = 60;
soak_9m_buff = 540;
soak_3_cycle_buff ++;
}
}
}
void run_stream(void)
{
static unsigned int run_time = 600;
static unsigned int stop_time = 800;
if (stream_buff == 0x11 )
{
{
run_time = Stream_Table_A[stream_table_row][water_level].run;
stop_time = Stream_Table_A[stream_table_row][water_level].stop;
}
}
if (stream_buff == 0x41 )
{
run_time = Stream_Table_Ext_A[ext_stream_table_row][water_level].run;
stop_time = Stream_Table_Ext_A[ext_stream_table_row][water_level].stop;
}
if (stream_buff == 0x31 )
{
run_time = Balance_Stream_A[0].run;
stop_time = Balance_Stream_A[0].stop;
}
stream_moto(run_time, stop_time);
return;
}
void stream_moto(unsigned int run, unsigned int stop)
{
unsigned char i;
unsigned char j;
static signed char stream_run_time_buff;
static signed char stream_stop_time_buff;
if (status_buff != 0x02 )
return;
if (stream_100ms_buff == 0)
{
stream_100ms_buff = 1;
j = stream_buff;
j &= 0x01;
if (j != 0)
{
if (operation_flag_1.f_bit.fb3 == 0)
{
stream_run_time_buff = run/100;
stream_stop_time_buff = stop/100;
mot_cycle_buff = 0x0f ;
output_buff |= 0x01 ;
operation_flag_1.f_bit.fb3 = 1;
}
i = mot_cycle_buff;
switch (mot_cycle_buff)
{
case 0x0f :
stream_run_time_buff --;
if (stream_run_time_buff == 0)
{
stream_run_time_buff = run/100;
mot_cycle_buff &= 0x07 ;
output_buff &= (~0x01 );
}
break;
case 0x07 :
stream_stop_time_buff --;
if (stream_stop_time_buff == 0)
{
stream_stop_time_buff = stop/100;
mot_cycle_buff &= 0x03 ;
output_buff |= 0x10 ;
}
break;
case 0x03 :
stream_run_time_buff --;
if (stream_run_time_buff == 0)
{
stream_run_time_buff = run/100;
mot_cycle_buff &= 0x01 ;
output_buff &= (~0x10 );
}
break;
case 0x01 :
stream_stop_time_buff --;
if (stream_stop_time_buff == 0)
{
stream_stop_time_buff = stop/100;
mot_cycle_buff |= 0x0f ;
output_buff |= 0x01 ;
}
};
return;
}
else if (j == 0)
{
operation_flag_1.f_bit.fb3 = 0;
}
}
else
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -