The 7th Provincial Competition of Lanqiao Cup Single-chip Microcomputer-Analog Fan Control System

The nine-story demon tower rises from the base soil

Insert picture description here


Adapted from the official blue book routine of the National Nobunaga Sky Blue Bridge Cup, supplemented and modified according to my own habits


2021.3.16
Insert picture description here

 The seventh provincial competition routine is also available in the official blue book. Since the template is official, there is no need to paste a large piece of code. Only record the feelings in the process of brushing the questions, and compare the insufficiency of the code written by yourself after the seventh code given by the official.

Notes1: Give a certain buffer time in some cases after the button is pressed

 In the seventh session, there is a request to change the value that is decreasing in seconds after pressing S5. At this time, if you press to directly modify the value of the relevant variable, the value of this variable will immediately decrement, so the phenomenon you see is: assuming that it is set to 60, the digital tube immediately changes to 60, and then it is very fast decrement, and the digital tube displays 59 The time is less than 1s, which affects the experience. Moreover, pressing S5 changes the countdown time to 60, and pressing it again changes to 120, so the buffer time is necessary.
  The method used in the routine is to set a delay buffer variable ui_S5_Dly, after pressing S5, after processing the corresponding task, assign the variable ui_S5_Dlyto 2. Decrease first when 60 or 120 starts to decrease ui_S5_Dlyto obtain a delay time of 2s.

  case 5:    //按键5
	{
    
    
     ………………
     ………………
     ui_S5_Dly = 2;
    }break;


  if(ui_S5_Dly)  ui_S5_Dly--;
  else if(uc_Work_Mode_1_Less_time) uc_Work_Mode_1_Less_time--;

Notes2: Use timer to simulate output rectangular wave PWM wave on IO port

Notes3: Processing of the decimal part of DS18B20

 In the seventh routine, it is directly shifted to the right by four places, and the decimal part is ignored.
 Or you can use sprintf format control to control the number of decimal places %02.0f.
onewire

Notes4: DS18B20 single-bus onewire strict timing and timer interruption conflict processing

Notes5: Timer 1 output function of P34 pin

Guess you like

Origin blog.csdn.net/qq_43935020/article/details/114904384