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

📄 loadmpc2810.h

📁 运动控制卡VC源码,四轴控制,用于机械手的设计.
💻 H
📖 第 1 页 / 共 2 页
字号:
//I/O口操作函数
typedef int (CALLBACK* LPFNDLL2810_checkin_byte)(int cardno);
typedef int (CALLBACK* LPFNDLL2810_checkin_bit)(int cardno,int bitno);
typedef int (CALLBACK* LPFNDLL2810_outport_bit)(int cardno,int bitno,int status);
typedef int (CALLBACK* LPFNDLL2810_outport_byte)(int cardno,int bytedata);
typedef int (CALLBACK* LPFNDLL2810_check_sfr)(int cardno);
typedef int (CALLBACK* LPFNDLL2810_check_sfr_bit)(int cardno,int bitno);
typedef int (CALLBACK* LPFNDLL2810_Outport)(int portid,unsigned char byte);
typedef int (CALLBACK* LPFNDLL2810_Inport)(int portid);
//特殊功能
typedef int (CALLBACK* LPFNDLL2810_set_backlash)(int ch,double blash);
typedef int (CALLBACK* LPFNDLL2810_start_backlash)(int ch);
typedef int (CALLBACK* LPFNDLL2810_end_backlash)(int ch);
typedef int (CALLBACK* LPFNDLL2810_set_watchdog_time)(int cardno,long time);
typedef int (CALLBACK* LPFNDLL2810_reset_watchdog)(int cardno);
typedef int (CALLBACK* LPFNDLL2810_start_watchdog)(int cardno);
typedef int (CALLBACK* LPFNDLL2810_stop_watchdog)(int cardno);
typedef int (CALLBACK* LPFNDLL2810_get_watchdog_status)(int cardno);
typedef int (CALLBACK* LPFNDLL2810_enable_io_pos)(int ch,int flag);
typedef int (CALLBACK* LPFNDLL2810_set_poscmp_source)(int ch,int mode);//0:指令脉冲;1:辅助编码器脉冲
typedef int (CALLBACK* LPFNDLL2810_set_io_pos)(int ch,int open_pos,int close_pos);
typedef int (CALLBACK* LPFNDLL2810_enable_lock_enc)(int ch,int flag);
typedef int (CALLBACK* LPFNDLL2810_reset_locked_flag)(int ch);
typedef int (CALLBACK* LPFNDLL2810_get_locked_flag)(int ch);
typedef int (CALLBACK* LPFNDLL2810_get_locked_encoder)(int ch,int num,long *enc);
typedef int (CALLBACK* LPFNDLL2810_enable_gear)(int slave, int master, double ratio, int mode);
typedef int (CALLBACK* LPFNDLL2810_enable_handwheel)(long ch,int mul,int mode);
typedef int (CALLBACK* LPFNDLL2810_enable_softlimit)(int ch, int mode);
typedef int (CALLBACK* LPFNDLL2810_set_softlimit)(int ch, int source, int action);
typedef int (CALLBACK* LPFNDLL2810_set_softlimit_data)(int ch, double nel, double pel);
typedef int (CALLBACK* LPFNDLL2810_check_softlimit)(int ch);
typedef int (CALLBACK* LPFNDLL2810_enable_poserr_limit)(int ch, int mode);
typedef int (CALLBACK* LPFNDLL2810_set_poserr_limit)(int ch, double limit, int mul);
typedef int (CALLBACK* LPFNDLL2810_get_poserr_limit)(int ch, double *error);
typedef int (CALLBACK* LPFNDLL2810_enable_input_mode)(int ch, int mode);
typedef int (CALLBACK* LPFNDLL2810_set_im_deadband)(int ch, double db);
typedef int (CALLBACK* LPFNDLL2810_enable_isr)(int cardno, int mode);
typedef int (CALLBACK* LPFNDLL2810_set_isr_routine)(void ( * MyIsr)( ));
typedef int (CALLBACK* LPFNDLL2810_set_isr_factor)(int ch, int factor);
typedef int (CALLBACK* LPFNDLL2810_get_isr_event)(int ch,int *event);
typedef int (CALLBACK* LPFNDLL2810_set_ramp)(int ch, double *ad, double *ratio, int num);
typedef int (CALLBACK* LPFNDLL2810_change_speed)(int ch,double speed);
typedef int (CALLBACK* LPFNDLL2810_change_pos)(int ch,double pos);
typedef int (CALLBACK* LPFNDLL2810_set_tan_flag)(int flag);
typedef int (CALLBACK* LPFNDLL2810_set_tan_initpos)(double degree,int flag);
typedef int (CALLBACK* LPFNDLL2810_set_tan_map)(double pulseperdeg);
typedef int (CALLBACK* LPFNDLL2810_set_tan_axis)(int ch,int dir);
typedef int (CALLBACK* LPFNDLL2810_set_tan_profile)(double vl,double vh,double ad);
typedef int (CALLBACK* LPFNDLL2810_set_tan_stopangle)(double stopagl,double liftagl,int nFlag);
typedef int (CALLBACK* LPFNDLL2810_set_tan_io)(int cardno,int bitno,int time);//ms

//位置和状态查询函数
typedef int (CALLBACK* LPFNDLL2810_get_max_axe)(void);
typedef int (CALLBACK* LPFNDLL2810_get_board_num)(void);
typedef int (CALLBACK* LPFNDLL2810_get_axe)(int cardno);
typedef int (CALLBACK* LPFNDLL2810_get_unit)(int ch, double* dl);
typedef int (CALLBACK* LPFNDLL2810_check_IC)(int cardno);
typedef int (CALLBACK* LPFNDLL2810_get_abs_pos)(int ch,double *pos);
typedef int (CALLBACK* LPFNDLL2810_get_rel_pos)(int ch,double *pos);
typedef int (CALLBACK* LPFNDLL2810_get_encoder)(int ch,long *count);
typedef int (CALLBACK* LPFNDLL2810_get_done_source)(int ch,long *src);
typedef double (CALLBACK* LPFNDLL2810_get_conspeed)(int ch);
typedef double (CALLBACK* LPFNDLL2810_get_vector_conspeed)();
typedef int (CALLBACK* LPFNDLL2810_get_profile)(int ch , double *vl , double *vh , double *ad);
typedef int (CALLBACK* LPFNDLL2810_get_vector_profile)(double *vec_vl , double *vec_vh ,double *vec_ad);
typedef double (CALLBACK* LPFNDLL2810_get_rate)(int ch);
typedef int (CALLBACK* LPFNDLL2810_get_cur_dir)(int ch);
typedef int (CALLBACK* LPFNDLL2810_check_status)(int ch);
typedef int (CALLBACK* LPFNDLL2810_check_done)(int ch);
typedef int (CALLBACK* LPFNDLL2810_check_limit)(int ch);
typedef int (CALLBACK* LPFNDLL2810_check_home)(int ch);
typedef int (CALLBACK* LPFNDLL2810_check_SD)(int ch);
typedef int (CALLBACK* LPFNDLL2810_check_alarm)(int ch);
typedef int	(CALLBACK* LPFNDLL2810_check_delay_status)();
typedef int (CALLBACK* LPFNDLL2810_get_cmd_counter)();
typedef int (CALLBACK* LPFNDLL2810_reset_cmd_counter)();
typedef int (CALLBACK* LPFNDLL2810_set_cmd_counter)(int counter);
typedef int (CALLBACK* LPFNDLL2810_check_timer_num)(unsigned long *num);

//错误代码操作函数
typedef int (CALLBACK* LPFNDLL2810_get_err)(int index,int *data);
typedef int (CALLBACK* LPFNDLL2810_get_last_err)();
typedef int (CALLBACK* LPFNDLL2810_reset_err)();
//版本读取函数
typedef int (CALLBACK* LPFNDLL2810_get_lib_ver)(long* major,long *minor1,long *minor2);
typedef int (CALLBACK* LPFNDLL2810_get_sys_ver)(long* major,long *minor1,long *minor2);
typedef int (CALLBACK* LPFNDLL2810_get_card_ver)(long cardno,long *type,long* major,long *minor1,long *minor2);

//mpc.dll函数封装类
class CLoadMpc2810  
{
public:
	CLoadMpc2810();
	virtual ~CLoadMpc2810();
private:
	HINSTANCE hDLL;
	int LoadDllFun();
public:
	///////////////////////////////////
	//函数指针定义
	//控制卡和轴设置函数
	LPFNDLL2810_auto_set auto_set;
	LPFNDLL2810_init_board init_board;
	LPFNDLL2810_set_unit_flag set_unit_flag;
	LPFNDLL2810_set_outmode set_outmode;
	LPFNDLL2810_set_home_mode set_home_mode;
	LPFNDLL2810_set_dir set_dir;
	LPFNDLL2810_enable_sd enable_sd;
	LPFNDLL2810_enable_el enable_el;
	LPFNDLL2810_enable_org enable_org;
	LPFNDLL2810_enable_alm enable_alm;
	LPFNDLL2810_set_sd_logic set_sd_logic;
	LPFNDLL2810_set_el_logic set_el_logic;
	LPFNDLL2810_set_org_logic set_org_logic;
	LPFNDLL2810_set_alm_logic set_alm_logic;
	LPFNDLL2810_set_getpos_mode set_getpos_mode;
	LPFNDLL2810_set_encoder_mode set_encoder_mode;

	LPFNDLL2810_open_list open_list;
	LPFNDLL2810_close_list close_list;
	LPFNDLL2810_add_list add_list;
	LPFNDLL2810_start_lookahead start_lookahead;
	LPFNDLL2810_end_lookahead end_lookahead;

	//参数设置函数
	LPFNDLL2810_set_maxspeed set_maxspeed;
	LPFNDLL2810_set_conspeed set_conspeed;
	LPFNDLL2810_set_vector_conspeed set_vector_conspeed;
	LPFNDLL2810_set_profile set_profile;
	LPFNDLL2810_set_vector_profile set_vector_profile;
	LPFNDLL2810_c_set_vector_profile c_set_vector_profile;
	LPFNDLL2810_c_set_max_accel c_set_max_accel;
	LPFNDLL2810_c_set_multiple c_set_multiple;
	LPFNDLL2810_c_set_curve_vertex c_set_curve_vertex;
	LPFNDLL2810_set_ellipse_ratio set_ellipse_ratio;
	LPFNDLL2810_set_s_curve set_s_curve;
	LPFNDLL2810_set_s_section set_s_section;
	LPFNDLL2810_set_abs_pos set_abs_pos;
	LPFNDLL2810_reset_pos reset_pos;
	LPFNDLL2810_set_unit set_unit;
	LPFNDLL2810_set_steps_pr set_steps_pr;
	LPFNDLL2810_set_enc_thread set_enc_thread;

	//运动函数
	LPFNDLL2810_con_pmove con_pmove;
	LPFNDLL2810_con_pmove2 con_pmove2;
	LPFNDLL2810_con_pmove3 con_pmove3;
	LPFNDLL2810_con_pmove4 con_pmove4;
	LPFNDLL2810_con_pmove_to con_pmove_to;
	LPFNDLL2810_fast_pmove fast_pmove;
	LPFNDLL2810_fast_pmove2 fast_pmove2;
	LPFNDLL2810_fast_pmove3 fast_pmove3;
	LPFNDLL2810_fast_pmove4 fast_pmove4;
	LPFNDLL2810_fast_pmove_to fast_pmove_to;
	LPFNDLL2810_con_vmove con_vmove;
	LPFNDLL2810_con_vmove2 con_vmove2;
	LPFNDLL2810_con_vmove3 con_vmove3;
	LPFNDLL2810_con_vmove4 con_vmove4;
	LPFNDLL2810_fast_vmove fast_vmove;
	LPFNDLL2810_fast_vmove2 fast_vmove2;
	LPFNDLL2810_fast_vmove3 fast_vmove3;
	LPFNDLL2810_fast_vmove4 fast_vmove4;
	LPFNDLL2810_con_hmove con_hmove;
	LPFNDLL2810_con_hmove2 con_hmove2;
	LPFNDLL2810_con_hmove3 con_hmove3;
	LPFNDLL2810_con_hmove4 con_hmove4;
	LPFNDLL2810_fast_hmove fast_hmove;
	LPFNDLL2810_fast_hmove2 fast_hmove2;
	LPFNDLL2810_fast_hmove3 fast_hmove3;
	LPFNDLL2810_fast_hmove4 fast_hmove4;
	LPFNDLL2810_con_line2 con_line2;
	LPFNDLL2810_con_line3 con_line3;
	LPFNDLL2810_con_line4 con_line4;
	LPFNDLL2810_con_linen_to con_linen_to;
	LPFNDLL2810_fast_line2 fast_line2;
	LPFNDLL2810_fast_line3 fast_line3;
	LPFNDLL2810_fast_line4 fast_line4;
	LPFNDLL2810_fast_linen_to fast_linen_to;
	LPFNDLL2810_arc_center arc_center;
	LPFNDLL2810_arc_final arc_final;
	LPFNDLL2810_fast_arc_center fast_arc_center;
	LPFNDLL2810_helical_move helical_move;

	//制动函数
	LPFNDLL2810_sudden_stop sudden_stop;
	LPFNDLL2810_sudden_stop2 sudden_stop2;
	LPFNDLL2810_sudden_stop3 sudden_stop3;
	LPFNDLL2810_sudden_stop4 sudden_stop4;
	LPFNDLL2810_sudden_stop_list sudden_stop_list;
	LPFNDLL2810_decel_stop decel_stop;
	LPFNDLL2810_decel_stop2 decel_stop2;
	LPFNDLL2810_decel_stop3 decel_stop3;
	LPFNDLL2810_decel_stop4 decel_stop4;
	LPFNDLL2810_decel_stop_list decel_stop_list;
	LPFNDLL2810_move_pause move_pause;
	LPFNDLL2810_move_pause_list move_pause_list;
	LPFNDLL2810_move_resume move_resume;
	LPFNDLL2810_move_resume_list move_resume_list;
	LPFNDLL2810_delay_time delay_time;

	//I/O口操作函数
	LPFNDLL2810_checkin_byte checkin_byte;
	LPFNDLL2810_checkin_bit checkin_bit;
	LPFNDLL2810_outport_bit outport_bit;
	LPFNDLL2810_outport_byte outport_byte;
	LPFNDLL2810_check_sfr check_sfr;
	LPFNDLL2810_check_sfr_bit check_sfr_bit;
	LPFNDLL2810_Outport Outport;
	LPFNDLL2810_Inport Inport;

	//特殊功能
	LPFNDLL2810_set_backlash set_backlash;
	LPFNDLL2810_start_backlash start_backlash;
	LPFNDLL2810_end_backlash end_backlash;
	LPFNDLL2810_set_watchdog_time set_watchdog_time;
	LPFNDLL2810_reset_watchdog reset_watchdog;
	LPFNDLL2810_start_watchdog start_watchdog;
	LPFNDLL2810_stop_watchdog stop_watchdog;
	LPFNDLL2810_get_watchdog_status get_watchdog_status;
	LPFNDLL2810_enable_io_pos enable_io_pos;
	LPFNDLL2810_set_poscmp_source set_poscmp_source;
	LPFNDLL2810_set_io_pos set_io_pos;
	LPFNDLL2810_enable_lock_enc enable_lock_enc;
	LPFNDLL2810_reset_locked_flag reset_locked_flag;
	LPFNDLL2810_get_locked_flag get_locked_flag;
	LPFNDLL2810_get_locked_encoder get_locked_encoder;
	LPFNDLL2810_enable_gear enable_gear;
	LPFNDLL2810_enable_handwheel enable_handwheel;
	LPFNDLL2810_enable_softlimit enable_softlimit;
	LPFNDLL2810_set_softlimit set_softlimit;
	LPFNDLL2810_set_softlimit_data set_softlimit_data;
	LPFNDLL2810_check_softlimit check_softlimit;
	LPFNDLL2810_enable_poserr_limit enable_poserr_limit;
	LPFNDLL2810_set_poserr_limit set_poserr_limit;
	LPFNDLL2810_get_poserr_limit get_poserr_limit;
	LPFNDLL2810_enable_input_mode enable_input_mode;
	LPFNDLL2810_set_im_deadband set_im_deadband;
	LPFNDLL2810_enable_isr enable_isr;
	LPFNDLL2810_set_isr_routine set_isr_routine;
	LPFNDLL2810_set_isr_factor set_isr_factor;
	LPFNDLL2810_get_isr_event get_isr_event;
	LPFNDLL2810_set_ramp set_ramp;
	LPFNDLL2810_change_speed change_speed;
	LPFNDLL2810_change_pos change_pos;
	LPFNDLL2810_set_tan_flag set_tan_flag;
	LPFNDLL2810_set_tan_initpos set_tan_initpos;
	LPFNDLL2810_set_tan_map set_tan_map;
	LPFNDLL2810_set_tan_axis set_tan_axis;
	LPFNDLL2810_set_tan_profile set_tan_profile;
	LPFNDLL2810_set_tan_stopangle set_tan_stopangle;
	LPFNDLL2810_set_tan_io set_tan_io;

	//位置和状态查询函数
	LPFNDLL2810_get_max_axe get_max_axe;
	LPFNDLL2810_get_board_num get_board_num;
	LPFNDLL2810_get_axe get_axe;
	LPFNDLL2810_get_unit get_unit;
	LPFNDLL2810_check_IC check_IC;
	LPFNDLL2810_get_abs_pos get_abs_pos;
	LPFNDLL2810_get_rel_pos get_rel_pos;
	LPFNDLL2810_get_encoder get_encoder;
	LPFNDLL2810_get_done_source get_done_source;
	LPFNDLL2810_get_cur_dir get_cur_dir;
	LPFNDLL2810_get_conspeed get_conspeed;
	LPFNDLL2810_get_vector_conspeed get_vector_conspeed;
	LPFNDLL2810_get_profile get_profile;
	LPFNDLL2810_get_vector_profile get_vector_profile;
	LPFNDLL2810_get_rate get_rate;
	LPFNDLL2810_check_status check_status;
	LPFNDLL2810_check_done check_done;
	LPFNDLL2810_check_limit check_limit;
	LPFNDLL2810_check_home check_home;
	LPFNDLL2810_check_SD check_SD;
	LPFNDLL2810_check_alarm check_alarm;
	LPFNDLL2810_check_delay_status check_delay_status;
	LPFNDLL2810_get_cmd_counter get_cmd_counter;
	LPFNDLL2810_reset_cmd_counter reset_cmd_counter;
	LPFNDLL2810_set_cmd_counter set_cmd_counter;
	LPFNDLL2810_check_timer_num check_timer_num;

	//错误代码处理
	LPFNDLL2810_get_err get_err;
	LPFNDLL2810_get_last_err get_last_err;
	LPFNDLL2810_reset_err reset_err;

	//版本读取函数
	LPFNDLL2810_get_lib_ver get_lib_ver;
	LPFNDLL2810_get_sys_ver get_sys_ver;
	LPFNDLL2810_get_card_ver get_card_ver;

};

#endif // !defined(AFX_LOADDLL_H__B8267873_59D6_11D5_B5A0_B42C742B6543__INCLUDED_)

⌨️ 快捷键说明

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