diff --git a/PcDmis/Base/Interfac/Msi/Hsi/ART/ART_PCI8622.cpp b/PcDmis/Base/Interfac/Msi/Hsi/ART/ART_PCI8622.cpp index 6cbd3f6..c50ff34 100644 --- a/PcDmis/Base/Interfac/Msi/Hsi/ART/ART_PCI8622.cpp +++ b/PcDmis/Base/Interfac/Msi/Hsi/ART/ART_PCI8622.cpp @@ -372,10 +372,22 @@ BOOL CART_PCI8622::GetData(double (*_Data)[HALF_SIZE_WORDS],int* _DataNumber) case E_ART_PCI8622_SAMPLE_NPT_SEQ: case E_ART_PCI8622_SAMPLE_NPT_TRIGCLK: { + PCI8622_STATUS_AD ADStatus; + if(!PCI8622_GetDevStatusProAD(m_hDevice, &ADStatus)) + { + rStatus=FALSE; + break; + } m_SegmentID=0; LONG nReadSizeWords = m_iReadDataSize; LONG nRetSizeWords(0); PCI8622_ReadDeviceProAD_Npt(m_hDevice, ADBuffer[m_SegmentID], nReadSizeWords, &nRetSizeWords); + + if(!PCI8622_GetDevStatusProAD(m_hDevice, &ADStatus)) + { + rStatus=FALSE; + break; + } nADChannel = m_ADPara.FirstChannel; TRACE1("[PCI8622_ReadDeviceProAD_Npt] Retsize:%d.\r\n",nRetSizeWords); for(Index=0; Index_send_cmd_SO7_CMD_TRIG_PULSE_START(); - char _Gear(3); - _Gear=m_pSO7_Proto->g_machine.x._Move_Speed_Gear; - m_pSO7_Proto->g_machine.x._MoveTo_Speed_Gear=_Gear; - m_pSO7_Proto->g_machine.y._MoveTo_Speed_Gear=_Gear; - m_pSO7_Proto->g_machine.z._MoveTo_Speed_Gear=_Gear; + Sleep(50); + m_SetGear(false); m_pSO7_Proto->so7_motion_set_position_xyz(m_EndPos[0],m_EndPos[1],m_EndPos[2],false); - if (m_TestTimes>1) + if (m_TestTimes>=1) { - SetTimer(1,500,NULL); + SetTimer(1,m_Timer1Interval,NULL); } } //===================================================================== @@ -218,6 +217,23 @@ void CSo7_Util_External_Trig::OnBnClickedButtonSo7ExtrigGetPara() } m_UpdatePara(FALSE); } +//===================================================================== +void CSo7_Util_External_Trig::m_SetGear(bool bDefault) +{ + if(bDefault) + { + m_pSO7_Proto->g_machine.x._MoveTo_Speed_Gear=0; + m_pSO7_Proto->g_machine.y._MoveTo_Speed_Gear=0; + m_pSO7_Proto->g_machine.z._MoveTo_Speed_Gear=0; + } + else + { + m_pSO7_Proto->g_machine.x._MoveTo_Speed_Gear=m_pSO7_Proto->g_machine.x._Move_Speed_Gear; + m_pSO7_Proto->g_machine.y._MoveTo_Speed_Gear=m_pSO7_Proto->g_machine.x._Move_Speed_Gear; + m_pSO7_Proto->g_machine.z._MoveTo_Speed_Gear=m_pSO7_Proto->g_machine.x._Move_Speed_Gear; + } +} + //===================================================================== void CSo7_Util_External_Trig::m_UpdateCtrls(int _type) { @@ -288,7 +304,7 @@ void CSo7_Util_External_Trig::m_UpdatePara(BOOL _bSave) CString csTmp; const char* cTmp; double dResolution(0.5); - double dEndPos(0.5); + double dEndPos(1.0); double dTmp(0.0); ((CEdit*)GetDlgItem(IDC_EDIT_SO7_EXTRIG_TEST_TIMES))->GetWindowTextW(csTmp); @@ -321,7 +337,7 @@ void CSo7_Util_External_Trig::m_UpdatePara(BOOL _bSave) dTmp=atof(cTmp); m_TrigPara[0] = static_cast(m_pSO7_Proto->MMtoScale(dTmp,dResolution)); iParaNumber=1; - dEndPos=10.0; + dEndPos+=m_ParaNumber*dTmp; } else { @@ -371,6 +387,42 @@ void CSo7_Util_External_Trig::m_UpdatePara(BOOL _bSave) } } //===================================================================================== +void CSo7_Util_External_Trig::m_ReadTrigPara(short _Index,int _type) +{ + if (_type==0) + { + BYTE cdata[5]={0}; + m_pSO7_Proto->_send_cmd_SO7_CMD_READ_DATA_FROM_FPGA(m_ActiveAxis,12); + cdata[0]=static_cast(m_pSO7_Proto->g_machine.FPGAData); + m_pSO7_Proto->_send_cmd_SO7_CMD_READ_DATA_FROM_FPGA(m_ActiveAxis,10); + cdata[1]=static_cast(m_pSO7_Proto->g_machine.FPGAData); + m_pSO7_Proto->_send_cmd_SO7_CMD_READ_DATA_FROM_FPGA(m_ActiveAxis,13); + cdata[2]=static_cast(m_pSO7_Proto->g_machine.FPGAData); + m_pSO7_Proto->_send_cmd_SO7_CMD_READ_DATA_FROM_FPGA(m_ActiveAxis,14); + cdata[3]=static_cast(m_pSO7_Proto->g_machine.FPGAData); + m_pSO7_Proto->_send_cmd_SO7_CMD_READ_DATA_FROM_FPGA(m_ActiveAxis,15); + cdata[4]=static_cast(m_pSO7_Proto->g_machine.FPGAData); + int WData(0),HoldTime(0),CurSate(0),ErrPos(0); + WData=(cdata[0]*256)+cdata[1]; + HoldTime=cdata[2]; + CurSate=((cdata[3]&0xE0)/32); + ErrPos=((cdata[3]&0x1F)*256)+cdata[4]; + + m_csMsg.Format(_T("WData=%d,HoldTime=%d,State=%d,ErrPos=%d.\r\n"), + WData,HoldTime,CurSate,ErrPos); + OutputWithScroll(m_csMsg,m_EdMsg); + } + if (_type==1) + { + m_pSO7_Proto->_send_cmd_SO7_CMD_READ_TRIG_PULSE_PARA(_Index); + m_csMsg.Format(_T("[Read Trig Para]:R Axis=%d,Method=%d,TotalNo=%d,CurIndex=%d,Para[%d]=%d."),m_pSO7_Proto->g_machine.TrigPara.TrigPulseActiveAxis, + m_pSO7_Proto->g_machine.TrigPara.TrigPulseMethod,m_pSO7_Proto->g_machine.TrigPara.TrigTotalNo._long_, + m_pSO7_Proto->g_machine.TrigPara.TrigCurIndex._long_,static_cast(m_pSO7_Proto->g_machine.TrigPara.TrigReadIndex._long_), + m_pSO7_Proto->g_machine.TrigPara.TrigReadPara._long_); + OutputWithScroll(m_csMsg,m_EdMsg); + } +} +//===================================================================================== void CSo7_Util_External_Trig::m_StartTrig() { short iParaNumber(0); @@ -421,13 +473,18 @@ void CSo7_Util_External_Trig::m_StartTrig() m_csMsg.Format(_T("[Write Trig Para]:R TotalNo=%d"),m_pSO7_Proto->g_machine.TrigPara.TrigTotalNo); OutputWithScroll(m_csMsg,m_EdMsg); m_pSO7_Proto->_send_cmd_SO7_CMD_TRIG_PULSE_START(); - Sleep(20); + Sleep(50); + m_SetGear(false); m_pSO7_Proto->so7_motion_set_position_xyz(m_EndPos[0],m_EndPos[1],m_EndPos[2],false); } //===================================================================================== void CSo7_Util_External_Trig::m_StopTrig() { + int index(65535); + m_ReadTrigPara(0,0); + m_ReadTrigPara(static_cast(index),1); m_pSO7_Proto->_send_cmd_SO7_CMD_TRIG_PULSE_STOP(); + m_SetGear(true); m_pSO7_Proto->so7_motion_set_position_xyz(m_BeginPos[0],m_BeginPos[1],m_BeginPos[2],false); } //===================================================================================== @@ -466,26 +523,43 @@ void CSo7_Util_External_Trig::OnTimer(UINT_PTR nIDEvent) { case 1: { - bool Isfinished(false); - m_pSO7_Proto->so7_Motion_XYZ_IsMotionFinished(Isfinished); - if(Isfinished) + if(m_TestTimes>1) { - if (m_CurTestCnt%2==0) + bool Isfinished(false); + m_pSO7_Proto->so7_Motion_XYZ_IsMotionFinished(Isfinished); + if(Isfinished) { - m_StopTrig(); - } + if (m_CurTestCnt%2==0) + { + m_StopTrig(); + } + else + { + m_StartTrig(); + } + m_CurTestCnt++; + + if(m_CurTestCnt>=(2*m_TestTimes-1)) + { + OnBnClickedButtonSo7ExtrigStop(); + } + } else { - m_StartTrig(); + m_ReadTrigPara(0,0); } - m_CurTestCnt++; } - if(m_CurTestCnt>=2*m_TestTimes) + else { - OnBnClickedButtonSo7ExtrigStop(); + m_ReadTrigPara(0,0); } break; } } CDialog::OnTimer(nIDEvent); -} \ No newline at end of file +} + +void CSo7_Util_External_Trig::OnBnClickedButtonSo7ExtrigClearMsg() +{ + ((CEdit*)GetDlgItem(IDC_EDIT_SO7_EXTRIG_RESULT))->SetWindowTextW(_T("")); +} diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/So7_Util_External_Trig.h b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/So7_Util_External_Trig.h index 482cb55..4959c42 100644 --- a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/So7_Util_External_Trig.h +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/So7_Util_External_Trig.h @@ -39,6 +39,8 @@ protected: void m_UpdateListControl(int _type); void m_StartTrig(); void m_StopTrig(); + void m_SetGear(bool bDefault=true); + void m_ReadTrigPara(short _Index,int _type=0); int m_ParaListRows; int m_ParaListSelectedRow; int m_ParaListSelectedCol; @@ -47,6 +49,7 @@ protected: double m_EndPos[3]; int m_TestTimes; int m_CurTestCnt; + int m_Timer1Interval; public: afx_msg void OnTimer(UINT_PTR nIDEvent); afx_msg void OnBnClickedRadioSo7ExtrigEqdis(); @@ -57,4 +60,5 @@ public: afx_msg void OnBnClickedButtonSo7ExtrigSetPara(); afx_msg void OnBnClickedButtonSo7ExtrigGetPara(); afx_msg void OnBnClickedCancel(); + afx_msg void OnBnClickedButtonSo7ExtrigClearMsg(); }; diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Usb_Util.vcxproj b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Usb_Util.vcxproj index ac6818a..d8832b3 100644 --- a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Usb_Util.vcxproj +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Usb_Util.vcxproj @@ -206,7 +206,7 @@ true true MachineX86 - ..\..\..\..\..\..\..\ThirdParty\UsbSupport\LibUsb_Win\Lib\Msvc\libusb.lib;..\..\..\Videocard\SDK3000\sdk3000_7130.lib;..\..\..\Videocard\SV2000E\dataAcq.lib;..\..\..\Videocard\SV2000E\DXMediaCap.lib;..\..\..\Videocard\TC4000\Sa7134Capture.lib;..\..\..\ART\PCI8622_32.lib;..\..\..\STIL\Dll_chr.lib;%(AdditionalDependencies) + ..\..\..\..\..\..\..\ThirdParty\UsbSupport\LibUsb_Win\Lib\Msvc\libusb.lib;..\..\..\Videocard\SDK3000\sdk3000_7130.lib;..\..\..\Videocard\TC4000\Sa7134Capture.lib;..\..\..\Videocard\SV4000E\dataAcq.lib;..\..\..\Videocard\SV4000E\DXMediaCap.lib;..\..\..\ART\PCI8622_32.lib;..\..\..\STIL\Dll_chr.lib;%(AdditionalDependencies) diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/resource.h b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/resource.h index 4f61a89..96560a0 100644 --- a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/resource.h +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/resource.h @@ -666,6 +666,8 @@ #define IDC_BTN_CONFIGURE_MOVEVOUT 1544 #define IDC_BUTTON_SO7_EXTRIG_GET_PARA 1544 #define IDC_BUTTON_STOP_SCAN_KEYENCE_LK_GLASER 1545 +#define IDC_BUTTON_SO7_EXTRIG_GET_PARA2 1545 +#define IDC_BUTTON_SO7_EXTRIG_CLEAR_MSG 1545 #define IDC_BUTTON_SET_TRIGGER 1546 #define IDC_BUTTON_IMAGEDLL_GET_SCAN_LASER_DATA 1547 #define IDC_BUTTON_SO7_TEST_Z_SIGNAL 1548 @@ -1019,7 +1021,6 @@ #define IDC_EDIT_SO7_EXTRIG_EQDIS 1869 #define IDC_LIST_SO7_EXTRIG_SPECLOCATION 1870 #define IDC_EDIT_SO7_EXTRIG_TEST_TIMES 1872 -#define IDC_EDIT2 1873 #define IDC_EDIT_SO7_MOTION_STOP_CNTS 1873 #define IDC_EDIT_SO7_MOTION_START_CNTS 1874 #define IDC_BUTTON_DIY_EXIT_BUTTON 32740 diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil_VS2010.sln b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil_VS2010.sln index 527e954..57df6ab 100644 --- a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil_VS2010.sln +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil_VS2010.sln @@ -78,6 +78,7 @@ Global {A945B062-6081-49F0-992D-D14769C4C7D4}.ReleaseSO7|Mixed Platforms.ActiveCfg = Release|Win32 {A945B062-6081-49F0-992D-D14769C4C7D4}.ReleaseSO7|Mixed Platforms.Build.0 = Release|Win32 {A945B062-6081-49F0-992D-D14769C4C7D4}.ReleaseSO7|Win32.ActiveCfg = Release|Win32 + {A945B062-6081-49F0-992D-D14769C4C7D4}.ReleaseSO7|Win32.Build.0 = Release|Win32 {A945B062-6081-49F0-992D-D14769C4C7D4}.ReleaseSO7|x64.ActiveCfg = Release|Win32 {A945B062-6081-49F0-992D-D14769C4C7D4}.ReleaseSO7|x86.ActiveCfg = Release|Win32 {A945B062-6081-49F0-992D-D14769C4C7D4}.Template|Mixed Platforms.ActiveCfg = Release|Win32 @@ -101,6 +102,7 @@ Global {BF02B850-BB32-4635-9E53-8583C474884D}.ReleaseSO7|Mixed Platforms.ActiveCfg = Release|Win32 {BF02B850-BB32-4635-9E53-8583C474884D}.ReleaseSO7|Mixed Platforms.Build.0 = Release|Win32 {BF02B850-BB32-4635-9E53-8583C474884D}.ReleaseSO7|Win32.ActiveCfg = Release|Win32 + {BF02B850-BB32-4635-9E53-8583C474884D}.ReleaseSO7|Win32.Build.0 = Release|Win32 {BF02B850-BB32-4635-9E53-8583C474884D}.ReleaseSO7|x64.ActiveCfg = Release|Win32 {BF02B850-BB32-4635-9E53-8583C474884D}.ReleaseSO7|x86.ActiveCfg = Release|Win32 {BF02B850-BB32-4635-9E53-8583C474884D}.Template|Mixed Platforms.ActiveCfg = Release|Win32 diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil_VS2010.suo b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil_VS2010.suo index 9556d30..2b05046 100644 Binary files a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil_VS2010.suo and b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil_VS2010.suo differ