阳谷企业做网站推广,wordpress内容评论可见,青岛胶南做网站的有多少,珠海电商网站建设只是为了方便阅读和理解#xff0c;所以未做详细的正确性检查。因为能力所限#xff0c;程度中还是保留了很多跳转(goto)语句。主循环已经完成#xff0c;发上来供大家参考int main(void){if(0 Prepare_Lock_Or_Fuse_Read() 0x80){while(1);}Disable_Watchdog();Init…只是为了方便阅读和理解所以未做详细的正确性检查。因为能力所限程度中还是保留了很多跳转(goto)语句。主循环已经完成发上来供大家参考int main(void){if(0 Prepare_Lock_Or_Fuse_Read() 0x80){while(1);}Disable_Watchdog();Initialize stack();switch_power_off();Ports_initialization();Clear_r0_r25();Clear_ram();Random 1;// Set default programmed parametersset_default_parameters();// Read all programmed parametersread_all_eeprom_parameters();// Initialize ADCInitialize_Adc();// Set beep strengthBeep_Strength Pgm_Beep_Strength;//Set initial arm variableInitial_Arm 1;//关中断cli();//???蜂鸣123wait200ms();beep_f1();wait30ms();beep_f2();wait30ms();beep_f3();wait30ms();#if MODE 1 ; Main or tail//Wait for receiver to initializewait1s();wait200ms();wait200ms();wait100ms();#endifinit_no_signal:while(1){cli();temp1 250;do{temp2 250;do{if(0 (Read_Rcp_Int() (1 Rcp_In))){goto bootloader_done;}}while(--temp2 ! 0);}while(--temp1 ! 0);if(Be_Bootloader()){Booterloder();while(1);}bootloader_done:decode_parameters();decode_settings();set_bec_voltage();find_throttle_gain();Beep_Strength Pgm_Beep_Strength;switch_power_off();//Timer0: clk/8 for regular interruptsTCCR0 (1 CS01);//Timer1: clk/8 for commutation control and RC pulse measurementTCCR1B (1 CS11);//Timer2: clk/8 for pwmTCCR2 (1 CS21);//Initialize interrupts and registersTIFR (1TIMSK (1//Initialize comparatorComp_Init();wait1ms();//Enable all interruptssei();//Measure number of lipo cellsMeasure_Lipo_Cells();//Reset stall countsts Stall_Cnt 0;//Initialize RC pulseRcp_Int_First(); //Enable interrupt and set to first edgeRcp_Int_Enable();// Enable interruptRcp_Clear_Int_Flag();// Clear interrupt flagFlags2 ~(1wait200ms();Flags0 | (1Temp4 3;// ; Number of attempts before going back to detect input signalmeasure_pwm_freq_start:Temp3 12// ; Number of pulses to measuremeasure_pwm_freq_loop://Check if period diff was acceptedif(Rcp_Period_Diff_Accepted 0){Temp3 12; // ; Reset number of pulses to measureif(0 --Temp4){continue;};}wait30ms(); // ; Wait 30ms for new pulseif(0 (Flags2 (1 RCP_UPDATED)))//; Is there an updated RC pulse available - proceed{continue;}Flags2 ~(1if(New_Rcp RCP_VALIDATE) goto measure_pwm_freq_start; //New_Rcp太小Temp1 Curr_Rcp_Pwm_Freq;// ; Store as previous flags for next pulsePrev_Rcp_Pwm_Freq Temp1;//// Store current flags for next pulseCurr_Rcp_Pwm_Freq (Flags3 ((1if(Curr_Rcp_Pwm_Freq ! Temp1) goto measure_pwm_freq_start;// ; Go back if new flags not same as previousif(--Temp3 ! 0) goto measure_pwm_freq_loop;// ; Go back if not required number of pulses seen//Clear measure pwm frequency flagFlags0 ~(1//Set up RC pulse interrupts after pwm frequency measurementRcp_Int_First();// ; Enable interrupt and set to first edgeRcp_Clear_Int_Flag();// ; Clear interrupt flagFlags2 ~(1if(Pgm_Enable_PWM_Input 0)// ; Check if PWM input is enabled{Flags2 | (1//__zlf__原程序此处是否正确Flags3 (!((1}//Test whether signal is OnShot125Flags2 ~(1 RCP_PPM_ONESHOT125);// ; Clear OneShot125 flagRcp_Outside_Range_Cnt 0;// ; Reset out of range counterwait100ms();// ; Wait for new RC pulsesif((0 ! (Flags2 (1 RCP_PPM))) // If flag is not set (PWM) - branch(Rcp_Outside_Range_Cnt 10))// Check how many pulses were outside normal PPM range (800-2160us){Flags2 | (1}//; Validate RC pulsevalidate_rcp_start:do{wait3ms();// ; Wait for next pulse (NB: Uses Temp1/2!)Temp1 RCP_VALIDATE;// ; Set validate level as defaultif(0 ! (Flags2 ( 1 RCP_PPM))){Temp1 0;// ; Set level to zero for PPM (any level will be accepted)}}while (New_Rcp Temp1);//New_Rcp太小//; Beep arm sequence start signalcli();// ; Disable all interruptsbeep_f1();// ; Signal that RC pulse is readybeep_f1();// ; Signal that RC pulse is readybeep_f1();// ; Signal that RC pulse is readysei();// ; Enable all interruptswait200ms();// Arming sequence startGov_Arm_Target 0;// ; Clear governor arm targetarming_start:do{#if MODE 1// ; Tail or multiif(Pgm_Direction ! 3) // ; Check if bidirectional operation{#endifwait3ms();if((Pgm_Enable_TX_Program 1)|| //; Start programming mode entry if enabled(Initial_Arm 1))// ; Yes - check if it is initial arm sequence{do{if(0 (Flags2 (1 RCP_PPM))){//PWM tx program entryif(New_Rcp RCP_MAX)// ; Is RC pulse max?{break;// ; No - branch}while(New_Rcp RCP_STOP)//New_Rcp RCP_STOP{cli();// ; Disable all interruptsbeep_f4();sei();// ; Enable all interruptswait100ms();}while(New_Rcp RCP_MAX);{cli();// ; Disable all interruptsbeep_f1();wait10ms();beep_f1();sei();// ; Enable all interruptswait100ms();}program_by_tx();// ; Yes - enter programming mode}//; PPM throttle calibration and tx program entry#if MODE 1 //; Main or tailtemp8 8;// ; Set 3 seconds wait time#elsetemp8 3;// ; Set 1 second wait time#endiffor(;temp8 ! 0; tmp8--){Flags3 | (1cli();find_throttle_gain();// ; Set throttle gainsei();wait100ms();// ; Wait for new throttle valuecli();// ; Disable interrupts (freeze New_Rcp value)Flags3 ~(1find_throttle_gain();// ; Set throttle gainTemp7 New_Rcp;// ; Store new RC pulse valuesei(); //; Enable interruptsif(New_Rcp (RCP_MAX/2))// Is RC pulse above midstick?{goto arm_target_updated;// ; No - branch}wait1ms();cli();// ; Disable all interruptsbeep_f4();sei(); ; Enable all interrupts}average_throttle();#if MODE 1 //; Main or tailPgm_Ppm_Max_Throttle Temp7 - 5;// ; Subtract about 2% and ensure that it is 250 or lower#elsePgm_Ppm_Max_Throttle Temp7;#endifwait200ms();cli();success_beep();sei();for(Temp8 10; Temp8 ! 0; Temp8--)// ; Set 3 seconds wait time{Flags3 | (1cli();find_throttle_gain();// ; Set throttle gainsei();wait100ms();cli(); //; Disable interrupts (freeze New_Rcp value)Flags3 ~(1find_throttle_gain();// ; Set throttle gainTemp7 New_Rcp;// ; Store new RC pulse valuesei(); ; Enable interruptsif(New_Rcp (RCP_MAX/2))// ; Below midstick?{Temp8 10;// ; Set 3 seconds wait timecontinue;// ; No - start over}wait1ms();cli();// ; Disable all interruptsbeep_f1();wait10ms();beep_f1();sei(); ; Enable all interrupts}average_throttle();Temp1 Pgm_Ppm_Min_Throttle Temp7 5;// ; Add about 2% (subtract negative number), ; Min throttle in Temp1Temp2 Pgm_Ppm_Max_Throttle - 130;// ; Subtract 130 (520us) from max throttleif((Pgm_Ppm_Max_Throttle 130) ||(Pgm_Ppm_Max_Throttle - 130 Temp1){Pgm_Ppm_Max_Throttle Temp1 130;//Make max 520us higher than min}wait200ms();cli();store_all_in_eeprom();success_beep_inverted();sei();wait100ms();cli();find_throttle_gain();// ; Set throttle gainsei();}while(New_Rcp RCP_MAX);program_by_tx();// ; Yes - enter programming mode}if(New_Rcp Gov_Arm_Target)// ; Is RC pulse larger than arm target?{Gov_Arm_Target Temp1;// Yes - update arm target}arm_target_updated:wait100ms();// ; Wait for new throttle valueTemp1 RCP_STOP;// ; Default stop valueif(Pgm_Direction 3)// ; Check if bidirectional operation{Temp1 (RCP_STOP4);// ; Higher stop value for bidirectional}#if MODE 1// ; Tail or multi}#endif}while(New_Rcp Temp1);//No below stop//; Beep arm sequence end signalcli();// ; Disable all interruptsbeep_f4();// ; Signal that rcpulse is readybeep_f4();// ; Signal that rcpulse is readybeep_f4();// ; Signal that rcpulse is readysei();// ; Enable all interruptswait200ms();//; Clear initial arm variableInitial_Arm 0;//; Armed and waiting for power onwait_for_power_on:while(1){Power_On_Wait_Cnt_L 0;// Clear wait counterPower_On_Wait_Cnt_H 0;// Zerodo{Power_On_Wait_Cnt_L;// ; Increment low wait counterif(Power_On_Wait_Cnt_L 0xFF)// Counter wrapping (about 3 sec)?{Power_On_Wait_Cnt_H;// ; Increment high wait counterTemp1 25;// ; Approximately 1 minif(Pgm_Beacon_Delay 1)else if(Pgm_Beacon_Delay 2){Temp1 50;// ; Approximately 2 min}else if(Pgm_Beacon_Delay 3){Temp1 125;// ; Approximately 5 min}else if(Pgm_Beacon_Delay 4){Temp1 250;// ; Approximately 10 min}else{Power_On_Wait_Cnt_H 0;//Reset counter for infinite delay}if(Power_On_Wait_Cnt_H Temp1)// ; Check against chosen delay{switch_power_off();// ; Switch power off in case braking is setwait1ms();Power_On_Wait_Cnt_H--;// Decrement high wait counterPower_On_Wait_Cnt_L 0; Set low wait counterBeep_Strength Pgm_Beacon_Strength;cli();// ; Disable all interruptsbeep_f();// ; Signal that there is no signalsei();// ; Enable all interruptsBeep_Strength Pgm_Beep_Strength;wait100ms();// ; Wait for new RC pulse to be measured}}wait10ms();if(Rcp_Timeout_Cntd 0){if(0 ! (Flags2 (1 RCP_PPM)))//; If ppm and pulses missing - go back to detect input signal{goto init_no_signal;}}Temp1 RCP_STOP;if(0 (Flags2 (1 RCP_PPM))){Temp1 (RCP_STOP5);// ; Higher than stop (for pwm)}}while(New_Rcp Temp1);#if MODE 1 //; Tail or multiif(Pgm_Direction ! 3)#endif{wait100ms();// ; Wait to see if start pulse was only a glitch}if(0 Rcp_Timeout_Cntd)// ; If it is not zero - proceed{goto init_no_signal;// ; If it is zero (pulses missing) - go back to detect input signal}//Start entry pointcli();switch_power_off();Requested_Pwm 0;//Set requested pwm to zeroGovernor_Req_Pwm 0;// Set governor requested pwm to zeroCurrent_Pwm 0;//Set current pwm to zeroCurrent_Pwm_Limited 0;//Set limited current pwm to zeroCurrent_Pwm_Lim_Dith 0;Pwm_Dither_Excess_Power 0;sei();//; Set idle pwm to programmed valuePwm_Motor_Idle (Pgm_Motor_Idle 1);Gov_Target_L 0;// ; Set target to zeroGov_Target_H 0;//Gov_Integral_L 0;// ; Set integral to zeroGov_Integral_H 0;//Gov_Integral_X 0;//Adc_Conversion_Cnt 0;//Flags0 0;// ; Clear flags0Flags1 0;// ; Clear flags1Demag_Detected_Metric 0;//Clear demag metric//Motor start beginningAdc_Conversion_Cnt TEMP_CHECK_RATE; ; Make sure a temp reading is doneSet_Adc_Ip_Temp();wait1ms();Start_Adc();//read_initial_tempwhile(0 ! (Get_Adc_Status() (1 ADSC))) {};Temp1 ADCL;Temp2 ADCH;Stop_Adc();if(0 ! Temp2)//; Is reading below 256?{Temp1 0xFF; ; No - set average temperature value to 255}Current_Average_Temp_Adc Temp1;// ; Set initial average temp ADC readingcheck_temp_voltage_and_limit_power();Adc_Conversion_Cnt TEMP_CHECK_RATE;// ; Make sure a temp reading is done next timeSet_Adc_Ip_Temp();//; Set up start operating conditionsdecode_parameters();// ; (Decode_parameters uses Temp1 and Temp8)//; Set max allowed powercli();// ; Disable interrupts to avoid that Requested_Pwm is overwrittenPwm_Limit 0xFF;// ; Set pwm limit to maxset_startup_pwm();Pwm_Limit Requested_Pwm;Pwm_Limit_Spoolup Requested_Pwm;Pwm_Limit_By_Rpm Requested_Pwm;sei();//Set low pwm again after calling set_startup_pwmRequested_Pwm 1;Current_Pwm 1;Current_Pwm_Limited 1;Current_Pwm_Lim_Dith 1;Spoolup_Limit_Skip 1;Spoolup_Limit_Cnt Auto_Bailout_Armed;//Begin startup sequenceif(Pgm_Direction 3)// ; Check if bidirectional operation{Flags3 ~(1if(0 ! (Flags2 (1 RCP_DIR_REV)))// ; Check force direction{Flags3 | (1}}init_start_bidir_done:Flags1 | (1Flags1 | (1Startup_Cnt Zero;// ; Reset countercomm5comm6();// ; Initialize commutationcomm6comm1();//initialize_timing();// ; Initialize timingcalc_next_comm_timing();// ; Set virtual commutation pointinitialize_timing();// ; Initialize timingcalc_next_comm_timing();//initialize_timing();// ; Initialize timing//; Run entry point//; Run 1 B(p-on) C(n-pwm) - comparator A evaluated//; Out_cA changes from low to highrun1:wait_for_comp_out_high ; Wait zero cross wait and wait for high//; setup_comm_wait();// ; Setup wait time from zero cross to commutation//; evaluate_comparator_integrity();// ; Check whether comparator reading has been normalcalc_governor_target();// ; Calculate governor targetwait_for_comm();// ; Wait from zero cross to commutationcomm1comm2();// ; Commutatecalc_next_comm_timing();// ; Calculate next timing and start advance timing wait//; wait_advance_timing();// ; Wait advance timing and start zero cross wait//; calc_new_wait_times();////; set_comparator_phase();// ; Set comparator phase//; wait_before_zc_scan();// ; Wait zero cross wait and start zero cross timeout//; Run 2 A(p-on) C(n-pwm) - comparator B evaluated//; Out_cB changes from high to lowrun2:wait_for_comp_out_low();//; setup_comm_wait();//; evaluate_comparator_integrity();if(0 ! (Flags0 (1 GOV_ACTIVE))){calc_governor_prop_error();}if(0 (Flags1 (1 HIGH_RPM)))// ; Skip if high rpm{set_pwm_limit_low_rpm();}if(0 ! (Flags1 (1 HIGH_RPM)))// ; Do if high rpm{set_pwm_limit_high_rpm();}wait_for_comm();// ; Wait from zero cross to commutationcomm2comm3();// ; Commutatecalc_next_comm_timing();// ; Calculate next timing and start advance timing wait//; wait_advance_timing();// ; Wait advance timing and start zero cross wait//; calc_new_wait_times();////; set_comparator_phase();// ; Set comparator phase//; wait_before_zc_scan();// ; Wait zero cross wait and start zero cross timeout//; Run 3 A(p-on) B(n-pwm) - comparator C evaluated//; Out_cC changes from low to highrun3:wait_for_comp_out_high();//; setup_comm_wait//; evaluate_comparator_integrityif(0 ! (Flags0 (1 GOV_ACTIVE))){calc_governor_prop_error();}wait_for_comm();// ; Wait from zero cross to commutationcomm3comm4();// ; Commutatecalc_next_comm_timing();// ; Calculate next timing and start advance timing wait//; wait_advance_timing();// ; Wait advance timing and start zero cross wait//; calc_new_wait_times();////; set_comparator_phase();// ; Set comparator phase//; wait_before_zc_scan();// ; Wait zero cross wait and start zero cross timeout//; Run 4 C(p-on) B(n-pwm) - comparator A evaluated//; Out_cA changes from high to lowrun4:wait_for_comp_out_low();//; setup_comm_wait();//; evaluate_comparator_integrity();if(0 ! (Flags0 (1 GOV_ACTIVE))){calc_governor_prop_error();}wait_for_comm();// ; Wait from zero cross to commutationcomm4comm5();// ; Commutatecalc_next_comm_timing();// ; Calculate next timing and start advance timing wait//; wait_advance_timing();// ; Wait advance timing and start zero cross wait//; calc_new_wait_times();////; set_comparator_phase();// ; Set comparator phase//; wait_before_zc_scan();// ; Wait zero cross wait and start zero cross timeout//; Run 5 C(p-on) A(n-pwm) - comparator B evaluated//; Out_cB changes from low to highrun5:wait_for_comp_out_high();//; setup_comm_wait//; evaluate_comparator_integrityif(0 ! (Flags0 (1 GOV_ACTIVE))){calc_governor_prop_error();}wait_for_comm();// ; Wait from zero cross to commutationcomm5comm6();// ; Commutatecalc_next_comm_timing();// ; Calculate next timing and start advance timing wait//; wait_advance_timing();// ; Wait advance timing and start zero cross wait//; calc_new_wait_times();////; set_comparator_phase();// ; Set comparator phase//; wait_before_zc_scan();// ; Wait zero cross wait and start zero cross timeout//; Run 6 B(p-on) A(n-pwm) - comparator C evaluated//; Out_cC changes from high to lowrun6:wait_for_comp_out_low();//; setup_comm_wait();//; evaluate_comparator_integrity();Start_Adc();wait_for_comm();// ; Wait from zero cross to commutationcomm6comm1();// ; Commutatecalc_next_comm_timing();// ; Calculate next timing and start advance timing wait//; wait_advance_timing();// ; Wait advance timing and start zero cross wait//; calc_new_wait_times();////; set_comparator_phase();// ; Set comparator phase//; wait_before_zc_scan();// ; Wait zero cross wait and start zero cross timeoutcheck_temp_voltage_and_limit_power();//; Check if it is startupif(0 (Flags1 (1 STARTUP_PHASE))){goto normal_run_checks;}//Set spoolup power variablesPwm_Limit Pwm_Spoolup_Beg;// ; Set initial max powerPwm_Limit_Spoolup Pwm_Spoolup_Beg;// ; Set initial slow spoolup powerSpoolup_Limit_Cnt Auto_Bailout_Armed;Spoolup_Limit_Skip 1;//; Check startup counterTemp2 24;// ; Set nominal startup parametersTemp3 12;if(Startup_Cnt Temp2)// ; Is counter above requirement?{if(New_Rcp RCP_STOP)// ; Check if pulse is below stop value{goto run_to_wait_for_power_on;}else{goto run1;// ; Continue to run}}Flags1 ~(1Flags1 | (1Initial_Run_Rot_Cntd Temp3;// ; Set initial run rotation count#if MODE 1 //; TailPwm_Limit 0xff;// ; Allow full power#elif MODE 2 // ; MultiPwm_Limit Pwm_Spoolup_Beg;Pwm_Limit_By_Rpm Pwm_Spoolup_Beg;#endifnormal_run_checks://; Check if it is initial run phaseif(0 (Flags1 (1 INITIAL_RUN_PHASE)))// ; If not initial run phase - branch{goto initial_run_phase_done;}if(1 (Flags0 (1 DIR_CHANGE_BRAKE)))// ; If a direction change - branch{goto initial_run_phase_done;}//; Decrement startup rotation countif(Initial_Run_Rot_Cntd - 1) 0) //; Check number of nondamped rotations{Flags1 ~(1Flags1 | (1goto run1} ; Continue with normal runnormal_run_check_startup_rot:Initial_Run_Rot_Cntd Initial_Run_Rot_Cntd - 1;// ; Not zero - store counterif(New_Rcp RCP_STOP)// ; Check if pulse is below stop value{goto run1();// ; Continue to run}if(Pgm_Direction ! 3)// ; Check if bidirectional operation{goto run_to_wait_for_power_on;}initial_run_phase_done://; Reset stall countStall_Cnt 0;#if MODE 0 //; Main//; Check if throttle is zeroedif(Rcp_Stop_Cnt 1)// ; Is number of stop RC pulses above limit?{Pwm_Limit_Spoolup Pwm_Spoolup_Beg;// ; If yes - set initial max powersSpoolup_Limit_Cnt Auto_Bailout_Armed;// ; And set spoolup parametersSpoolup_Limit_Skip 1;}#endif//; Exit run loop after a given timeTemp1 RCP_STOP_LIMIT;if(0 ! Pgm_Brake_On_Stop){Temp1 3;// ; About 100ms before stopping when brake is set}if(Rcp_Stop_Cnt Temp1)// ; Is number of stop RC pulses above limit?{goto run_to_wait_for_power_on;// ; Yes, go back to wait for poweron}if(0 ! (Flags2 (1 RCP_PPM))){if(Rcp_Timeout_Cntd 0){goto run_to_wait_for_power_on;// ; If it is zero - go back to wait for poweron}}run6_check_dir:#if MODE 1 // ; Tail or multiif((Pgm_Direction 3) //Check if bidirectional operation((0 (Flags3 (1 PGM_DIR_REV))) ! //Check if actual rotation direction(0 (Flags2 (1 RCP_DIR_REV)))) //Matches force direction(0 (Flags0 (1 DIR_CHANGE_BRAKE)))){Flags0 | (1Pwm_Limit Pwm_Spoolup_Beg;// ; Set max power while brakinggoto run4;// ; Go back to run 4, thereby changing force direction}#endifTemp1 0xF0;// ; Default minimum speedif((0 ! (Flags0 (1 {Pwm_Limit Pwm_Spoolup_Beg;// ; Set max power while brakingTemp1 0x20;// ; Bidirectional braking termination speed}run6_brake_done:if(Comm_Period4x_H Temp1)// ; Is Comm_Period4x more than 32ms (~1220 eRPM)?{goto run1;// ; No - go back to run 1}//; Yes - stop or turn direction#if MODE 1 //; Tail or multiif(0 (Flags0 (1 DIR_CHANGE_BRAKE)))// ; If it is not a direction change - stop{goto run_to_wait_for_power_on;}Flags0 ~(1Flags3 (1if(0 ! (Flags2 (1 RCP_DIR_REV)))// ; Check force direction{Flags3 (1}Flags1 | (1Initial_Run_Rot_Cntd 18;Pwm_Limit Pwm_Spoolup_Beg;// ; Set initial max powergoto run1;// ; Go back to run 1.ENDIFrun_to_wait_for_power_on_fail:Stall_Cnt;// ; Increment stall countif(0 ! New_Rcp)// ; Check if RCP is zero, then it is a normal stop{goto run_to_wait_for_power_on_stall_done;}run_to_wait_for_power_on:Stall_Cnt Zero;run_to_wait_for_power_on_stall_done:cli();switch_power_off();Temp7 Pgm_Pwm_Freq;// ; Store setting in Temp7Pgm_Pwm_Freq 2;decode_parameters();// ; (Decode_parameters uses Temp1 and Temp8)Pgm_Pwm_Freq Temp7;// ; Restore settingsRequested_Pwm 0;// ; Set requested pwm to zeroGovernor_Req_Pwm 0;// ; Set governor requested pwm to zeroCurrent_Pwm 0;// ; Set current pwm to zeroCurrent_Pwm_Limited 0;// ; Set limited current pwm to zeroCurrent_Pwm_Lim_Dith 0;//Pwm_Motor_Idle 0;// ; Set motor idle to zeroFlags0 0;// ; Clear flags0Flags1 0;// ; Clear flags1sei();wait100ms();// ; Wait for pwm to be stoppedswitch_power_off();if(0 ! Pgm_Brake_On_Stop){Brake_FETs_On();}run_to_wait_for_power_on_brake_done:Initialize_Adc();// ; Initialize ADC, to keep reference on for selected ESCs#if MODE 0 // ; Mainif((0 ! (Flags2 (1 RCP_PPM))) (0 Rcp_Timeout_Cntd))// ; Load RC pulse timeout counter value{goto init_no_signal;// ; If it is zero (pulses missing) - go back to detect input signal}run_to_next_state_main:if(Pgm_Main_Rearm_Start 1)// Is re-armed start enabled?{goto validate_rcp_start;// ; Yes - go back to validate RC pulse}//No - do like tail and start immediately#elif MODE 1 //; Tail or multiif((0 ! (Flags2 (1 RCP_PPM))) (Stall_Cnt 4))//{goto init_no_signal;// ; If it is zero (pulses missing) - go back to detect input signal}#endif}}}