1、更改了寻脉流程,先中间寻脉,自动停止,然后左寻脉,停止,再右寻脉,停止

2、提升的过程中,先左右提升,再提升中间的,这样在下次寻脉时,可以中间找到脉后停止,其他两个开始找脉
main
shuo zheng 2026-02-26 22:59:29 +08:00
parent 557dcffd18
commit d539601d50
29 changed files with 892 additions and 855 deletions

Binary file not shown.

View File

@ -21,15 +21,15 @@ Target DLL: STLink\ST-LINKIII-KEIL_SWO.dll V2.0.18.0
Dialog DLL: TCM.DLL V1.21.0.0
<h2>Project:</h2>
E:\CGY_2026\GIT\sensor_2026 - 副本\USER\USART.uvprojx
Project File Date: 02/22/2026
E:\CGY_2026\GIT\sensor_2026\USER\USART.uvprojx
Project File Date: 02/26/2026
<h2>Output:</h2>
*** Using Compiler 'V5.06 update 4 (build 422)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
Build target 'USART'
compiling main.c...
linking...
Program Size: Code=6820 RO-data=424 RW-data=120 ZI-data=1024
Program Size: Code=6920 RO-data=424 RW-data=120 ZI-data=1024
FromELF: creating hex file...
"..\OBJ\USART.axf" - 0 Error(s), 0 Warning(s).

View File

@ -3,7 +3,7 @@
<title>Static Call Graph - [..\OBJ\USART.axf]</title></head>
<body><HR>
<H1>Static Call Graph for image ..\OBJ\USART.axf</H1><HR>
<BR><P>#&#060CALLGRAPH&#062# ARM Linker, 5060422: Last Updated: Wed Feb 25 11:07:10 2026
<BR><P>#&#060CALLGRAPH&#062# ARM Linker, 5060422: Last Updated: Thu Feb 26 22:22:58 2026
<BR><P>
<H3>Maximum Stack Usage = 124 bytes + Unknown(Cycles, Untraceable Function Pointers)</H3><H3>
Call chain for Maximum Stack Depth:</H3>
@ -780,7 +780,7 @@ Global Symbols
<BR>[Called By]<UL><LI><a href="#[5c]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;main
</UL>
<P><STRONG><a name="[5c]"></a>main</STRONG> (Thumb, 742 bytes, Stack size 16 bytes, main.o(i.main))
<P><STRONG><a name="[5c]"></a>main</STRONG> (Thumb, 842 bytes, Stack size 16 bytes, main.o(i.main))
<BR><BR>[Stack]<UL><LI>Max Depth = 124<LI>Call Chain = main &rArr; uart6_init &rArr; USART_Init &rArr; RCC_GetClocksFreq
</UL>
<BR>[Calls]<UL><LI><a href="#[87]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;uart6_init

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -218,6 +218,8 @@ int main(void)
int16_t adc2_current =0;
int16_t adc3_current =0; //三路脉的当前值
u8 ch =0; //诊脉动作通道选择
uint8_t frame_updata[6] = {0x30,0x30,0x30,0x30,0x30,0x30};
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//设置系统中断优先级分组2
delay_init(168); //延时初始化
@ -249,9 +251,10 @@ int main(void)
__enable_irq();
//=======================================================================
L_Motor_Control(MOTOR_REVERSE);
M_Motor_Control(MOTOR_REVERSE);
R_Motor_Control(MOTOR_REVERSE);
delay_ms(2000);
delay_ms(500);
M_Motor_Control(MOTOR_REVERSE);
delay_ms(500);
L_Motor_Control(MOTOR_STOP);
M_Motor_Control(MOTOR_STOP);
R_Motor_Control(MOTOR_STOP); //上电初始化后,先将电机提升到上位,不一定是到顶,这个可以后期待定
@ -425,6 +428,7 @@ int main(void)
if(g_usart6_rx_buf[3]==0xaa)
{
start_vein_flg =1; //寻脉启动标志
ch = 0; //从中间开始寻
}
if(g_usart6_rx_buf[3]==0x55)
{
@ -432,7 +436,7 @@ int main(void)
}
if(g_usart6_rx_buf[3]==0xff)
{
start_vein_flg =0; //停止诊脉,电机提升后停止
start_vein_flg =3; //停止诊脉,电机提升后停止
}
//可以增加指令,指导电机在诊脉过程中进行浮中沉脉的动作
}
@ -441,43 +445,70 @@ int main(void)
//以下是自动控制部分,是否要转移到定制中断中处理?
if(start_vein_flg == 1)
{
if((adc1_current-adc1_zoo)<= D_value)
switch(ch)
{
L_Motor_Control(MOTOR_FORWARD); //电机1正传
}
else
{
L_Motor_Control(MOTOR_STOP); //电机1停止
}
case 0:
if((adc2_current-adc2_zoo)<= D_value)
{
M_Motor_Control(MOTOR_FORWARD); //电机2正传
}
else
{
M_Motor_Control(MOTOR_STOP); //电机2停止
}
if((adc2_current-adc2_zoo)<= D_value)
{
M_Motor_Control(MOTOR_FORWARD); //电机2正传
}
else
{
M_Motor_Control(MOTOR_STOP); //电机2停止
ch = 1;
}
break;
if((adc1_current-adc1_zoo)<= D_value)
{
R_Motor_Control(MOTOR_FORWARD); //电机3正传
}
else
{
R_Motor_Control(MOTOR_STOP); //电机3停止
//-------------------------------------------------------
case 1:
if((adc1_current-adc1_zoo)<= D_value)
{
L_Motor_Control(MOTOR_FORWARD); //电机1正传
}
else
{
L_Motor_Control(MOTOR_STOP); //电机1停止
ch = 2;
}
break;
//--------------------------------------------------------
case 2:
if((adc3_current-adc3_zoo)<= D_value)
{
R_Motor_Control(MOTOR_FORWARD); //电机3正传
}
else
{
R_Motor_Control(MOTOR_STOP); //电机3停止
ch = 3;
}
break;
}
}
if(start_vein_flg == 0) //停止
if(start_vein_flg == 3) //停止 停诊时,应左右两个电机回的高,中间的回的少,使中间突出一些
{
L_Motor_Control(MOTOR_REVERSE);
M_Motor_Control(MOTOR_REVERSE);
R_Motor_Control(MOTOR_REVERSE);
delay_ms(2000);
delay_ms(500);
M_Motor_Control(MOTOR_REVERSE);
delay_ms(1000);
L_Motor_Control(MOTOR_STOP);
M_Motor_Control(MOTOR_STOP);
R_Motor_Control(MOTOR_STOP); //停止诊脉后电机提升
R_Motor_Control(MOTOR_STOP); //停止诊脉后电机提升后slide 也做提升动作
start_vein_flg =0;
}
//-------------------------------------------------------------------------------
//工作流程
//1、启动诊脉过程左右前后移动 通过slide板 控制X轴和Y轴的动作通过摄像头找位置)
//2、找到大概位置后slide板控制Z轴向下找到中间位置的脉后Z轴停止
//3、开始左找脉sensor板控制电机向下slide 控制姿态电机,找到正确脉
//4、左找到脉后右脉就已经定位了
//5、开始诊脉
//==============================================================
//以下是ADC采集

View File

@ -3,6 +3,12 @@
3、完成通过ADC值控制电机的向下运行并停止
4、问题PWM控制电机的过程中单步可以运转全速不动作中断发现停止的时间比运行的时间长这个有待进一步调试
2026.02.26
1、更改了寻脉流程先中间寻脉自动停止然后左寻脉停止再右寻脉停止
2、提升的过程中先左右提升再提升中间的这样在下次寻脉时可以中间找到脉后停止其他两个开始找脉