📄 key.bak
字号:
ES=0;
dprintf(42,0,"0000",0);
dprintf(84,0,"0000",0);
dprintf(42,1,"000",0);
dprintf(84,1,"000",0);
}
void Turnaround_CornerORPower_SendORnot()
{
Ch1k=Ch2k=0;
CH1_init();
Ch1k=filter(1);
CH2_init();
Ch2k=filter(0);
dprintf(0,0,"转角:",0);
draw_bmp(33,0,8,Left);
draw_bmp(75,0,8,Right);
dprintf(0,1,"转矩:",0);
draw_bmp(33,1,8,Left);
draw_bmp(75,1,8,Right);
if(Ch1k>Ck1)
{
Nt1=(360.0/abs(Turnaround_Corner_360-Turnaround_Corner_0))*abs(Ch1k-Ck1);
k_ch1a=(int)Nt1;
AD_getvalue1[count1]=k_ch1a;
count1++;
if(count1==2)
count1=1;
max1=AD_getvalue1[0];
for(i=1;i<2;i++)
{
if(AD_getvalue1[i]>max1)
max1=AD_getvalue1[i];
}
k_max1a=max1;
AD_getvalue1[0]=k_max1a;
display_num(1,76,0,0,1,k_max1a);
}
else if(Ch1k<Ck1)
{
Nt2=(360.0/abs(Turnaround_Corner_360-Turnaround_Corner_0))*abs(Ch1k-Ck1);
k_ch1b=(int)Nt2;
AD_getvalue2[count2]=k_ch1b;
count2++;
if(count2==2)
count2=1;
max2=AD_getvalue2[0];
for(i=1;i<2;i++)
{
if(AD_getvalue2[i]>max2)
max2=AD_getvalue2[i];
}
k_max1b=max2;
AD_getvalue2[0]=k_max1b;
display_num(1,34,0,0,1,k_max1b);
}
else if(Ch1k==Ck1)
{
dprintf(42,0,"0000",0);
dprintf(84,0,"0000",0);
}
Turnaround_CornerORPower_Value2[0]=k_max1a/256;
Turnaround_CornerORPower_Value2[1]=k_max1a%256;
Turnaround_CornerORPower_Value2[2]=k_max1b/256;
Turnaround_CornerORPower_Value2[3]=k_max1b%256;
//Nt=(40.0*(abs(Ch2k-Turnaround_Power_0)))/(abs(Turnaround_Power_200-Turnaround_Power_0));
if(Ch2k>Turnaround_Power_0)
{
//Nt3=(40.0/abs(Turnaround_Power_200-Turnaround_Power_0))*abs(Ch2k-Ck2);
Nt3=(40.0*(abs(Ch2k-Turnaround_Power_0)))/(abs(Turnaround_Power_200-Turnaround_Power_0));
k_ch2a=(int)Nt3;
AD_getvalue3[count3]=k_ch2a;
count3++;
if(count3==2)
count3=1;
max3=AD_getvalue3[0];
for(i=1;i<2;i++)
{
if(AD_getvalue3[i]>max3)
max3=AD_getvalue3[i];
}
k_max2a=max3;
AD_getvalue3[0]=k_max2a;
//void display_num1(uchar beginaddre,uchar cole,uint k);
// display_num1(84,1,k_max2a,1);
display_num(1,68,1,0,0,k_max2a);
}
else if(Ch2k<Turnaround_Power_0)
{
Nt4=(40.0*(abs(Ch2k-Turnaround_Power_0)))/(abs(Turnaround_Power_200-Turnaround_Power_0));
k_ch2b=(int)Nt4;
AD_getvalue4[count4]=k_ch2b;
count4++;
if(count4==2)
count4=1;
max4=AD_getvalue4[0];
for(i=1;i<2;i++)
{
if(AD_getvalue4[i]>max4)
max4=AD_getvalue4[i];
}
k_max2b=max4;
AD_getvalue4[0]=k_max2b;
// display_num1(42,1,k_max2b,1);
display_num(1,26,1,0,0,k_max2b);
}
else if(Ch2k==Turnaround_Power_0)
{
dprintf(42,1,"000",0);
dprintf(84,1,"000",0);
}
Turnaround_CornerORPower_Value3[0]=k_max2a/256;
Turnaround_CornerORPower_Value3[1]=k_max2a%256;
Turnaround_CornerORPower_Value3[2]=k_max2b/256;
Turnaround_CornerORPower_Value3[3]=k_max2b%256;
}
void Turnaround_CornerORPower_SendValue()
{
Ch1k=Ch2k=0;
CH1_init();
Ch1k=filter(1);
CH2_init();
Ch2k=filter(0);
dprintf(0,0,"转角:",0);
draw_bmp(33,0,8,Left);
draw_bmp(75,0,8,Right);
dprintf(0,1,"转矩:",0);
draw_bmp(33,1,8,Left);
draw_bmp(75,1,8,Right);
Nt1=(360.0/abs(Turnaround_Corner_360-Turnaround_Corner_0))*abs(Ch1k-Ck1);
k_ch1a=(int)Nt1;
if(Ch1k>Ck1)
{
k_max1a=k_ch1a;
display_num(1,76,0,0,1,k_ch1a);
dprintf(42,0,"0000",0);
Turnaround_CornerORPower_Value2[0]=k_max1a/256;
Turnaround_CornerORPower_Value2[1]=k_max1a%256;
Turnaround_CornerORPower_Value2[2]=0;
Turnaround_CornerORPower_Value2[3]=0;
}
if(Ch1k<Ck1)
{
k_max1a=k_ch1a;
display_num(1,34,0,0,1,k_max1a);
dprintf(84,0,"0000",0);
Turnaround_CornerORPower_Value2[0]=0;
Turnaround_CornerORPower_Value2[1]=0;
Turnaround_CornerORPower_Value2[2]=k_max1a/256;
Turnaround_CornerORPower_Value2[3]=k_max1a%256;
}
if(Ch1k==Ck1)
{
dprintf(42,0,"0000",0);
dprintf(84,0,"0000",0);
Turnaround_CornerORPower_Value2[0]=0;
Turnaround_CornerORPower_Value2[1]=0;
Turnaround_CornerORPower_Value2[2]=0;
Turnaround_CornerORPower_Value2[3]=0;
}
Nt1=(40.0*(abs(Ch2k-Turnaround_Power_0)))/(abs(Turnaround_Power_200-Turnaround_Power_0));
k_ch1a=(int)Nt1;
if(Ch2k>Turnaround_Power_0)
{
k_max1a=k_ch1a;
//display_num1(84,1,k_max1a,1);
display_num(1,68,1,0,0,k_max1a);
dprintf(42,1,"000",0);
Turnaround_CornerORPower_Value3[0]=k_max1a/256;
Turnaround_CornerORPower_Value3[1]=k_max1a%256;
Turnaround_CornerORPower_Value3[2]=0;
Turnaround_CornerORPower_Value3[3]=0;
}
if(Ch2k<Turnaround_Power_0)
{
k_max1a=k_ch1a;
//display_num1(42,1,k_max1a,1);
display_num(1,26,1,0,0,k_max1a);
dprintf(84,1,"000",0);
Turnaround_CornerORPower_Value3[0]=0;
Turnaround_CornerORPower_Value3[1]=0;
Turnaround_CornerORPower_Value3[2]=k_max1a/256;
Turnaround_CornerORPower_Value3[3]=k_max1a%256;
}
if(Ch2k==Turnaround_Power_0)
{
dprintf(42,1,"000",0);
dprintf(84,1,"000",0);
Turnaround_CornerORPower_Value3[0]=0;
Turnaround_CornerORPower_Value3[1]=0;
Turnaround_CornerORPower_Value3[2]=0;
Turnaround_CornerORPower_Value3[3]=0;
}
SetSerio=1;
send_char(0xaa); //左转角
delay();
send_string_com(Turnaround_CornerORPower_Value2,2);
delay();
send_char(0xbb); //右转角
send_string_com(Turnaround_CornerORPower_Value2+2,2);
delay();
send_char(0xcc); //左转矩
delay();
send_string_com(Turnaround_CornerORPower_Value3,2);
delay();
send_char(0xdd); //右转矩
send_string_com(Turnaround_CornerORPower_Value3+2,2);
Turnaround_CornerORPower_Value2[0]=0;
Turnaround_CornerORPower_Value2[1]=0;
Turnaround_CornerORPower_Value2[2]=0;
Turnaround_CornerORPower_Value2[3]=0;
Turnaround_CornerORPower_Value3[0]=0;
Turnaround_CornerORPower_Value3[1]=0;
Turnaround_CornerORPower_Value3[2]=0;
Turnaround_CornerORPower_Value3[3]=0;
k_max1a=0;
}
uint filter_biaoding(bit CHX)
{
uint sum,Read_Ad;
uchar i;
sum=0;
for(i=0;i<10;i++)
{
Read_Ad=ReadDataCh1_Ch2(CHX);
sum+=Read_Ad;
Read_Ad=0;
}
return (int)(sum/10.0);
}
void Test_Case_9()
{
lcd_clr1(0,0,16,1);
lcd_clr1(1,0,16,1);
lcd_clr1(0,49,12,1);
lcd_clr1(1,49,12,1);
lcd_clr1(0,0,20,0);
lcd_clr1(1,0,20,0);
lcd_clr1(0,52,12,0);
lcd_clr1(1,52,12,0);
lcd_clr1(2,59,2,0);
lcd_clr1(3,59,2,0);
countclr++;
if(countclr==50)
{
countclr=0;
lcd_clr();
}
draw_bmp(17,0,16,Biao);
draw_bmp(33,0,16,Ding);
draw_bmp(81,0,16,Zeng);
draw_bmp(97,0,16,Chang);
draw_bmp(0,1,16,Zhuan);
draw_bmp(15,1,16,Jue);
draw_bmp(65,1,16,Zhuan);
draw_bmp(81,1,16,Ju);
// if(serio_data==0xee)
Ch1k=Ch2k=0;
CH1_init();
Ch1k=filter(1);
delay();
CH2_init();
Ch2k=filter(0);
Nt=(360.000*(abs(Ch1k-Turnaround_Corner_0)))/(abs(Turnaround_Corner_360-Turnaround_Corner_0));
k_1=(int)Nt;
display_num(1,23,1,0,1,k_1);
if(Ch1k>Turnaround_Corner_0)
{
Turnaround_CornerValue1[0]=k_1/256;
Turnaround_CornerValue1[1]=k_1%256;
Turnaround_CornerValue1[2]=0;
Turnaround_CornerValue1[3]=0;
}
else
{
Turnaround_CornerValue1[2]=k_1/256;
Turnaround_CornerValue1[3]=k_1%256;
Turnaround_CornerValue1[0]=0;
Turnaround_CornerValue1[1]=0;
}
Nt=(40.000*(abs(Ch2k-Turnaround_Power_0)))/(abs(Turnaround_Power_200-Turnaround_Power_0));
k_1=(int)Nt;
//display_num1(97,1,k_1,1);
display_num(1,81,1,0,0,k_1);
if(Ch2k>Turnaround_Power_0)
{
Turnaround_Power_Value2[0]=k_1/256;
Turnaround_Power_Value2[1]=k_1%256;
Turnaround_Power_Value2[2]=0;
Turnaround_Power_Value2[3]=0;
}
else
{
Turnaround_Power_Value2[2]=k_1/256;
Turnaround_Power_Value2[3]=k_1%256;
Turnaround_Power_Value2[0]=0;
Turnaround_Power_Value2[1]=0;
}
serio_data=0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -