⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aads1240.h

📁 基于PCI-1240运动控制卡的运动控制示例
💻 H
📖 第 1 页 / 共 2 页
字号:
//  Vers  Date      By       Notes
//  ----  ----      --       -----
//  1.0   6/28/2000 GENE LIN Created
//

#define PUBLIC  extern
#define PRIVATE static

#if !defined(_WIN31)
    #define FEXPORT __declspec (dllexport)
    #define FTYPE  CALLBACK
#else
    #define FEXPORT extern
    #define FTYPE  FAR PASCAL
#endif

#define DOUBLE double


/************************************************************************
   Define Global Value
************************************************************************/
#define CW                      0
#define CCW                     1
#define ImmediateStop           0
#define SlowStop                1
#define RelativeCoordinate      0
#define AbsoluteCoordinate      1
#define TCurveAcceleration      0
#define SCurveAcceleration      1
/************************************************************************
   Define Register ID
************************************************************************/
#define Rcnt                    0x0100          /* Real position counter */
#define Lcnt                    0x0101          /* Logical position counter */
#define Pcmp                    0x0102          /* P direction compare register */
#define Ncmp                    0x0103          /* N direction compare register */
#define Pnum                    0x0104          /* Pulse number */

#define CurV					0x0105			/* current logical speed */  
#define CurAC					0x0106			/* current logical acc	*/

#define SLDN_STOP               0x0026			
#define IMME_STOP               0x0027

#define WR3_OUTSL               0x0080

#define RESET					0x8000
#define RR0                     0x0200          
#define RR1                     0x0202
#define RR2                     0x0204
#define RR3                     0x0206
#define RR4                     0x0208
#define RR5                     0x020A
#define RR6                     0x020C
#define RR7                     0x020E

#define WR0                     0x0210
#define WR1                     0x0212
#define WR2                     0x0214
#define WR3                     0x0216
#define WR4                     0x0218
#define WR5                     0x021A
#define WR6                     0x021C
#define WR7                     0x021E

#define RG                      0x0300
#define SV                      0x0301
#define DV                      0x0302
#define MDV                     0x0303
#define AC                      0x0304
#define DC                      0x0305
#define AK                      0x0306
#define PLmt                    0x0307
#define NLmt                    0x0308
#define HomeOffset              0x0309
#define HomeMode                0x030A
#define HomeType                0x030B
#define HomeP0_Dir              0x030C
#define HomeP0_Speed            0x030D
#define HomeP1_Dir              0x030E
#define HomeP1_Speed            0x030F
#define HomeP2_Dir              0x0310
#define HomeOffset_Speed        0x0311
#define RWSN					0x0312

/************************************************************************
   Define Operation Axis
************************************************************************/
#define IPO_Axis				0x00	
#define X_Axis                  0x01
#define Y_Axis                  0x02
#define Z_Axis                  0x04
#define U_Axis                  0x08
#define XY_Axis                 0x03
#define XZ_Axis                 0x05
#define XU_Axis                 0x09
#define YZ_Axis                 0x06
#define YU_Axis                 0x0A
#define ZU_Axis                 0x0C
#define XYZ_Axis                0x07
#define XYU_Axis                0x0B
#define XZU_axis                0x0D
#define YZU_Axis                0x0E
#define XYZU_Axis               0x0F

/************************************************************************
   Path type for continue moving
************************************************************************/
#define IPO_L2                  0x0030
#define IPO_L3                  0x0031
#define IPO_CW                  0x0032
#define IPO_CCW                 0x0134

/************************************************************************
   Return Code
************************************************************************/
#define BoardNumErr             0x0001	
#define CreateKernelDriverFail  0x0002	//internal system error
#define CallKernelDriverFail    0x0003  //internal system error
#define RegistryOpenFail        0x0004	//Open registry file fail
#define RegistryReadFail        0x0005	//Read registry file fail
#define AxisNumErr              0x0006
#define UnderRGErr              0x0007
#define OverRGErr               0x0008
#define UnderSVErr              0x0009
#define OverSVErr               0x000a
#define OverMDVErr              0x000b
#define UnderDVErr              0x000c
#define OverDVErr               0x000d
#define UnderACErr              0x000e
#define OverACErr               0x000f
#define UnderAKErr              0x0010
#define OverAKErr               0x0011
#define OverPLmtErr             0x0012
#define OverNLmtErr             0x0013
#define MaxMoveDistErr          0x0014
#define AxisDrvBusy             0x0015
#define RegUnDefine             0x0016
#define ParaValueErr            0x0017
#define ParaValueOverRange      0x0018
#define ParaValueUnderRange     0x0019
#define AxisHomeBusy            0x001a
#define AxisExtBusy             0x001b
#define RegistryWriteFail       0x001c
#define ParaValueOverErr        0x001d
#define ParaValueUnderErr       0x001e
#define OverDCErr               0x001f
#define UnderDCErr              0x0020
#define UnderMDVErr             0x0021
#define RegistryCreateFail      0x0022
#define CreateThreadErr         0x0023		//internal system fail
#define HomeSwStop		        0x0024		//P1240HomeStatus
#define ChangeSpeedErr          0x0025
#define DOPortAsDriverStatus    0x0026

#define OpenEventFail           0x0030		//Internal system fail
#define DeviceCloseErr			0x0032		//Internal system fail

#define HomeEMGStop             0x0040		//P1240HomeStatus
#define HomeLMTPStop            0x0041		//P1240HomeStatus
#define HomeLMTNStop            0x0042		//P1240HomeStatus
#define HomeALARMStop           0x0043		//P1240HomeStatus

#define AllocateBufferFail				0x0050
#define BufferReAllocate				0x0051
#define FreeBufferFail					0x0052
#define FirstPointNumberFail			0x0053	
#define PointNumExceedAllocatedSize		0x0054
#define BufferNoneAllocate				0x0055
#define SequenceNumberErr				0x0056	
#define PathTypeErr						0x0057
#define PathTypeMixErr					 0x0060
#define BufferDataNotEnough				0x0061

/************************************************************************
   External mode
************************************************************************/
#define JOGDisable              0x00
#define JOGSelfAxis             0x01
#define JOGSelect_XAxis         0x02
#define JOGSelect_YAxis         0x03
#define JOGConnect_XAxis        0x04
#define JOGConnect_YAxis        0x05
#define JOGConnect_ZAxis        0x06
#define JOGConnect_UAxis        0x07
#define HandWheelDisable        0x08
#define HandWheelSelfAxis       0x09
#define HandWheelSelect_XAxis   0x0a
#define HandWheelSelect_YAxis   0x0b
#define HandWheelFrom_XAxis     0x0c
#define HandWheelFrom_YAxis     0x0d
#define HandWheelFrom_ZAxis     0x0e
#define HandWheelFrom_UAxis     0x0f


// Line Interplation( 2 axes )  
//		- dwEndPoint_ax1;
//		- dwEndPoint_ax2;
//		- wCommand;					; IPO_L2	
// Line Interplation( 3 axes )  
//		- dwEndPoint_ax1;
//		- dwEndPoint_ax2;
//		- dwEndPoint_ax3;
//		- wCommand;					; IPO_L3	
// Arc  Interplation( only 2 axes )  
//		- dwEndPoint_ax1;			; Arc end point of axis 1
//		- dwEndPoint_ax2;			; Arc end point of axis 2
//		- dwCenPoint_ax1;			; Arc center point of axis 1
//		- dwCenPoint_ax1;			; Arc center point of axis 2	
//		- wCommand;					; IPO_CW,IPO_CCW		
typedef struct _MotMoveBuffer
{
  DWORD			dwEndPoint_ax1;		// End position for 1'st axis
  DWORD			dwEndPoint_ax2;		// End position for 2'nd axis
  DWORD			dwEndPoint_ax3;		// End position for 3'rd axis
  DWORD			dwCenPoint_ax1;		// Center position for 1'st axis	
  DWORD			dwCenPoint_ax2;		// Center position for 2'rd axis
  DWORD			dwPointNum;			// Serial number for current data

  WORD			wCommand;			// IPO_CW,IPO_CCW,IPO_L2,IPO_L3 			
  WORD			TempB;				// For internal using
  DWORD			TempA;				// For internal using

}	MotMoveBuffer, * LPMotMoveBuffer;


typedef struct _MotionDataStruct
{

	LPMotMoveBuffer		lpBufIDAddr;	// Buffer address			
	HGLOBAL				hBuf;			// Hanlde of Buffer 
	DWORD				dwAllPointNum;	// How many point of continue move ( get from P1240InitContiBuf)
	BOOLEAN				bPoint1Flag;	
	DWORD				dwEndPointNum;
  
}	MotDataStruct; 	


typedef struct _MotSpeedTable
{

	DWORD	dwSpeed;	// speed data
	DWORD	dwComp;		// comparator data
  
}	MotSpeedTable, * LPMotSpeedTable; 	

// added by yongdong
typedef struct _VBoard_ID
{
	BYTE    byBoard_ID;
}   VBoard_ID, * LPVBoard_ID;

#ifdef __cplusplus
extern "C"
{
#endif

FEXPORT LRESULT FTYPE P1240MotDevOpen(BYTE byBoard_ID);

FEXPORT LRESULT FTYPE P1240MotDevAvailable(DWORD *lpReturnBoardStatus);

FEXPORT LRESULT FTYPE P1240MotDevClose(BYTE byBoard_ID);

FEXPORT LRESULT FTYPE P1240MotAxisParaSet(BYTE byBoard_ID,
										  BYTE bySetAxis,
										  BYTE byTS,
										  DWORD dwSV,
										  DWORD dwDV,
										  DWORD dwMDV,
										  DWORD dwAC,
										  DWORD dwAK);

FEXPORT LRESULT FTYPE P1240MotChgDV(BYTE byBoard_ID,
									BYTE bySetAxis,
									DWORD dwSetDVValue);

FEXPORT LRESULT FTYPE P1240MotChgLineArcDV(BYTE byBoard_ID,
										   DWORD dwSetDVValue);

FEXPORT LRESULT FTYPE P1240MotCmove(BYTE byBoard_ID,
									BYTE byCMoveAxis,
									BYTE byAxisDirection);

FEXPORT LRESULT FTYPE P1240MotPtp(BYTE byBoard_ID,
								  BYTE byMoveAxis,
								  BYTE byRA,
								  LONG lPulseX,
								  LONG lPulseY,
								  LONG lPulseZ,
								  LONG lPulseU);

FEXPORT LRESULT FTYPE P1240MotLine(BYTE byBoard_ID,
								   BYTE byMoveAxis,
								   BYTE byRA,
								   LONG lPulseX,
								   LONG lPulseY,
								   LONG lPulseZ,
								   LONG lPulseU);

FEXPORT LRESULT FTYPE P1240MotArc(BYTE byBoard_ID,
								  BYTE byMoveAxis,
								  BYTE byRA,
								  BYTE byAxisDirection,
								  LONG lCenter1,
								  LONG lCenter2,
								  LONG lEnd1,
								  LONG lEnd2);

FEXPORT LRESULT FTYPE P1240MotArcTheta(BYTE byBoard_ID,
									   BYTE byMoveAxis,
									   BYTE byRA,
									   LONG lCenter1,
									   LONG lCenter2,
									   DOUBLE dMoveDeg);

FEXPORT LRESULT FTYPE P1240MotStop(BYTE byBoard_ID,
								   BYTE byStopAxis,
								   BYTE byStopMode);

FEXPORT LRESULT FTYPE P1240MotAxisBusy(BYTE byBoard_ID,
									   BYTE byCheckAxis);

FEXPORT LRESULT FTYPE P1240MotClrErr(BYTE byBoard_ID,
									 BYTE byClearAxis);

FEXPORT LRESULT FTYPE P1240MotRdReg(BYTE byBoard_ID,
									BYTE byReadAxis,
									WORD wCommandCode,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -