diff --git a/MITLIB/Dll/CommDll100D.dll b/MITLIB/Dll/CommDll100D.dll index f714bd2..4b95f54 100644 Binary files a/MITLIB/Dll/CommDll100D.dll and b/MITLIB/Dll/CommDll100D.dll differ diff --git a/MITLIB/Dll/IODll100D.dll b/MITLIB/Dll/IODll100D.dll index 19b3511..40c837d 100644 Binary files a/MITLIB/Dll/IODll100D.dll and b/MITLIB/Dll/IODll100D.dll differ diff --git a/MITLIB/Dll/SecsGem100.dll b/MITLIB/Dll/SecsGem100.dll index 5d8a2c1..d0c00f9 100644 Binary files a/MITLIB/Dll/SecsGem100.dll and b/MITLIB/Dll/SecsGem100.dll differ diff --git a/MITLIB/Dll/Utility100D.dll b/MITLIB/Dll/Utility100D.dll index 53ed69c..0ddffa5 100644 Binary files a/MITLIB/Dll/Utility100D.dll and b/MITLIB/Dll/Utility100D.dll differ diff --git a/MITLIB/Dll/mcctrdll100D.dll b/MITLIB/Dll/mcctrdll100D.dll index dd55f1b..929b76d 100644 Binary files a/MITLIB/Dll/mcctrdll100D.dll and b/MITLIB/Dll/mcctrdll100D.dll differ diff --git a/MITLIB/IODll/HardwareIni.h b/MITLIB/IODll/HardwareIni.h index 84ce006..c910e7e 100644 --- a/MITLIB/IODll/HardwareIni.h +++ b/MITLIB/IODll/HardwareIni.h @@ -17,6 +17,10 @@ #include "dsa30.h" #endif +#include + +#include + // Input Card #define PCI_7433_ADLINK 0 @@ -27,12 +31,18 @@ #define PCI_7432_ADLINK 4 // 32 in, 32 out #define PCI_9222_ADLINK 5 // AO, AI, Encoder, DI, DO card #define PCI_7856_HSL_ADLINK 6 -#define MAX_INPUT_CARD_TYPE 7 +// advantech +#define PCI_1203_ETHERCAT_IO_ADVANTECH 7 +#define MAX_INPUT_CARD_TYPE 8 // 7856 Port Definition #define PCI_7856_HSL_PORT 0 #define PCI_7856_MOTIONNET_PORT 1 +// Advantech EtherCAT Ring Definition +#define PCI_1203_MOTION_RING 0 +#define PCI_1203_IO_RING 1 + // Output Card #define PCI_7434_ADLINK 0 #define MAX_OUTPUT_CARD_TYPE MAX_INPUT_CARD_TYPE @@ -99,6 +109,8 @@ enum OUTPUT_CARD_CLOSE_RESULT #define IODLLCLASS __declspec(dllimport) #endif +class CMtrProfile; + class IODLLCLASS CHardwareIni : public CIniFile { public: @@ -128,12 +140,108 @@ private: BOOL SetIniFile(int nWhatCard); }; -struct stCard +typedef struct _stCard { - CString csCardType; + std::string strCardType; // standardise to std for portability BOOL Initialised; + // ctor + _stCard(std::string _strCardType = "NoCard", BOOL _Initialised = FALSE) + { + strCardType = _strCardType; + Initialised = _Initialised; + } +} stCard; +// +typedef union _union_uint { + unsigned int uintValue; + struct { + unsigned short lo; + unsigned short hi; + } s; + unsigned char byte[4]; + + //ctor + _union_uint() + { + uintValue = 0; + } +} union_uint; + +// Advantech EtherCAT +//Bit Definition +//0 RDY-- RDY pin input +//1 ALM -- Alarm signal input +//2 LMT+-- Limit switch+ +//3 LMT-- Limit switch- +//4 ORG-- Original switch +//5 DIR -- DIR output +//6 EMG -- Emergency signal input +//7 PCS -- PCS signal input +//8 ERC -- Output offset counter clear signal to servo motor drvier +//9 EZ -- Encoder Z signal +//10 CLR -- External output toward clear position counter +//11 LTC -- Latch signal input +//12 SD -- Deceleration signal input +//13 INP -- In-position signal input +//14 14: SVON -- Servo On (OUT6) +//15 ALRM -- Alarm reset output status +//16 SLMT+ -- Softwarte limit+ +//17 SLMT-- Softwarte limit - +//18 CMP--Compare signal +enum ACM_AX_MIO { + MIO_RDY = 0x00000001, //AX_MOTION_IO_RDY + MIO_ALM = 0x00000002, //AX_MOTION_IO_ALM + MIO_PEL = 0x00000004, //AX_MOTION_IO_LMTP + MIO_MEL = 0x00000008, + + MIO_ORG = 0x00000010, + MIO_DIR = 0x00000020, + MIO_EMG = 0x00000040, + MIO_PCS = 0x00000080, + + MIO_ERC = 0x00000100, + MIO_EZ = 0x00000200, + MIO_CLR = 0x00000400, + MIO_LTC = 0x00000800, + + MIO_SD = 0x00001000, + MIO_INP = 0x00002000, + MIO_SVON = 0x00004000, + MIO_ALM_RST = 0x00008000, + + MIO_SPLIM = 0x00010000, + MIO_SNLIM = 0x00020000, + MIO_CMP = 0x00040000, +}; + +//Bit Definition +//0 Stop. Stop +//1 Res1. Reserved +//2 WaitERC. Wait ERC finished +//3 Res2. Reserved +//4 CorrectBksh. Correcting Backlash; +//5 Res3. Reserved +//6 InFA. Feeding in return velocity= FA +//7 InFL. Feeding in StrVel speed=FL; +//8 InACC. Accelerating +//9 WaitINP. Wait in position. +enum ACM_AX_MST { + MST_STOP = 0x1, + MST_RES1 = 0x2, // Reserved + MST_WAIT_ERC = 0x4, + MST_RES2 = 0x8, // Reserved + + MST_BACKLASH_CORRECTION = 0x10, //Correcting Backlash; + MST_RES3 = 0x20, // Reserved + MST_FEEDING_FA = 0x40, //Feeding in return velocity= FA + MST_FEADING_FL = 0x80, //Feeding in StrVel speed=FL; + + MST_ACCEL = 0x100, //8 InACC. Accelerating + MST_WAIT_INP = 0x200, // Wait in position. + }; +// Galil enum Galil_Axis { AXIS_X, @@ -154,10 +262,16 @@ const char GalilAxis[MAX_GALIL_AXIS] = { class CCard { public: + // set / get Advantech Device Number + UINT_PTR GetAcmDeviceHandle(int nCardNo); + void SetAcmDeviceHandle(int nCardNo, UINT_PTR hDevHandle); + // GCon GetGalilCardHandle(int nCardType, int nCardNo); void SetGalilCardHandle(int nCardType, int nCardNo, GCon hDMC); int Get7296PortNo(int nPoint); BOOL GetOutputStatus(int nIndex); + std::vector GetOutputStatus(); + CCard(); virtual ~CCard(); @@ -171,6 +285,12 @@ public: // Update the Output Status for read back void SetOutputStatus(int nCardType, int nCardNo, int nPoint, BOOL bLogic); + // Advantech : to get device number which is need to open the device handle + ULONG GetAcmDeviceNum(ULONG DevType, ULONG BoardID, ULONG MasterRingNo, ULONG SlaveBoardID); + // + void RegisterAxisHandle(const CMtrProfile &mtrProfile, UINT_PTR hAxis); + UINT_PTR GetAxisHandle(const CMtrProfile &mtrProfile); + bool m_bTraceData; bool m_bBenchDebug; @@ -186,14 +306,17 @@ protected: // 7856 MotionNet - cater up to 64 axis static HANDLE m_h7856MotionIntArr[64]; // each axis has 1 int event +// Advantech EtherCAT - cater up to 64 axis / card max 16 card + static HANDLE m_hAdvantechMotionIntArr[16][64]; // each axis has 1 int event + + // Advantech Card Handle - cater 16 card + static UINT_PTR m_hAcmDeviceHandle[16]; // each card has 1 handle + #ifdef WITH_ETEL // ETEL - per axis handle static DSA_DRIVE *m_ETEL_DSA_DRIVE[MAX_ETEL_AXIS]; // cater up to 32 ETEL Axis #endif - // static bool *m_pbOutput; - // static bool *m_pbInput; - private: // cater tracking for upto 16 brands @@ -213,14 +336,16 @@ private: // cater for 6 different output cards type // 16 cards per type // 144 points per card - static bool m_nOutputStatus[MAX_CARD_TYPE][MAX_CARD_FOR_EACH_TYPE][MAX_POINTS_FOR_EACH_CARD]; +// static bool m_nOutputStatus[MAX_CARD_TYPE][MAX_CARD_FOR_EACH_TYPE][MAX_POINTS_FOR_EACH_CARD]; // for output tracking - static CArray m_bOutputArray; + static std::vector m_bOutputArray; // // track the Galil cards initialised handle // currently this is used for Galil Cards only // for up to 5 different type of cards with 5 cards in each type per system static GCon m_hdmcGalil[5][5]; + + static std::map m_mapAxisHandle; }; #endif // !defined(AFX_HARDWAREINI_H__72E28502_940B_4759_854A_B4A6879C3115__INCLUDED_) diff --git a/MITLIB/IODll/InputController.h b/MITLIB/IODll/InputController.h index 4445413..a42e81f 100644 --- a/MITLIB/IODll/InputController.h +++ b/MITLIB/IODll/InputController.h @@ -12,6 +12,8 @@ #include "hardwareini.h" #include "InputControllerBase.h" +#include + #ifdef BUILD_IODLL #define IODLLCLASS __declspec(dllexport) #else @@ -85,7 +87,7 @@ private: int m_nNoOfCardType; CHardwareIni m_iniHardware; - CArray m_astCard; + std::vector m_vecCard; static CInputController* instance; diff --git a/MITLIB/IODll/InputControllerBase.h b/MITLIB/IODll/InputControllerBase.h index ebf79f7..73e2119 100644 --- a/MITLIB/IODll/InputControllerBase.h +++ b/MITLIB/IODll/InputControllerBase.h @@ -7,6 +7,7 @@ #include "hardwareini.h" #include +#include #if _MSC_VER > 1000 #pragma once diff --git a/MITLIB/IODll/InputController_1203.h b/MITLIB/IODll/InputController_1203.h new file mode 100644 index 0000000..b2b0af9 --- /dev/null +++ b/MITLIB/IODll/InputController_1203.h @@ -0,0 +1,27 @@ +// InputController_1203.h: interface for the CInputController_1203 class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_INPUTCONTROLLER_1203_H__D937EBC5_25E7_4A81_9CAF_18EBCF8F49F8__INCLUDED_) +#define AFX_INPUTCONTROLLER_1203_H__D937EBC5_25E7_4A81_9CAF_18EBCF8F49F8__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "InputControllerBase.h" + +class CInputController_1203 : public CInputControllerBase +{ +public: + CInputController_1203(); + virtual ~CInputController_1203(); + +// method to initialise the input controller card + int InitCard(int nHardwareIniTypeID, int nHardwareIniTypeCardNo, int *pPhysicalCardID) override; + +// method to close the input controller card + int CloseCard(int nPhysicalCardID) override; +}; + +#endif // !defined(AFX_INPUTCONTROLLER_1203_H__D937EBC5_25E7_4A81_9CAF_18EBCF8F49F8__INCLUDED_) diff --git a/MITLIB/IODll/Input_1203.h b/MITLIB/IODll/Input_1203.h new file mode 100644 index 0000000..cc7a67a --- /dev/null +++ b/MITLIB/IODll/Input_1203.h @@ -0,0 +1,35 @@ +// Input_1203.h: interface for the CInput_1203 class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_INPUT_1203_H__541D5DB0_55F8_40BA_B3D7_EE128774A724__INCLUDED_) +#define AFX_INPUT_1203_H__541D5DB0_55F8_40BA_B3D7_EE128774A724__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "InputBase.h" + +class CAdvantechCommon_ACM; + +class CInput_1203 : public CInputBase +{ +public: + CInput_1203(const CInputSetting &Setting); + virtual ~CInput_1203(); + +// method to query Analog input voltage +// nRange = 0 -> +/-10V +// nRange = 1 -> +/-5V +// nRange = 2 -> +/-2.5V +// nRange = 3 -> +/-1.25V + BOOL GetVoltage(double &dVoltage, int nRange) override; + + int GetState() override; + +private: + std::unique_ptr m_pCommon; +}; + +#endif // !defined(AFX_INPUT_1203_H__541D5DB0_55F8_40BA_B3D7_EE128774A724__INCLUDED_) diff --git a/MITLIB/IODll/MotionController.h b/MITLIB/IODll/MotionController.h index 8dc417e..203dca0 100644 --- a/MITLIB/IODll/MotionController.h +++ b/MITLIB/IODll/MotionController.h @@ -132,8 +132,8 @@ private: CMtrPos m_mtrPos; // object to keep track of current motor position CMtrOnOff m_mtrOnOff; // object to keep track of current motor On/Off States - int *m_ipMtrCurPos; // array to store motor position before maintenance mode - bool *m_bpMtrCurOnOff; // array to store motor On/Off States before maintenance mode + std::vector m_vecMtrCurPos; // array to store motor position before maintenance mode + std::vector m_vecMtrCurOnOff; // array to store motor On/Off States before maintenance mode int m_iNoOfMtr; // total no of motor int m_nNoOfCardType; diff --git a/MITLIB/IODll/MotionController_1203.h b/MITLIB/IODll/MotionController_1203.h new file mode 100644 index 0000000..6ef6675 --- /dev/null +++ b/MITLIB/IODll/MotionController_1203.h @@ -0,0 +1,39 @@ +// MotionController_1203.h: interface for the CMotionController_1203 class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_MOTIONCONTROLLER_1203_H__7EA80A57_50A0_4983_A3B7_8176E4504168__INCLUDED_) +#define AFX_MOTIONCONTROLLER_1203_H__7EA80A57_50A0_4983_A3B7_8176E4504168__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "MotionControllerBase.h" + +class CMotionController_1203 : public CMotionControllerBase +{ +public: + CMotionController_1203(int index); + virtual ~CMotionController_1203(); + + BOOL Init(int &nNoOfMtr) override; + void Close() override; + +// get the IOs status of the motor + unsigned short GetMotionIOStatus(const CMtrProfile &mtrProfile) override; + +// get Motion status of motor + int GetMotionStatus(const CMtrProfile &mtrProfile) override; + +// get Motor Pos value + double GetMtrPos(const CMtrProfile &mtrProfile) override; + +// get position error value + double GetPosErr(const CMtrProfile &mtrProfile) override; + +private: + +}; + +#endif // !defined(AFX_MOTIONCONTROLLER_1203_H__7EA80A57_50A0_4983_A3B7_8176E4504168__INCLUDED_) diff --git a/MITLIB/IODll/MotionController_ADVANTECH_ETHERCAT.h b/MITLIB/IODll/MotionController_ADVANTECH_ETHERCAT.h new file mode 100644 index 0000000..5fe3e81 --- /dev/null +++ b/MITLIB/IODll/MotionController_ADVANTECH_ETHERCAT.h @@ -0,0 +1,69 @@ +// MotionController_ADVANTECH_ETHERCAT.h: interface for the CMotionController_ADVANTECH_ETHERCAT class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_MOTIONCONTROLLER_ADVANTECH_ETHERCAT_H__2B8E92ED_42EF_4887_8D87_9C9AAEEE22CD__INCLUDED_) +#define AFX_MOTIONCONTROLLER_ADVANTECH_ETHERCAT_H__2B8E92ED_42EF_4887_8D87_9C9AAEEE22CD__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +#include +#include "MotionControllerBase.h" + +class CMotionController_ADVANTECH_ETHERCAT; +typedef struct _stThreadParam { + int nId; + CMotionController_ADVANTECH_ETHERCAT *pController; + // ctor + _stThreadParam(int _id, CMotionController_ADVANTECH_ETHERCAT* _pController) + { + nId = _id; + pController = _pController; + } +} stThreadParam; + +class CMotionController_ADVANTECH_ETHERCAT : public CMotionControllerBase +{ +public: + CMotionController_ADVANTECH_ETHERCAT(int index); + virtual ~CMotionController_ADVANTECH_ETHERCAT(); + + BOOL Init(int &nNoOfMtr) override; + void Close() override; + + int GetCardId(int nIndex) + { + return m_cardInfo[nIndex].nId; + } + + void SetAdvantechMotionInt(int nCardNo, int nAxisNo); + bool m_bKillThread; + +private: + typedef struct _stCardInfo { + unsigned short nId; + unsigned short nNumOfAxes; + unsigned short nNumOfMotionSlaves; + unsigned short nNumOfIoSlaves; + + _stCardInfo(unsigned short _Id, unsigned short _numOfAxes, unsigned short _numOfMotionSlaves, unsigned short _numOfIoSlaves) + { + nId = _Id; + nNumOfAxes = _numOfAxes; + nNumOfMotionSlaves = _numOfMotionSlaves; + nNumOfIoSlaves = _numOfIoSlaves; + } + } stCardInfo; + // methods + + // attributes + std::vector m_cardInfo; + std::map m_mapModelDeviceType; + + std::vector m_vecThdParam; + CWinThread *m_pAdvantechIntThread[2]; + +}; + +#endif // !defined(AFX_MOTIONCONTROLLER_ADVANTECH_ETHERCAT_H__2B8E92ED_42EF_4887_8D87_9C9AAEEE22CD__INCLUDED_) diff --git a/MITLIB/IODll/Motor.h b/MITLIB/IODll/Motor.h index 0b640c8..e2f5653 100644 --- a/MITLIB/IODll/Motor.h +++ b/MITLIB/IODll/Motor.h @@ -38,7 +38,14 @@ #define ACS_MOTOR_STR "ACS" #define ACS_MUTEX_NAME "acs_mutex" -#define MAX_MOTION_CONTROLLER_TYPE 7 +// advantech ethercat +#define PCI_ETHERCAT_MASTER_ADVANTECH 7 // master driver for many different supported cards, eg 1203 +#define PCI_ETHERCAT_MASTER_ADVANTECH_STR "ADVANTECH_ETHERCAT" + +#define PCI_1203_ETHERCAT_MOTION_ADVANTECH 8 +// + +#define MAX_MOTION_CONTROLLER_TYPE 9 #define MAX_MC_MOTOR 64 // Max motor per machine #define MAX_MOTOR 50 @@ -227,7 +234,7 @@ protected: void SetCurPos(int iPos, int iMtrNo = -1); private: - static int *m_ipMtrCurPos; // array to keep track all motor current position + static std::vector m_vecMtrCurPos; // array to keep track all motor current position static int m_iNoOfInstance; // keep track no of instance static int m_iNoOfMtr; // keep track of total number of motor @@ -274,7 +281,7 @@ protected: void SetCurMtrOnOff(bool bOnOffState, int iMtrNo = -1); private: - static bool *m_bpMtrCurOnOff; // array to keep track all motor current On/Off States + static std::vector m_vecMtrCurOnOff; // array to keep track all motor current On/Off States int m_iMtrNo; // keep track motor number static int m_iNoOfInstance; // keep track no of instance diff --git a/MITLIB/IODll/MotorAdlinkBase.h b/MITLIB/IODll/MotorAdlinkBase.h index 4796b41..982cd49 100644 --- a/MITLIB/IODll/MotorAdlinkBase.h +++ b/MITLIB/IODll/MotorAdlinkBase.h @@ -88,7 +88,7 @@ protected: virtual bool SetupRelativeSimultaneousMove(int nNoOfAxis, short *sAxis, double *dPosition, double *dStartVel, double *dMaxVel, double *dAcc, double *dDec); virtual bool StartSimultaneousMove(int nFirstAxisNo); virtual bool IsSimultaneousMoveSupported(void); - virtual double CovertAccToMtrUnits(double dAcc, double dNumPulsePerMM); + virtual double ConvertAccToMtrUnits(double dAcc, double dNumPulsePerMM); // LERP - Linear Interpolation virtual bool StartXYRelMoveLinear(double dDistX, double dDistY, double dStartVel, double dMaxVel, double dAcc, double dDec); diff --git a/MITLIB/IODll/Motor_1203.h b/MITLIB/IODll/Motor_1203.h new file mode 100644 index 0000000..dd1d478 --- /dev/null +++ b/MITLIB/IODll/Motor_1203.h @@ -0,0 +1,191 @@ +// Motor_7856.h: interface for the CMotor_1203 class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_MOTOR_1203_H__912D0237_EABF_43CC_B320_635408A66001__INCLUDED_) +#define AFX_MOTOR_1203_H__912D0237_EABF_43CC_B320_635408A66001__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "MotorAdlinkBase.h" + +#include + +#define MAX_AXIS_SIMULTANEOUS_MOV_ETHERCAT 8 + + +class CMotor_1203 : public CMotorAdlinkBase +{ +public: + CMotor_1203(CMtrProfile mtrProfile, double *dpPos, CMotionControllerBase *pBaseController); + virtual ~CMotor_1203(); + +// ************************************************************** +// Methods declaration +// ************************************************************** + +// method to close the axis + void CloseAxis() override; + + void ConstructAxis() override; + +// method to initialize and configure the axis + void ConstructMotor() override; + +// method to On/Off motor + bool OnMotor() override; + bool OffMotor() override; + +// method to stop motor with decceleration + bool DecelStop() override; + +// method to trigger Emergency stop the motor int EStop(); + bool EmergStop() override; + +// method to get commanded position + bool GetMotorCommandedPosition(int nMtrNo, double *pRaw) override; + +// method to get other motor axis IO status + int GetMotionIOStatus(const CMtrProfile &mtrProfile) override; + +// method to get other motor axis current position + bool GetMotorPosition(const CMtrProfile &mtrProfile, double *pRawPosition) override; + +// method to get motor axis current position error + bool GetMotorPositionError(double *pRawPositionError) override; + + bool FindHome(HOME_DIR homeDir, MOTION_SPEED speed, bool bToggleHomeSensor); + +// Home by sensor or by limit + BOOL HomeByHomeMode(int homeMode); + +// method to do homing by limit sensor + BOOL HomingByLimit() override; + +// method to do homing by index signal + BOOL HomeByIndex() override; + +// method to do homing by Home Sensor + BOOL HomeBySensor() override; + +// method to home by home mode 27: (EL On Then reverse to count EZ number and reset counter) + BOOL HomeByLimitThenIndex() override; + +// method to move absolute + bool AbsoluteMove(double dPosition, int nMode, PROFILE_CURVE curve) override; + +// method to move continuously + int MoveContinuously(bool bCW = true) override; + +// method to move relative distance + bool RelativeMove(double dDistance, PROFILE_CURVE curve) override; + +// method to process interrupt to decode what happen to the motor + void ProcessInt(int nIntCode = 0) override; + +// method to reset single trigger + int ResetSingleTrigger(double dPosition = 0.0) override; + +// method to set the commanded position register + bool SetMotorCommandedPosition(double dPosition) override; + +// method to set the mechanical coversion factor + bool RefreshMotorConversionFactor() override; + +// method to set homing modes + bool SetMotorHomeMode(int iHomeMode) override; + + int SetMultipleTrigger(double* pPosition, int nNoOfTrigger, int nCmpSource = 1) override; + +// method to set multiple trigger + bool SetMotorMultipleTrigger(const multiple_trigger &trigger) override; + +// method to force set the current position + bool SetMotorPosition(double dPosition) override; + +// method to arm controller axis for single trigger + int SetSingleTrigger(double dPosition, int nCmpSource = 1, int nPulseStretch = STRETCH_NON) override; + +// method to arm multiaxis for simultaneous motion + bool SetupAbsoluteSimultaneousMove(int nNoOfAxis, short *sAxis, double *dPosition, double *dStartVel, double *dMaxVel, double *dAcc, double *dDec) override; + bool SetupRelativeSimultaneousMove(int nNoOfAxis, short *sAxis, double *dPosition, double *dStartVel, double *dMaxVel, double *dAcc, double *dDec) override; + bool StartSimultaneousMove(int nFirstAxisNo) override; +// - use MotorAdLinkBase Simultaneous move Move - Lim HS + +// method to move motor in s-curve continuously + int SMoveContinuously(bool bCW = true) override; + + void SetMotorProfile(double dValue, motion_profile::PROFILE_TYPE type) override; + +// method to set the motor type and encoder input type + bool SetMotorType(int iMtrType) override; + +// method to set the motor alarm signal logic + bool SetMotorAlarmLogic(int iALM) override; + +// method to set the home sensor signal logic + bool SetMotorHomeSensorLogic(int iORGI) override; + +// method to set the encoder Index signal logic + bool SetMotorIndexLogic(int iIndexLogic) override; + +// method to set the in position signal logic + bool SetMotorINPLogic(int iINP) override; + +// method to set clk type, out/dir or cw/ccw + bool SetMotorClk(int iClk) override; + +// Gary 21Mar11, V1.28.01 +// Method to reset driver alarm via MotionNet + int ResetAlarm(bool bReset) override; + bool IsSimultaneousMoveSupported(void) override; + + virtual double ConvertAccToMtrUnits(double dAcc, double dNumPulsePerMM) override; + +private: + typedef struct _stSimMoveInfo { + unsigned short shMode; //0 = ABs, 1 = Rel + double dMasterPos; + //ctor + _stSimMoveInfo() + { + shMode = 0; + dMasterPos = 0; + } + } stSimMoveInfo; + + UINT_PTR m_hAxis; + + int Home(bool bHomeReverse, bool bSlowSpeed); + + bool PrepareMotionCurve(PROFILE_CURVE curve); + + enum PROFILE_TYPE + { + ACC, + DEC, + START_VEL, + MAX_VEL, + }; + + ULONG GetHwHomeMode(int iHomeMode); + + bool SetMotionProfile(PROFILE_TYPE profileType); + + bool BeginContinuousMove(bool bDirection); + + bool ContinuousMove(PROFILE_CURVE profileCurve, bool bDir); + + bool PrepareForMove(PROFILE_CURVE profileCurve); + bool PrepareSimultaneousMove(const std::vector &vecAxisHandle, double *dPosition, double *dStartVel, double *dMaxVel, double *dAcc, double *dDec); + + stSimMoveInfo m_stSimMove; + long m_AxisId [MAX_AXIS_SIMULTANEOUS_MOV_ETHERCAT]; + long m_Posn [MAX_AXIS_SIMULTANEOUS_MOV_ETHERCAT]; + long m_MaxVel [MAX_AXIS_SIMULTANEOUS_MOV_ETHERCAT]; + +}; + +#endif // !defined(AFX_MOTOR_1203_H__912D0237_EABF_43CC_B320_635408A66001__INCLUDED_) diff --git a/MITLIB/IODll/Motor_7856.h b/MITLIB/IODll/Motor_7856.h index 548f0d9..0305879 100644 --- a/MITLIB/IODll/Motor_7856.h +++ b/MITLIB/IODll/Motor_7856.h @@ -138,7 +138,7 @@ public: int ResetAlarm(bool bReset) override; bool IsSimultaneousMoveSupported(void) override; - virtual double CovertAccToMtrUnits(double dAcc, double dNumPulsePerMM) override; + virtual double ConvertAccToMtrUnits(double dAcc, double dNumPulsePerMM) override; private: int Home(bool bHomeReverse, bool bSlowSpeed); diff --git a/MITLIB/IODll/OutputController.h b/MITLIB/IODll/OutputController.h index d05d677..e2c5c91 100644 --- a/MITLIB/IODll/OutputController.h +++ b/MITLIB/IODll/OutputController.h @@ -10,7 +10,9 @@ #endif // _MSC_VER > 1000 #include "hardwareini.h" #include "OutputControllerBase.h" + #include +#include #ifdef BUILD_IODLL #define IODLLCLASS __declspec(dllexport) @@ -59,7 +61,7 @@ public: // copy of gOutputArray that is used to compare the output state during machine running vs // output state in maintenance mode - BOOL *m_bpOutputArray; + std::vector m_vecOutputArray; // to keep track output state array size int m_iOutputStateArraySize; @@ -91,7 +93,7 @@ private: int m_nNoOfCardType; CHardwareIni m_iniHardware; - CArray m_astCard; + std::vector m_vecCard; static COutputController* instance; diff --git a/MITLIB/IODll/OutputController_1203.h b/MITLIB/IODll/OutputController_1203.h new file mode 100644 index 0000000..d8de94b --- /dev/null +++ b/MITLIB/IODll/OutputController_1203.h @@ -0,0 +1,27 @@ +// OutputController_1203.h: interface for the COutputController_1203 class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_OUTPUTCONTROLLER_1203_H__35C41678_8787_408E_854C_739C6DE40BCF__INCLUDED_) +#define AFX_OUTPUTCONTROLLER_1203_H__35C41678_8787_408E_854C_739C6DE40BCF__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "OutputControllerBase.h" + +class COutputController_1203 : public COutputControllerBase +{ +public: + COutputController_1203(); + virtual ~COutputController_1203(); + +// method to initialise the output controller card + int InitCard(int nHardwareIniTypeID, int nHardwareIniTypeCardNo, int *pPhysicalCardID) override; + +// method to close the output controller card + int CloseCard(int nPhysicalCardID) override; +}; + +#endif // !defined(AFX_OUTPUTCONTROLLER_1203_H__35C41678_8787_408E_854C_739C6DE40BCF__INCLUDED_) diff --git a/MITLIB/IODll/Output_1203.h b/MITLIB/IODll/Output_1203.h new file mode 100644 index 0000000..17469ec --- /dev/null +++ b/MITLIB/IODll/Output_1203.h @@ -0,0 +1,31 @@ +// Output_1203.h: interface for the COutput_1203 class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_OUTPUT_1203_H__C047F760_46EB_44CC_A05A_78B815955096__INCLUDED_) +#define AFX_OUTPUT_1203_H__C047F760_46EB_44CC_A05A_78B815955096__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "OutputBase.h" + +class CAdvantechCommon_ACM; + +class COutput_1203 : public COutputBase +{ +public: + COutput_1203(const COutputSetting &Setting); + virtual ~COutput_1203(); + +// method to set analog output voltage + BOOL SetVoltage(double dVoltage, double dRange) override; + + BOOL SetState(bool bState) override; + +private: + std::unique_ptr m_pCommon; +}; + +#endif // !defined(AFX_OUTPUT_1203_H__C047F760_46EB_44CC_A05A_78B815955096__INCLUDED_) diff --git a/MITLIB/Lib/CommDll100D.lib b/MITLIB/Lib/CommDll100D.lib index fa4e1c7..fe155ff 100644 Binary files a/MITLIB/Lib/CommDll100D.lib and b/MITLIB/Lib/CommDll100D.lib differ diff --git a/MITLIB/Lib/IODll100D.lib b/MITLIB/Lib/IODll100D.lib index 05e2237..a7720b5 100644 Binary files a/MITLIB/Lib/IODll100D.lib and b/MITLIB/Lib/IODll100D.lib differ diff --git a/MITLIB/Lib/SecsGem100.lib b/MITLIB/Lib/SecsGem100.lib index 0f5ce09..ae15b94 100644 Binary files a/MITLIB/Lib/SecsGem100.lib and b/MITLIB/Lib/SecsGem100.lib differ diff --git a/MITLIB/Lib/Utility100D.lib b/MITLIB/Lib/Utility100D.lib index 4bcc920..4608f00 100644 Binary files a/MITLIB/Lib/Utility100D.lib and b/MITLIB/Lib/Utility100D.lib differ diff --git a/MITLIB/Lib/mcctrdll100D.lib b/MITLIB/Lib/mcctrdll100D.lib index 48f16e0..c01193f 100644 Binary files a/MITLIB/Lib/mcctrdll100D.lib and b/MITLIB/Lib/mcctrdll100D.lib differ diff --git a/MITLIB/mcctrdll/Cassette.h b/MITLIB/mcctrdll/Cassette.h index faabc50..1e3564b 100644 --- a/MITLIB/mcctrdll/Cassette.h +++ b/MITLIB/mcctrdll/Cassette.h @@ -71,7 +71,7 @@ public: bool IndexToNextSlot(); void ResetSlotNum(); - int *m_iSlot; + std::vector m_iSlot; int m_iCurSlot; double m_dSlotPitch; diff --git a/MITLIB/mcctrdll/run.h b/MITLIB/mcctrdll/run.h index d62fbc0..022bedc 100644 --- a/MITLIB/mcctrdll/run.h +++ b/MITLIB/mcctrdll/run.h @@ -14,6 +14,7 @@ #include "OutputController.h" #include "Utility.h" #include +#include enum MODE { @@ -369,8 +370,8 @@ private: bool m_bWarning; // is there warning }; - CArray m_astWarning; - std::set m_setWarn; + std::deque m_deqWarning; + std::set m_setWarn; // Gary 03jun03 start BOOL m_bWarningClear; @@ -421,7 +422,7 @@ private: // all module no material status // true = current module no material, false = current module got material - static bool *m_bNoMaterial; + static std::vector m_bNoMaterial; static int m_iNoOfInstance; // keep track no of instance of this class // to determine whether jam has been registered diff --git a/MITLIB/mcctrdll/runctrl.h b/MITLIB/mcctrdll/runctrl.h index d89212d..ac21474 100644 --- a/MITLIB/mcctrdll/runctrl.h +++ b/MITLIB/mcctrdll/runctrl.h @@ -16,7 +16,6 @@ #include "CheckSwitch.h" #include "structure.h" #include "EMS.h" -#include "LotMsg.h" #include "SemiE10RS.h" #include "CurrentMsTime.h" #include "Thread.h" @@ -183,7 +182,7 @@ const CString TLightState[MAX_LIGHT_MAX_STATE] = class MCCTRDLLCLASS CRunCtrl : public CRunTask { public: - CRunCtrl(int numRun, CRun **run, CLotMsg *pLotMsg); + CRunCtrl(int numRun, CRun **run); ~CRunCtrl(); protected: @@ -257,7 +256,7 @@ public: void SetModuleWarning(BOOL bState); void SetSystemWarning(BOOL bState); void SetIndicator(int nIndicator, COutput *output); - void GetLightStatus(CUIntArray *nLight); + void GetLightStatus(std::vector &vecLight); void InitParameters(void); void CloseLot(void); void EmStopRelease(void); @@ -487,13 +486,6 @@ public: // Gary 24Mar10, V1.13.4, change this object from private to public CSemiE10RS m_SemiE10; -// Gary 16Jun10, implement Warning Message with Buzzer disable feature, START -// as well as Authroization Level to clear Jam - CPtrList m_ptrListJam; - CPtrList m_ptrListWarning; - - CLotMsg *m_pLotMsg; - std::vector m_vecDisabledBuzzerMsgID; // 0 - Operator @@ -512,8 +504,6 @@ public: void AddDisabledBuzzerMsg(int nMsgID); - int GetHighestJamClearanceAuthorizationLevel(); - // Gary 16Jun10, implement Warning Message with Buzzer disable feature, END // as well as Authroization Level to clear Jam