![]() |
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 理解不了这个文档 |
楼主还需要提供源程序、驱动器电路才能知道是什么问题。 |
没算变速箱 |