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

📄 userlib.h

📁 课题研究用的直线型一级倒立摆的源程序
💻 H
字号:
/***************************************************************************
file name:	GT400LIB.H

contents:
	 This file contains various defines that is used with the GOOGOL TECH.
	 GT400 motion control board software source code. GT400LIB.C will include
	 this file. If GT400LIB.C is used in user file ,please include the file:
	 GT400LIB.H
****************************************************************************/
// 命令返回值(rtn)定义解释:
/* return explain:
	-2		        版本出错		GT_VRSN_ERR
	-1		        通讯失败   		GT_COM_ERR
	0			OK                      GT_CMD_OK
	1			命令出错                GT_CMD_ERR
	2			半径=0或太大            GT_RADI_ERR
	3			直线长度=0或太大        GT_LEN_ERR
	4			(加)速度=0或太大      GT_ANV_ERR
	5			参数矛盾                GT_PRM_ANTI
	6			方程无解                GT_MAP_ERR
	7                       过程参数错误          	GT_PRM_ERR
*/
#if !defined(_USERLIB)
#define _USERLIB

#ifdef __cplusplus
extern "C" {
#endif


/*retrun explain:*/
#define GT_VRSN_ERR		-2
#define GT_COM_ERR    		-1
#define GT_CMD_OK     		0
#define GT_CMD_ERR  		1
#define GT_RADI_ERR  		2
#define GT_LEN_ERR  		3
#define GT_ANV_ERR  		4
#define GT_PRM_ANTI  		5
#define GT_MAP_ERR	  	6
#define GT_PRM_ERR		7

short 	GT_Open(void);
short 	GT_Close(void);
/****************/
/* control mode */
/****************/
short GT_CtrlMode(int Mode);

/****************/
/* axis control */
/****************/
short	GT_Axis(unsigned short);
short	GT_AxisI(void);

/**********************/
/* profile generation */
/**********************/
short   GT_PrflT(void);
short   GT_PrflS(void);
short   GT_PrflV(void);
short   GT_PrflG(unsigned short);
short	GT_SetPos(long);
short   GT_SetVel(double);
short   GT_SetAcc(double);
short   GT_SetMAcc(double);
short   GT_SetJerk(double);
short   GT_SetRatio(double);
short   GT_SmthStp(void);
short   GT_AbptStp(void);
short   GT_ZeroPos(void);
short   GT_SynchPos(void);
short   GT_GetPos(long*);
short   GT_GetVel(double*);
short   GT_GetAcc(double*);
short   GT_GetMAcc(double*);
short   GT_GetJerk(double*);
short   GT_GetRatio(double*);
short   GT_SetAtlPos(long);
short   GT_GetAtlPos(long*);
short  	GT_SetMtrLmt(unsigned short);
short  	GT_GetMtrLmt(unsigned short*);

/******************/
/* digital filter */
/******************/

short  GT_SetKp(unsigned short);
short  GT_SetKd(unsigned short);
short  GT_SetKi(unsigned short);
short  GT_SetKvff(unsigned short);
short  GT_SetKaff(unsigned short);
short  GT_SetILmt(unsigned short);
short  GT_SetMtrBias(short);
short  GT_SetPosErr(unsigned short);
short  GT_GetKp(unsigned short*);
short  GT_GetKd(unsigned short*);
short  GT_GetKi(unsigned short*);
short  GT_GetKvff(unsigned short*);
short  GT_GetKaff(unsigned short*);
short  GT_GetILmt(unsigned short*);
short  GT_GetMtrBias(short*);
short  GT_GetPosErr(unsigned short*);
short  GT_GetIntgr(short*);
short  GT_GetAtlErr(short*);
short  GT_AuStpOn(void);
short  GT_AuStpOff(void);

/********************/
/* parameter update */
/********************/
short   GT_PosBrk(void);
short   GT_NegBrk(void);
short   GT_ExtBrk(void);
short   GT_MtnBrk(void);
short   GT_BrkOff(void);
short   GT_SetBrkCn(long);
short   GT_Update(void);
short   GT_MltiUpdt(unsigned short);
short   GT_AuUpdtOn(void);
short   GT_AuUpdtOff(void);
short   GT_GetBrkCn(long*);

/**********************/
/* interrupt process */
/**********************/
short   GT_TmrIntr(void);
short   GT_EvntIntr(void);
short   GT_SetIntrTm(unsigned short);
short   GT_SetIntrMsk(unsigned short);
short   GT_RstIntr(unsigned short);
short   GT_GetIntrMsk(unsigned short*);
short   GT_GetIntr(unsigned short*);
short   GT_GetIntrTm(unsigned short*);

/***************/
/* status/mode */
/***************/
short   GT_ClrSts(void);
short   GT_RstSts(unsigned short);
short   GT_GetSts(unsigned short*);
short   GT_GetMode(unsigned short*);

/***********/
/* encoder */
/***********/

short    GT_EncSns(unsigned short);
short    GT_EncOn(void);
short    GT_EncOff(void);
short    GT_CaptIndex(void);


short   GT_CaptHome(void);
short   GT_CaptProb(void);
short   GT_GetCapt(long*);

/**************/
/* axis/motor */
/**************/
short   GT_AxisOn(void);
short   GT_AxisOff(void);
short   GT_LmtsOn(void);
short   GT_LmtsOff(void);
short   GT_DrvRst(void);
short   GT_StepDir(void);
short   GT_StepPulse(void);

short   GT_CloseLp(void);
short   GT_OpenLp(void);
short   GT_SetMtrCmd(short);
short   GT_GetMtrCmd(short*);

/******************/
/* Extendable I/O */
/******************/
short   GT_ExOpt(unsigned short);
short   GT_ExInpt(unsigned short*);

/*****************/
/* miscellaneous */
/*****************/
short   GT_GetCmdSts(unsigned short*);
short   GT_LmtSns(unsigned short);
short   GT_GetLmtSwt(unsigned short*);
short   GT_SetSmplTm(double);
short   GT_GetSmplTm(double*);
short   GT_Reset(void);
short   GT_HardRst(void);
short   GT_ChkVrsn(void);

/*************************/
/*interpolation functions*/
/*************************/
short   GT_SetAccLmt(double);
short   GT_GetAccLmt(unsigned long*);
short   GT_MapAxis(unsigned short,double*);
short   GT_StrtList(void);
short   GT_AddList(void);
short   GT_EndList(void);
short   GT_SetSynVel(double vel);
short   GT_SetSynAcc(double accel);
short   GT_StrtMtn(void);
short   GT_LnXY(double x,double y);
short   GT_LnXYZ(double x,double y,double z);
short   GT_LnXYZA(double x,double y,double z,double A);
short   GT_ArcXY(double x_center,double y_center,double angle);
short   GT_ArcYZ(double y_center,double z_center,double angle);
short   GT_ArcZX(double z_center,double x_center,double angle);
short   GT_ArcXYP(double x_end,double y_end,double r,short dir);
short   GT_ArcYZP(double y_end,double z_end,double r,short dir);
short   GT_ArcZXP(double z_end,double x_end,double r,short dir);
short   GT_MvXY(double x,double y,double vel,double accel);
short   GT_MvXYZ(double x,double y,double z,double vel,double accel);
short   GT_MvXYZA(double x,double y,double z,double A,double vel,double accel);
short   GT_GetBrkPnt(double *pnt);
short   GT_GetPrfPnt(double* pnt);
short   GT_StpMtn(void);
short   GT_EStpMtn(void);
short   GT_CrdAuStpOn(void);
short   GT_CrdAuStpOff(void);
short   GT_GetCrdSts(unsigned short*);
short   GT_GetMtnNm(unsigned short*);

/*************************/
/*  option function      */
/*************************/
short   GT_EncPos(short Enc_Num,long* Actl_pos);
short   GT_EncVel(short Enc_Num, double* Actl_vel);
short   GT_GetAdc(short channel,short* D_data);

short   GT_SwitchtoCardNo(short card_no);
short   GT_GetCurrentCardNo();


#ifdef __cplusplus
typedef void interrupt (*GT_ISR)(...);
#else
typedef void interrupt (*GT_ISR)();
#endif

GT_ISR GT_HookIsr(GT_ISR gtisr);
short  GT_UnhookIsr(GT_ISR old_isr);
short  GT_ClearInt(unsigned short CardNo);
#ifdef __cplusplus
}
#endif

#endif //_USERLIB

⌨️ 快捷键说明

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