![]() |
happy2058 發表于 2025-7-6 14:00 變速箱是按比例改變轉速的 |
npn 發表于 2025-7-6 09:29 void automatic_reset() { static u8 temp_index = 0; if(Automatic_Backward_flag) { if(++Pulse_frequency_continued <= 1200) { u8 P3_temp; P3_temp = P3 & 0XC3; P3= P3_temp | step_pulse[temp_index++]; if(temp_index >=8) temp_index =0; } else Automatic_Backward_flag =0; } } 搞好了,文檔里的150是周期。8*150 |
npn 發表于 2025-7-6 09:29 放在1MS中斷里 |
npn 發表于 2025-7-6 09:29 u8 step_pulse[8]={0x38,0x28,0x2c,0x24,0x34,0x14,0x1c,0x18}; //脈沖 void automatic_reset() { static u8 temp_index = 0; if(Automatic_Backward_flag) { if(Pulse_frequency_continued <3000) { u8 P3_temp; P3_temp = P3 & 0XC3; P3= P3_temp | step_pulse[temp_index++]; if(temp_index >=7) temp_index =0; } if(++Pulse_frequency_continued >=3000) Automatic_Backward_flag =0; } } |
人中狼 發表于 2025-7-6 08:45 理解不了這個文檔 |
樓主還需要提供源程序、驅動器電路才能知道是什么問題。 |
沒算變速箱 |