📄 t_shuanglong.c
字号:
led[1]|=main_fan_motor_zhengfa_sense_led_at1;
}
else
{
led[1]&=~main_fan_motor_zhengfa_sense_led_at1;
error_counter++;
}
}
refrush_led();
while(lock_bit)
{
if((step_mode==0x00)&(mode_motor_bit==0)&(mode_motor_testing_bit==0))//set direction
{
MODE_P=1; //启动模式马达
NOP();
MODE_N=0;
NOP();
led[3]&=~mode_motor_test_fail_led_at3;
led[3]&=~mode_motor_close_led_at3;
led[3]|=MODE_MOTOR_OPEN_LED_AT3;
led[3]|=mode_motor_testing_led_at3;
time_counter_mode_motor=0x00;
mode_motor_testing_bit=1;
}
else if((step_mode==0x01)&(mode_motor_bit==0)&(mode_motor_testing_bit==0))//set direction
{
MODE_P=0; //启动模式马达
NOP();
MODE_N=1;
NOP();
led[3]&=~mode_motor_test_fail_led_at3;
led[3]&=~MODE_MOTOR_OPEN_LED_AT3;
led[3]|=mode_motor_close_led_at3;
led[3]|=mode_motor_testing_led_at3;
time_counter_mode_motor=0x00;
mode_motor_testing_bit=1;
}
//---------------------------------------------------------------------
//wendu led setup
//------------------------------------------------------------------
if((step_wendu==0x00)&(wendu_motor_bit==0)&(wendu_motor_testing_bit==0))//set direction
{
MIX_P=1; //启动温度马达
NOP();
MIX_N=0;
NOP();
led[2]&=~wendu_motor_test_fail_led_at2;
led[2]&=~wendu_motor_close_led_at2;//set close light
led[2]|=wendu_motor_open_led_at2;
led[2]|=wendu_motor_testing_led_at2;
time_counter_wendu_motor=0x00;
wendu_motor_testing_bit=1;
}
else if((step_wendu==0x01)&(wendu_motor_bit==0)&(wendu_motor_testing_bit==0))//set direction
{
MIX_P=0; //启动温度马达
NOP();
MIX_N=1;
NOP();
led[2]&=~wendu_motor_test_fail_led_at2;
led[2]&=~wendu_motor_open_led_at2;
led[2]|=wendu_motor_close_led_at2;//set close light
led[2]|=wendu_motor_testing_led_at2;
time_counter_wendu_motor=0x00;
wendu_motor_testing_bit=1;
}
//---------------------------------------------------------------------
//xinfeng led setup
//------------------------------------------------------------------
if((step_xinfeng==0x00)&(xinfeng_motor_bit==0)&(xinfeng_motor_testing_bit==0))//set direction
{
RF_P=1; //启动新风马达
NOP();
RF_N=0;
NOP();
led[3]&=~xinfeng_motor_test_fail_led_at3;
led[3]&=~xinfeng_motor_close_led_at3;//set close light
led[3]|=xinfeng_motor_open_led_at3;
led[3]|=xinfeng_motor_testing_led_at3;
time_counter_xinfeng_motor=0x00;
xinfeng_motor_testing_bit=1;
}
else if((step_xinfeng==0x01)&(xinfeng_motor_bit==0)&(xinfeng_motor_testing_bit==0))//set direction
{
RF_P=0; //启动新风马达
NOP();
RF_N=1;
NOP();
led[3]&=~xinfeng_motor_test_fail_led_at3;
led[3]&=~xinfeng_motor_open_led_at3;
led[3]|=xinfeng_motor_close_led_at3;//set close light
led[3]|=xinfeng_motor_testing_led_at3;
time_counter_xinfeng_motor=0x00;
xinfeng_motor_testing_bit=1;
}
//-------------------------------------------------------------------
//bellow is main fan tester led steup and speed set up for auto
//--------------------------------------------------------------------
if((step_main_fan==0x00)&(main_fan_motor_testing_bit==0))
{
led[1]&=~main_fan_motor_test_fail_led_at1;//clr fail led
led[2]&=~main_fan_motor_2_led_at2;
led[2]&=~main_fan_motor_3_led_at2;
led[2]&=~main_fan_motor_4_led_at2;
led[1]&=~main_fan_motor_5_led_at1;
led[1]&=~main_fan_motor_6_led_at1;
led[2]|=main_fan_motor_1_led_at2;
led[1]|=main_fan_motor_testing_led_at1;
main_motor_relay=1;//turn on power of main fan
main_fan_motor_testing_bit=1;
CCPR1L=PWM[step_main_fan];//主风扇测试涵数计数器
}
if((step_main_fan==0x01)&(main_fan_motor_testing_bit==0))
{
led[2]&=~main_fan_motor_3_led_at2;
led[2]&=~main_fan_motor_4_led_at2;
led[1]&=~main_fan_motor_5_led_at1;
led[1]&=~main_fan_motor_6_led_at1;
led[2]&=~main_fan_motor_1_led_at2;
led[2]|=main_fan_motor_2_led_at2;
led[1]|=main_fan_motor_testing_led_at1;
main_motor_relay=1;//turn on power of main fan
main_fan_motor_testing_bit=1;
CCPR1L=PWM[step_main_fan];//主风扇测试涵数计数器
}
if((step_main_fan==0x02)&(main_fan_motor_testing_bit==0))
{
led[2]&=~main_fan_motor_4_led_at2;
led[1]&=~main_fan_motor_5_led_at1;
led[1]&=~main_fan_motor_6_led_at1;
led[2]&=~main_fan_motor_1_led_at2;
led[2]&=~main_fan_motor_2_led_at2;
led[2]|=main_fan_motor_3_led_at2;
led[1]|=main_fan_motor_testing_led_at1;
main_motor_relay=1;//turn on power of main fan
CCPR1L=PWM[step_main_fan];//主风扇测试涵数计数器
}
if((step_main_fan==0x03)&(main_fan_motor_testing_bit==0))
{
led[1]&=~main_fan_motor_5_led_at1;
led[1]&=~main_fan_motor_6_led_at1;
led[2]&=~main_fan_motor_1_led_at2;
led[2]&=~main_fan_motor_2_led_at2;
led[2]&=~main_fan_motor_3_led_at2;
led[2]|=main_fan_motor_4_led_at2;
led[1]|=main_fan_motor_testing_led_at1;
main_motor_relay=1;//turn on power of main fan
main_fan_motor_testing_bit=1;
CCPR1L=PWM[step_main_fan];//主风扇测试涵数计数器
}
if((step_main_fan==0x04)&(main_fan_motor_testing_bit==0))
{
led[1]&=~main_fan_motor_6_led_at1;
led[2]&=~main_fan_motor_1_led_at2;
led[2]&=~main_fan_motor_2_led_at2;
led[2]&=~main_fan_motor_3_led_at2;
led[2]&=~main_fan_motor_4_led_at2;
led[1]|=main_fan_motor_5_led_at1;
led[1]|=main_fan_motor_testing_led_at1;
main_motor_relay=1;//turn on power of main fan
main_fan_motor_testing_bit=1;
CCPR1L=PWM[step_main_fan];//主风扇测试涵数计数器
}
if((step_main_fan==0x05)&(main_fan_motor_testing_bit==0))
{
led[2]&=~main_fan_motor_1_led_at2;
led[2]&=~main_fan_motor_2_led_at2;
led[2]&=~main_fan_motor_3_led_at2;
led[2]&=~main_fan_motor_4_led_at2;
led[1]&=~main_fan_motor_5_led_at1;
led[1]|=main_fan_motor_6_led_at1;
led[1]|=main_fan_motor_testing_led_at1;
main_motor_relay=1;//turn on power of main fan
main_fan_motor_testing_bit=1;
CCPR1L=PWM[step_main_fan];//主风扇测试涵数计数器
}
//----------------bellow is nother order
if((step_main_fan==0x06)&(main_fan_motor_testing_bit==0))//the same as step 5
{
led[1]&=~main_fan_motor_6_led_at1;
led[2]&=~main_fan_motor_1_led_at2;
led[2]&=~main_fan_motor_2_led_at2;
led[2]&=~main_fan_motor_3_led_at2;
led[2]&=~main_fan_motor_4_led_at2;
led[1]|=main_fan_motor_5_led_at1;
led[1]|=main_fan_motor_testing_led_at1;
main_motor_relay=1;//turn on power of main fan
main_fan_motor_testing_bit=1;
CCPR1L=PWM[0x04];//主风扇测试涵数计数器
}
if((step_main_fan==0x07)&(main_fan_motor_testing_bit==0))//the same as step 3
{
led[2]&=~main_fan_motor_4_led_at2;
led[1]&=~main_fan_motor_5_led_at1;
led[1]&=~main_fan_motor_6_led_at1;
led[2]&=~main_fan_motor_1_led_at2;
led[2]&=~main_fan_motor_2_led_at2;
led[2]|=main_fan_motor_3_led_at2;
led[1]|=main_fan_motor_testing_led_at1;
main_motor_relay=1;//turn on power of main fan
CCPR1L=PWM[0x02];//主风扇测试涵数计数器
}
if((step_main_fan==0x08)&(main_fan_motor_testing_bit==0))//the same as step 1
{
led[1]&=~main_fan_motor_test_fail_led_at1;//clr fail led
led[2]&=~main_fan_motor_2_led_at2;
led[2]&=~main_fan_motor_3_led_at2;
led[2]&=~main_fan_motor_4_led_at2;
led[1]&=~main_fan_motor_5_led_at1;
led[1]&=~main_fan_motor_6_led_at1;
led[2]|=main_fan_motor_1_led_at2;
led[1]|=main_fan_motor_testing_led_at1;
main_motor_relay=1;//turn on power of main fan
main_fan_motor_testing_bit=1;
CCPR1L=PWM[0x00];//主风扇测试涵数计数器
}
//------------------------------------------------------------------
//comeon section
refrush_led();
delay_500mS(2);
//-------------------------------------------------------------------
if((step_mode<0x02))//start_test//
{
unsigned int position_data_temp,current_data_temp;
current_data_temp=ad_sampling(AD1);//模式电机电流
position_data_temp=ad_sampling(AD6);//模式电机位置反馈电压
time_counter_mode_motor++;
if((position_data_temp<max_close_mode_moter_position)|(position_data_temp>max_open_mode_moter_position))//(current_data_temp<motor_100mA)&
{
led[3]&=~mode_motor_testing_led_at3;
time_counter_mode_motor=0x00;
mode_motor_testing_bit=0;
step_mode++;
}
else if(time_counter_mode_motor>10)
{
led[3]&=~mode_motor_testing_led_at3;
led[3]|=mode_motor_test_fail_led_at3;
time_counter_mode_motor=0x00;
mode_motor_bit=1;//shi bai le
step_mode=0x04;
MODE_P=0; //ting zhi 模式马达
NOP();
MODE_N=0;
error_counter++;
}
else if(curent_bit)
{
if(current_data_temp>motor_100mA)//motor_100mA==180
{
led[3]&=~mode_motor_testing_led_at3;
led[3]|=mode_motor_test_fail_led_at3;
time_counter_mode_motor=0x00;
mode_motor_bit=1;//guo liu le
MODE_P=0; //ting zhi 模式马达
NOP();
MODE_N=0;
error_counter++;
}
}
else if(current_data_temp>motor_150mA)//motor_100mA==180
{
led[3]&=~mode_motor_testing_led_at3;
led[3]|=mode_motor_test_fail_led_at3;
time_counter_mode_motor=0x00;
mode_motor_bit=1;//guo liu le
MODE_P=0; //ting zhi 模式马达
NOP();
MODE_N=0;
error_counter++;
}
}
if(step_mode==0x02)
{
mode_motor_bit=1;//finish ed
time_counter_mode_motor=0x00;
}
refrush_led();
//above is auto of mode motor test section
//----------------------------------------------------------------
if((step_wendu<0x02))//start_test//
{
unsigned int position_data_temp,current_data_temp;
current_data_temp=ad_sampling(AD3);//温度电机电流
position_data_temp=ad_sampling(AD8);//温度电机位置反馈电压
time_counter_wendu_motor++;
if((position_data_temp<max_close_wendu_moter_position)|(position_data_temp>max_open_wendu_moter_position))//(current_data_temp<motor_100mA)&
{
led[2]&=~wendu_motor_testing_led_at2;
time_counter_wendu_motor=0x00;
wendu_motor_testing_bit=0;
step_wendu++;
}
else if(time_counter_wendu_motor>10)
{
led[2]&=~wendu_motor_testing_led_at2;
led[2]|=wendu_motor_test_fail_led_at2;
time_counter_wendu_motor=0x00;
wendu_motor_bit=1;//shi bai le
step_wendu=0x02;
MIX_P=0; //ding zhi 温度马达
NOP();
MIX_N=0;
error_counter++;
}
else if(curent_bit)
{
if(current_data_temp>motor_100mA)//motor_100mA==180
{
led[2]&=~wendu_motor_testing_led_at2;
led[2]|=wendu_motor_test_fail_led_at2;
time_counter_wendu_motor=0x00;
wendu_motor_bit=1;//guo liu le
step_wendu=0x02;
MIX_P=0; //ding zhi 温度马达
NOP();
MIX_N=0;
error_counter++;
}
}
else if(current_data_temp>motor_150mA)//motor_100mA==180
{
led[2]&=~wendu_motor_testing_led_at2;
led[2]|=wendu_motor_test_fail_led_at2;
time_counter_wendu_motor=0x00;
wendu_motor_bit=1;//guo liu le
step_wendu=0x02;
MIX_P=0; //ding zhi 温度马达
NOP();
MIX_N=0;
error_counter++;
}
}
if(step_wendu==0x02)
{
wendu_motor_bit=1;//finish ed
time_counter_wendu_motor=0x00;
}
refrush_led();
//above is auto of wendu motor test section
//----------------------------------------------------------------
if((step_xinfeng<0x02))//start_test//
{
unsigned int position_data_temp,current_data_temp;
current_data_temp=ad_sampling(AD2);//新风电机电流
position_data_temp=ad_sampling(AD7);//新风电机位置反馈电压
time_counter_xinfeng_motor++;
if((position_data_temp<max_close_xinfeng_moter_position)|(position_data_temp>max_open_xinfeng_moter_position))//(current_data_temp<motor_100mA)&
{
led[3]&=~xinfeng_motor_testing_led_at3;
time_counter_xinfeng_motor=0x00;
xinfeng_motor_testing_bit=0;
step_xinfeng++;
}
else if(time_counter_xinfeng_motor>10)
{
led[3]&=~xinfeng_motor_testing_led_at3;
led[3]|=xinfeng_motor_test_fail_led_at3;
time_counter_xinfeng_motor=0x00;
xinfeng_motor_bit=1;//shi bai le
step_xinfeng=0x02;
RF_P=0; //关闭新风马达
NOP();
RF_N=0;
NOP();
error_counter++;
}
else if(curent_bit)
{
if(current_data_temp>motor_100mA)//motor_100mA==180
{
led[3]&=~xinfeng_motor_testing_led_at3;
led[3]|=xinfeng_motor_test_fail_led_at3;
time_counter_xinfeng_motor=0x00;
xinfeng_motor_bit=1;//guo liu le
step_xinfeng=0x02;
RF_P=0; //关闭新风马达
NOP();
RF_N=0;
NOP();
error_counter++;
}
}
else if(current_data_temp>motor_150mA)//motor_100mA==180
{
led[3]&=~xinfeng_motor_testing_led_at3;
led[3]|=xinfeng_motor_test_fail_led_at3;
time_counter_xinfeng_motor=0x00;
xinfeng_motor_bit=1;//guo liu le
step_xinfeng=0x02;
RF_P=0; //关闭新风马达
NOP();
RF_N=0;
NOP();
error_counter++;
}
}
if(step_xinfeng==0x02)
{
xinfeng_motor_bit=1;//finish ed
time_counter_xinfeng_motor=0x00;
}
refrush_led();
//above is auto of xinfeng section
//------------------------------------------------------------------------above is one kind mode test
//bellow is main fan test section
//---------------------------------------------------------------------------
if(step_main_fan<0x09)
{
unsigned int position_data_temp,current_data_temp;
current_data_temp=ad_sampling(AD0);//主风扇电流
position_data_temp=ad_sampling(AD5);//主风扇反馈电压
time_counter_main_fan_motor++;
if(step_main_fan==0x00)
{
if((position_data_temp>500)&(position_data_temp<600))//val are 573
{
main_fan_motor_testing_bit=0;
time_counter_main_fan_motor=0x00;
step_main_fan=0x01;
}
}
else if(step_main_fan==0x01)
{
if((position_data_temp>390)&(position_data_temp<500))//val are 432
{
main_fan_motor_testing_bit=0;
time_counter_main_fan_motor=0x00;
step_main_fan=0x02;
}
}
else if(step_main_fan==0x02)
{
if((position_data_temp>250)&(position_data_temp<400))////val are 302
{
main_fan_motor_testing_bit=0;
time_counter_main_fan_motor=0x00;
step_main_fan=0x03;
}
}
else if(step_main_fan==0x03)
{
if((position_data_temp>100)&(position_data_temp<200))//val are 194
{
main_fan_motor_testing_bit=0;
time_counter_main_fan_motor=0x00;
step_main_fan=0x04;
}
}
else if(step_main_fan==0x04)
{
if((position_data_temp>70)&(position_data_temp<180))//val are 102
{
main_fan_motor_testing_bit=0;
time_counter_main_fan_motor=0x00;
step_main_fan=0x05;
}
}
else if(step_main_fan==0x05)//step 6
{
if((position_data_temp>50)&(position_data_temp<160))//val are 102
{
main_fan_motor_testing_bit=0;
time_counter_main_fan_motor=0x00;
step_main_fan=0x06;
}
}
else if(step_main_fan==0x06)//step 7
{
if(1)//(position_data_temp>70)&(position_data_temp<180))//val are 102//the same as step 5
{
main_fan_motor_testing_bit=0;
time_counter_main_fan_motor=0x00;
step_main_fan=0x07;
}
}
else if(step_main_fan==0x07)//step 8
{
if((position_data_temp>250)&(position_data_temp<400))////val are 302//the same as step 3
{
main_fan_motor_testing_bit=0;
time_counter_main_fan_motor=0x00;
step_main_fan=0x08;
}
}
else if(step_main_fan==0x08)//step 9
{
if((position_data_temp>500)&(position_data_temp<600))//val are 573//the same as step 1
{
main_fan_motor_testing_bit=0;
time_counter_main_fan_motor=0x00;
step_main_fan=0x09;
led[1]&=~main_fan_motor_testing_led_at1;
}
}
else if(time_counter_main_fan_motor>10)
{
led[1]|=main_fan_motor_test_fail_led_at1;
main_fan_motor_testing_bit=0;
time_counter_main_fan_motor=0x00;
main_fan_motor_bit=1;
error_counter++;
}
else if(current_data_temp>motor_30A)//motor_100mA==180
{
led[1]|=main_fan_motor_test_fail_led_at1;
led[1]|=main_fan_motor_current_over_led_at1;
lock_bit=0;//guo liu quit and power off of motor
main_motor_relay=0;
main_fan_motor_testing_bit=0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -