This commit is contained in:
吴俊潮 2025-03-31 15:07:25 +08:00
parent 393607e0cd
commit 694c8a2a71
6 changed files with 2566 additions and 2123 deletions

View File

@ -142,19 +142,20 @@ int main(void)
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
//数字量输入输出
// digital_ctrl();
//
// //模拟量数据采集
// analog_gather();
//
// //4-20mA电流输出控制
// analog_ctrl();
//
// //编码器
// encoder_run();
digital_ctrl();
//模拟量数据采集
analog_gather();
//4-20mA电流输出控制
analog_ctrl();
//编码器
encoder_run();
//网络通讯
tcpip_run();

View File

@ -43,7 +43,7 @@ void MX_TIM1_Init(void)
/* USER CODE END TIM1_Init 1 */
htim1.Instance = TIM1;
htim1.Init.Prescaler = 1;
htim1.Init.Prescaler = 0;
htim1.Init.CounterMode = TIM_COUNTERMODE_UP;
htim1.Init.Period = 65535;
htim1.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;

View File

@ -82,7 +82,7 @@
</BeforeMake>
<AfterMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<RunUserProg2>1</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>

File diff suppressed because it is too large Load Diff

View File

@ -505,7 +505,7 @@ ProjectManager.FreePins=false
ProjectManager.HalAssertFull=false
ProjectManager.HeapSize=0x200
ProjectManager.KeepUserCode=true
ProjectManager.LastFirmware=true
ProjectManager.LastFirmware=false
ProjectManager.LibraryCopy=1
ProjectManager.MainLocation=Core/Src
ProjectManager.NoMain=false
@ -572,7 +572,7 @@ SPI2.VirtualNSS=VM_NSSHARD
SPI2.VirtualType=VM_MASTER
TIM1.EncoderMode=TIM_ENCODERMODE_TI12
TIM1.IPParameters=EncoderMode,Prescaler
TIM1.Prescaler=1
TIM1.Prescaler=0
TIM6.IPParameters=Prescaler,Period
TIM6.Period=999
TIM6.Prescaler=83

View File

@ -398,36 +398,7 @@ void analog_ctrl(void)
//逐步接近法
//void prov_calibrate_step(propotion_valve *pvx)
//{
// pvx->cstep_wait = (pvx->cstep_wait > 254)?(pvx->cstep_wait):(pvx->cstep_wait + 1); //每100ms加一次上限255
//
// if( pvx->cstep_wait > CSTEP_WAIT_MAX) //目标更新X秒后误差仍不符合条件时再进行微步调节
// {
// if( (pvx->bias > pvx->bias_area) && (pvx->bias < BIAS_MAX) ) //正偏差(目标-实际),输出偏小
// {
// pvx->current_input += ((pvx->bias < 1))?(pvx->cstep_gasin):(pvx->cstep_gasin*3);
//
// pvx->current_input = (pvx->current_input <= pvx->cstep_max)?(pvx->current_input):(pvx->cstep_max); //dac输出限幅
// pvx->current_input = (pvx->current_input <= pvx->input_max)?(pvx->current_input):(pvx->input_max);
//
// pvx->pvout(pvx->current_input);
// }
//
// if( (pvx->bias < -pvx->bias_area) && (pvx->bias > -BIAS_MAX) ) //负偏差(目标-实际),输出偏大
// {
// pvx->current_input -= ((pvx->bias > -1))?(pvx->cstep_gasin):(pvx->cstep_gasout*3);
//
// pvx->current_input = (pvx->current_input >= pvx->cstep_min)?(pvx->current_input):(pvx->cstep_min); //dac输出限幅
// pvx->current_input = (pvx->current_input >= pvx->input_min)?(pvx->current_input):(pvx->input_min);
//
// pvx->pvout(pvx->current_input);
// }
// }
//
//}