谁知道这是什么原因
int T1;T1=(m_nT1/1000)-1;
int T2;
T2=(m_nT2/1000)-1;
int i=1;
int T3=m_nT1;
int T4=m_nT2;
int Tc=m_n04;
int dir2 = m_bDir?1:-1;
int Na1=m_bDir2?1:0;
int Nb1=m_bDir3?1:0;
int Nc1=m_bDir4?1:0;
int Nd1=m_bDir5?1:0;
int Ne1=m_bDir6?1:0;
int Na2=m_bDir7?1:0;
int Nb2=m_bDir8?1:0;
int Nc2=m_bDir9?1:0;
int Nd2=m_bDir10?1:0;
int Ne2=m_bDir11?1:0;
double m_fAccel=0;
if(Na1==1)
{
static CString string_111;
string_111.Format("位置:%s","O→A");
GetDlgItem( IDC_STATIC_weizhi )->SetWindowText( string_111 );
d1000_start_t_move( 0, 33600*dir2,6400,6400, m_fAccel );
Sleep(5250);////////////////由O到A
static CString string_112;
string_112.Format("位置:%c",'A');
GetDlgItem( IDC_STATIC_weizhi )->SetWindowText( string_112 );
loop1: while (i<=m_n03)
{
CString str;
str.Format("%d", i);
CWnd* pwnd = this->GetDlgItem(IDC_STATIC_TM);
pwnd->SetWindowText(str);
while(T1>=0)
{
Sleep(1000);
CString str;
str.Format("%d", T1);
CWnd* pwnd = this->GetDlgItem(IDC_STATIC_daojishi);
pwnd->SetWindowText(str);
T1--;
}
T1=(m_nT1/1000)-1;
if(Nb2==1)
{
static CString string_121;
string_121.Format("位置:%s","A→B");
GetDlgItem( IDC_STATIC_weizhi )->SetWindowText( string_121 );
d1000_start_t_move( 0, 86400*dir2,6400,6400, m_fAccel );
Sleep(13500);////////////////////////A----B
static CString string_122;
string_122.Format("位置:%c",'B');
GetDlgItem( IDC_STATIC_weizhi )->SetWindowText( string_122 );
while(T2>=0)
{
Sleep(1000);
CString str;
str.Format("%d", T2);
CWnd* pwnd = this->GetDlgItem(IDC_STATIC_daojishi);
pwnd->SetWindowText(str);
T2--;
}
T2=(m_nT2/1000)-1;
static CString string_123;
string_123.Format("位置:%s","B→A");
GetDlgItem( IDC_STATIC_weizhi )->SetWindowText( string_123 );
d1000_start_t_move( 0, -86400*dir2,6400,6400, m_fAccel );
Sleep(13500);////////////////////////B----A
static CString string_124;
string_124.Format("位置:%c",'A');
GetDlgItem( IDC_STATIC_weizhi )->SetWindowText( string_124 );
}
if(Nc2==1)
{
static CString string_131;
string_131.Format("位置:%s","A→C");
GetDlgItem( IDC_STATIC_weizhi )->SetWindowText( string_131 );
d1000_start_t_move( 0, 150400*dir2,6400,6400, m_fAccel );
Sleep(23500);////////////////由A到C
static CString string_132;
string_132.Format("位置:%c",'C');
GetDlgItem( IDC_STATIC_weizhi )->SetWindowText( string_132);
while(T2>=0)
{
Sleep(1000);
CString str;
str.Format("%d", T2);
CWnd* pwnd = this->GetDlgItem(IDC_STATIC_daojishi);
pwnd->SetWindowText(str);
T2--;
}
T2=(m_nT2/1000)-1;
static CString string_133;
string_133.Format("位置:%s","C→A");
GetDlgItem( IDC_STATIC_weizhi )->SetWindowText( string_133 );
d1000_start_t_move( 0, -150400*dir2,6400,6400, m_fAccel );
Sleep(23500);////////////////由C到A
static CString string_134;
string_134.Format("位置:%c",'A');
GetDlgItem( IDC_STATIC_weizhi )->SetWindowText( string_134);
}
if(Ne2==1)
{
static CString string_141;
string_141.Format("位置:%s","A→E");
GetDlgItem( IDC_STATIC_weizhi )->SetWindowText( string_141);
d1000_start_t_move( 0, 172000*dir2,6400,6400, m_fAccel );
Sleep(26875);////////////////由A到E
static CString string_142;
string_142.Format("位置:%c",'E');
GetDlgItem( IDC_STATIC_weizhi )->SetWindowText( string_142);
while(T2>=0)
{
Sleep(1000);
CString str;
str.Format("%d", T2);
CWnd* pwnd = this->GetDlgItem(IDC_STATIC_daojishi);
pwnd->SetWindowText(str);
T2--;
}
T2=(m_nT2/1000)-1;
static CString string_143;
string_143.Format("位置:%s","E→A");
GetDlgItem( IDC_STATIC_weizhi )->SetWindowText( string_143);
d1000_start_t_move( 0, -172000*dir2,6400,6400, m_fAccel );
Sleep(26875);////////////////由E到A
static CString string_144;
string_144.Format("位置:%c",'A');
GetDlgItem( IDC_STATIC_weizhi )->SetWindowText( string_144);
}
if(Nd2==1)
{
static CString string_151;
string_151.Format("位置:%s","A→D");
GetDlgItem( IDC_STATIC_weizhi )->SetWindowText( string_151 );
d1000_start_t_move( 0, 193600*dir2, 6400, 6400, m_fAccel );
Sleep(30250);////////////////由A到D
static CString string_152;
string_152.Format("位置:%c",'D');
GetDlgItem( IDC_STATIC_weizhi )->SetWindowText( string_152);
while(T2>=0)
{
Sleep(1000);
CString str;
str.Format("%d", T2);
CWnd* pwnd = this->GetDlgItem(IDC_STATIC_daojishi);
pwnd->SetWindowText(str);
T2--;
}
T2=(m_nT2/1000)-1;
static CString string_153;
string_153.Format("位置:%s","D→A");
GetDlgItem( IDC_STATIC_weizhi )->SetWindowText( string_153 );
d1000_start_t_move( 0, 193600*dir2, 6400, 6400, m_fAccel );
Sleep(30250);////////////////由D到A
static CString string_154;
string_154.Format("位置:%c",'A');
GetDlgItem( IDC_STATIC_weizhi )->SetWindowText( string_154);
}
i++;
goto loop1;
}
static CString string_155;
string_155.Format("位置:%s","A→O");
GetDlgItem( IDC_STATIC_weizhi )->SetWindowText( string_155 );
*******************注意从这里: d1000_start_t_move( 0, -33600*dir2,6400,6400, m_fAccel );
Sleep(5250);/////////////////回到O点***********************************:到这里这两句电机本来该转的却没转,为什么?
static CString string_156;
string_156.Format("位置:%c",'O');
GetDlgItem( IDC_STATIC_weizhi )->SetWindowText( string_156);
}
MessageBox("执行完毕");
return;
}
void CFE_1Dlg::OnCancel()
{
if( d1000_check_done( 0 ) == 0 )//在运行
{//立即停止
d1000_immediate_stop(0);
return;
}
}
void CFE_1Dlg::UpdateControl()
{
GetDlgItem( IDC_CHECK1)->SetWindowText( m_bDir?"驱动方向:正":"驱动方向:反");
}
void CFE_1Dlg::OnCheck1()
{
UpdateData( TRUE );
UpdateControl();
}
void CFE_1Dlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
static CString string ;
static CString cs;
string.Format(" 位置:%ld",long( d1000_get_command_pos( 0 )));
GetDlgItem( IDC_STATIC_weizhi )->SetWindowText( string );
CDialog::OnTimer(nIDEvent);
}
void CFE_1Dlg::OnCheck2()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
UpdateControl();
}
void CFE_1Dlg::OnCheck3()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
UpdateControl();
}
void CFE_1Dlg::OnCheck4()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
UpdateControl();
}
void CFE_1Dlg::OnCheck5()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
UpdateControl();
}
void CFE_1Dlg::OnCheck6()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
UpdateControl();
}
void CFE_1Dlg::OnCheck7()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
UpdateControl();
}
void CFE_1Dlg::OnCheck8()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
UpdateControl();
}
void CFE_1Dlg::OnCheck9()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
UpdateControl();
}
void CFE_1Dlg::OnCheck10()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
UpdateControl();
}
void CFE_1Dlg::OnCheck11()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
UpdateControl();
}
void CFE_1Dlg::OnButton2()
{
// TODO: Add your control notification handler code here
if(!UpdateData(TRUE))return;
if( d1000_check_done( 0 ) == 0 ) return;//若在运行,则返回
d1000_start_t_move( 0, -1000000, 6400, 6400, 0.5);
}
void CFE_1Dlg::OnButton3()
{
// TODO: Add your control notification handler code here
if(!UpdateData(TRUE))return;
if( d1000_check_done( 0 ) == 0 ) return;//若在运行,则返回
int dir9=m_bDir?1:-1;
d1000_start_t_move( 0, m_n06*dir9, 3200, 3200, 0.1);
}