📄 loaddll.h
字号:
// LoadDll.h: interface for the CLoadDll class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_LOADDLL_H__B8267873_59D6_11D5_B5A0_B42C742B6543__INCLUDED_)
#define AFX_LOADDLL_H__B8267873_59D6_11D5_B5A0_B42C742B6543__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
//////////////////////////////////////////////////////////
//DLL函数指针类型定义
typedef int (CALLBACK* LPFNDLL_set_board_num)(int num);
typedef int (CALLBACK* LPFNDLL_set_axe)(int board_no,int num);
typedef int (CALLBACK* LPFNDLL_set_board_base)(int board_no,int b);
typedef int (CALLBACK* LPFNDLL_get_board_base)(int board_no);
typedef int (CALLBACK* LPFNDLL_get_max_axe)(void);
typedef int (CALLBACK* LPFNDLL_auto_set)(void);
typedef int (CALLBACK* LPFNDLL_init_board)(void);
typedef int (CALLBACK* LPFNDLL_check_board)(void);
typedef int (CALLBACK* LPFNDLL_auto_check)(void);
typedef int (CALLBACK* LPFNDLL_set_outmode)(int ch,int mode,int logic);
typedef int (CALLBACK* LPFNDLL_set_getpos_mode)(int ch,int mode);
typedef int (CALLBACK* LPFNDLL_set_home_mode)(int ch,int origin_mode);
typedef int (CALLBACK* LPFNDLL_set_board_irq)(int board_no,int IRQ_no);
typedef int (CALLBACK* LPFNDLL_get_board_irq)(int b_no);
typedef int (CALLBACK* LPFNDLL_get_intr_vector)(int b_no);
typedef int (CALLBACK* LPFNDLL_enable_axis_intr)(int ch);
typedef int (CALLBACK* LPFNDLL_disable_axis_intr)(int ch);
typedef int (CALLBACK* LPFNDLL_get_axis_intr)(int axis);
typedef int (CALLBACK* LPFNDLL_enable_board_irq)(int b_no);
typedef int (CALLBACK* LPFNDLL_enable_timer_irq)(void);
typedef int (CALLBACK* LPFNDLL_disable_board_irq)(int b_no);
typedef int (CALLBACK* LPFNDLL_disable_timer_irq)(void);
typedef int (CALLBACK* LPFNDLL_set_board_isr)(int(*my_irq)());
typedef int (CALLBACK* LPFNDLL_set_timer_isr)(int(*my_irq)());
typedef void (CALLBACK* LPFNDLL_init_8254)(void);
typedef void (CALLBACK* LPFNDLL_enable_8254)(int enable);
typedef int (CALLBACK* LPFNDLL_set_conspeed)(int ch , double conspeed);
typedef int (CALLBACK* LPFNDLL_set_iconspeed)(int ch , double conspeed);
typedef double (CALLBACK* LPFNDLL_get_conspeed)(int ch);
typedef int (CALLBACK* LPFNDLL_set_vector_conspeed)(double conspeed);
typedef int (CALLBACK* LPFNDLL_get_vector_profile)(double *vec_vl , double *vec_vh ,double *vec_ad);
typedef int (CALLBACK* LPFNDLL_set_vector_profile)(double vec_vl , double vec_vh ,double vec_ad);
typedef int (CALLBACK* LPFNDLL_set_ellipse_ratio)(float ratio);
typedef int (CALLBACK* LPFNDLL_set_s_curve)(int ch,int flag);
typedef int (CALLBACK* LPFNDLL_set_s_section)(int ch,double rate1,double rate2);
typedef int (CALLBACK* LPFNDLL_set_profile)(int ch , double vl , double vh , double ad);
typedef int (CALLBACK* LPFNDLL_get_profile)(int ch , double *vl , double *vh , double *ad);
typedef int (CALLBACK* LPFNDLL_set_mprofile)(int ch,double FL,double FH,double AD,double DD);
typedef int (CALLBACK* LPFNDLL_change_accel)(int ch,long accel_rate);
typedef int (CALLBACK* LPFNDLL_change_decel)(int ch,long decel_rate);
typedef int (CALLBACK* LPFNDLL_change_speed)(int ch,double speed);
typedef int (CALLBACK* LPFNDLL_get_abs_pos)(int ch,long *pos);
typedef int (CALLBACK* LPFNDLL_get_rel_pos)(int ch,long *pos);
typedef int (CALLBACK* LPFNDLL_reset_pos)(int ch);
typedef void (CALLBACK* LPFNDLL_set_encoder)(int ch);
typedef int (CALLBACK* LPFNDLL_get_encoder)(int ch,long *count);
typedef int (CALLBACK* LPFNDLL_wait_done)(int ch);
typedef int (CALLBACK* LPFNDLL_wait_done2)(int ch1,int ch2);
typedef int (CALLBACK* LPFNDLL_check_done)(int ch);
typedef int (CALLBACK* LPFNDLL_check_done2)(int ch1,int ch2);
typedef void (CALLBACK* LPFNDLL_decel_stop)(int ch);
typedef void (CALLBACK* LPFNDLL_decel_stop2)(int ch1,int ch2);
typedef void (CALLBACK* LPFNDLL_decel_stop3)(int ch1,int ch2,int ch3);
typedef void (CALLBACK* LPFNDLL_sudden_stop)(int ch);
typedef void (CALLBACK* LPFNDLL_sudden_stop2)(int ch1,int ch2);
typedef void (CALLBACK* LPFNDLL_sudden_stop3)(int ch1,int ch2,int ch3);
typedef int (CALLBACK* LPFNDLL_check_status)(int ch);
typedef int (CALLBACK* LPFNDLL_con_hmove)(int ch,int dir);
typedef int (CALLBACK* LPFNDLL_con_hmove2)(int ch1,int dir1,int ch2,int dir2);
typedef int (CALLBACK* LPFNDLL_con_hmove3)(int ch1,int dir1,int ch2,int dir2,int ch3,int dir3);
typedef int (CALLBACK* LPFNDLL_fast_hmove)(int ch,int dir);
typedef int (CALLBACK* LPFNDLL_fast_hmove2)(int ch1,int dir1,int ch2,int dir2);
typedef int (CALLBACK* LPFNDLL_fast_hmove3)(int ch1,int dir1,int ch2,int dir2,int ch3,int dir3);
typedef int (CALLBACK* LPFNDLL_con_vmove)(int ch,int dir);
typedef int (CALLBACK* LPFNDLL_con_vmove2)(int ch1,int dir1,int ch2,int dir2);
typedef int (CALLBACK* LPFNDLL_con_vmove3)(int ch1,int dir1,int ch2,int dir2,int ch3,int dir3);
typedef int (CALLBACK* LPFNDLL_fast_vmove)(int ch,int dir);
typedef int (CALLBACK* LPFNDLL_fast_vmove2)(int ch1,int dir1,int ch2,int dir2);
typedef int (CALLBACK* LPFNDLL_fast_vmove3)(int ch1,int dir1,int ch2,int dir2,int ch3,int dir3);
typedef int (CALLBACK* LPFNDLL_con_pmove)(int ch,long step);
typedef int (CALLBACK* LPFNDLL_con_ipmove)(int ch,long step);
typedef int (CALLBACK* LPFNDLL_con_pmove2)(int ch1,long step1,int ch2,long step2);
typedef int (CALLBACK* LPFNDLL_con_pmove3)(int ch1,long step1,int ch2,long step2,int ch3,long step3);
typedef int (CALLBACK* LPFNDLL_fast_pmove)(int ch,long step);
typedef int (CALLBACK* LPFNDLL_fast_pmove2)(int ch1,long step1,int ch2,long step2);
typedef int (CALLBACK* LPFNDLL_fast_pmove3)(int ch1,long step1,int ch2,long step2,int ch3,long step3);
typedef int (CALLBACK* LPFNDLL_con_line2)(int CHX,long pos1,int CHY, long pos2);
typedef int (CALLBACK* LPFNDLL_con_line3)(int ch1,long pos1,int ch2,long pos2,int ch3,long pos3);
typedef int (CALLBACK* LPFNDLL_con_line4)(long pos1,long pos2,long pos3,long pos4);
typedef int (CALLBACK* LPFNDLL_fast_line2)(int CHX,long pos1,int CHY, long pos2);
typedef int (CALLBACK* LPFNDLL_fast_line3)(int ch1,long pos1,int ch2,long pos2,int ch3,long pos3);
typedef int (CALLBACK* LPFNDLL_fast_line4)(long pos1,long pos2,long pos3,long pos4);
typedef int (CALLBACK* LPFNDLL_arc_pmove2)(int ch1,long step1,int ch2,long step2);
typedef int (CALLBACK* LPFNDLL_arc_center)(int CHX,int CHY,long cen1,long cen2,double angle);
typedef int (CALLBACK* LPFNDLL_fast_arc_center)(int CHX,int CHY,long cen1,long cen2,double angle);
typedef int (CALLBACK* LPFNDLL_arc_final)(int ch1,int ch2,int dir,long fx,long fy,long r);
typedef int (CALLBACK* LPFNDLL_arc_fast)(int x_ch,int y_ch,long cen1,long cen2,float angle);
typedef int (CALLBACK* LPFNDLL_repeat_pmove)(int ch,long dist,int dwell_time);
typedef int (CALLBACK* LPFNDLL_helical_move)(int CHX,int CHY,long cen1,long cen2,float angle,\
int CHZ,long pitch);
typedef int (CALLBACK* LPFNDLL_start_backlash)(int axis);
typedef int (CALLBACK* LPFNDLL_end_backlash)(int axis);
typedef int (CALLBACK* LPFNDLL_set_backlash)(int axis,int blash);
typedef void (CALLBACK* LPFNDLL_write_com)(int ch, int command);
typedef void (CALLBACK* LPFNDLL_write_3byte)(int ch,int reg_com,long data_value);
typedef int (CALLBACK* LPFNDLL_get_count)(int ch,long *count);
typedef int (CALLBACK* LPFNDLL_DmcSetBatchProcessFlag)(int Flag);
typedef int (CALLBACK* LPFNDLL_DmcGetLastError)();
typedef int (CALLBACK* LPFNDLL_DmcGetError)(int Index);
typedef int (CALLBACK* LPFNDLL_DmcResetError)();
typedef int (CALLBACK* LPFNDLL_set_batch_flag)(int flag);
typedef int (CALLBACK* LPFNDLL_get_last_err)();
typedef int (CALLBACK* LPFNDLL_get_err)(int index);
typedef int (CALLBACK* LPFNDLL_reset_err)();
typedef int (CALLBACK* LPFNDLL_DmcSetMultCmdRampFlag)(int Flag);
typedef int (CALLBACK* LPFNDLL_set_ramp_flag)(int flag);
typedef int (CALLBACK* LPFNDLL_change_vmove)(int ch,long LowSpeedDis,long HighSpeedDis,int dir);
typedef long (CALLBACK* LPFNDLL_get_cur_dir)(int ch);
typedef long (CALLBACK* LPFNDLL_set_abs_pos)(int ch,long pos);
typedef int (CALLBACK* LPFNDLL_set_dir)(int ch,int dir);
typedef int (CALLBACK* LPFNDLL_check_alarm)(int ch);
typedef int (CALLBACK* LPFNDLL_check_SD)(int ch);
typedef int (CALLBACK* LPFNDLL_delay_time)(long time);
typedef int (CALLBACK* LPFNDLL_check_delay_status)();
typedef int (CALLBACK* LPFNDLL_Outport)(int portid,unsigned char byte);
typedef int (CALLBACK* LPFNDLL_Inport)(int portid);
typedef int (CALLBACK* LPFNDLL_check_limit)(int ch);
typedef int (CALLBACK* LPFNDLL_check_home)(int ch);
typedef int (CALLBACK* LPFNDLL_check_batch_done)();
typedef int (CALLBACK* LPFNDLL_check_buffer)();
typedef int (CALLBACK* LPFNDLL_set_port)(int ch,int state);
typedef int (CALLBACK* LPFNDLL_check_EncB)(int ch);
typedef int (CALLBACK* LPFNDLL_check_EncZ)(int ch);
typedef int (CALLBACK* LPFNDLL_checkin_byte)(int cardno);
typedef int (CALLBACK* LPFNDLL_checkin_bit)(int cardno,int bitno);
typedef int (CALLBACK* LPFNDLL_outport_byte)(int cardno,int bytedata);
typedef int (CALLBACK* LPFNDLL_outport_bit)(int cardno,int bitno,int status);
typedef int (CALLBACK* LPFNDLL_set_servo_clr)(int ch,int status);
typedef int (CALLBACK* LPFNDLL_set_servo_on)(int ch,int status);
typedef int (CALLBACK* LPFNDLL_set_home_logic)(int ch,int logic);
typedef void (CALLBACK* LPFNDLL_set_arc_precision)(double precision);
typedef int (CALLBACK* LPFNDLL_get_cmd_counter)();
typedef int (CALLBACK* LPFNDLL_reset_cmd_counter)();
typedef int (CALLBACK* LPFNDLL_get_lib_ver)();
typedef int (CALLBACK* LPFNDLL_check_IC)();
///////////////////////////////
//mpc02.dll函数封装类
class CLoadDll
{
public:
CLoadDll();
virtual ~CLoadDll();
private:
HINSTANCE hDLL;
int LoadDllFun();
public:
///////////////////////////////////
//函数指针定义
LPFNDLL_set_board_num set_board_num;
LPFNDLL_set_axe set_axe;
LPFNDLL_set_board_base set_board_base;
LPFNDLL_get_board_base get_board_base;
LPFNDLL_get_max_axe get_max_axe;
LPFNDLL_auto_set auto_set;
LPFNDLL_init_board init_board;
LPFNDLL_check_board check_board;
LPFNDLL_auto_check auto_check;
LPFNDLL_set_outmode set_outmode;
LPFNDLL_set_getpos_mode set_getpos_mode;
LPFNDLL_set_home_mode set_home_mode;
LPFNDLL_set_board_irq set_board_irq;
LPFNDLL_get_board_irq get_board_irq;
LPFNDLL_get_intr_vector get_intr_vector;
LPFNDLL_enable_axis_intr enable_axis_intr;
LPFNDLL_disable_axis_intr disable_axis_intr;
LPFNDLL_get_axis_intr get_axis_intr;
LPFNDLL_enable_board_irq enable_board_irq;
LPFNDLL_enable_timer_irq enable_timer_irq;
LPFNDLL_disable_board_irq disable_board_irq;
LPFNDLL_disable_timer_irq disable_timer_irq;
LPFNDLL_set_board_isr set_board_isr;
LPFNDLL_set_timer_isr set_timer_isr;
LPFNDLL_init_8254 init_8254;
LPFNDLL_enable_8254 enable_8254;
LPFNDLL_set_conspeed set_conspeed;
LPFNDLL_set_iconspeed set_iconspeed;
LPFNDLL_get_conspeed get_conspeed;
LPFNDLL_set_vector_conspeed set_vector_conspeed;
LPFNDLL_get_vector_profile get_vector_profile;
LPFNDLL_set_vector_profile set_vector_profile;
LPFNDLL_set_ellipse_ratio set_ellipse_ratio;
LPFNDLL_set_s_curve set_s_curve;
LPFNDLL_set_s_section set_s_section;
LPFNDLL_set_profile set_profile;
LPFNDLL_get_profile get_profile;
LPFNDLL_set_mprofile set_mprofile;
LPFNDLL_change_accel change_accel;
LPFNDLL_change_decel change_decel;
LPFNDLL_change_speed change_speed;
LPFNDLL_get_abs_pos get_abs_pos;
LPFNDLL_get_rel_pos get_rel_pos;
LPFNDLL_reset_pos reset_pos;
LPFNDLL_set_encoder set_encoder;
LPFNDLL_get_encoder get_encoder;
LPFNDLL_wait_done wait_done;
LPFNDLL_wait_done2 wait_done2;
LPFNDLL_check_done check_done;
LPFNDLL_check_done2 check_done2;
LPFNDLL_decel_stop decel_stop;
LPFNDLL_decel_stop2 decel_stop2;
LPFNDLL_decel_stop3 decel_stop3;
LPFNDLL_sudden_stop sudden_stop;
LPFNDLL_sudden_stop2 sudden_stop2;
LPFNDLL_sudden_stop3 sudden_stop3;
LPFNDLL_check_status check_status;
LPFNDLL_con_hmove con_hmove;
LPFNDLL_con_hmove2 con_hmove2;
LPFNDLL_con_hmove3 con_hmove3;
LPFNDLL_fast_hmove fast_hmove;
LPFNDLL_fast_hmove2 fast_hmove2;
LPFNDLL_fast_hmove3 fast_hmove3;
LPFNDLL_con_vmove con_vmove;
LPFNDLL_con_vmove2 con_vmove2;
LPFNDLL_con_vmove3 con_vmove3;
LPFNDLL_fast_vmove fast_vmove;
LPFNDLL_fast_vmove2 fast_vmove2;
LPFNDLL_fast_vmove3 fast_vmove3;
LPFNDLL_con_pmove con_pmove;
LPFNDLL_con_ipmove con_ipmove;
LPFNDLL_con_pmove2 con_pmove2;
LPFNDLL_con_pmove3 con_pmove3;
LPFNDLL_fast_pmove fast_pmove;
LPFNDLL_fast_pmove2 fast_pmove2;
LPFNDLL_fast_pmove3 fast_pmove3;
LPFNDLL_con_line2 con_line2;
LPFNDLL_con_line3 con_line3;
LPFNDLL_con_line4 con_line4;
LPFNDLL_fast_line2 fast_line2;
LPFNDLL_fast_line3 fast_line3;
LPFNDLL_fast_line4 fast_line4;
LPFNDLL_arc_pmove2 arc_pmove2;
LPFNDLL_arc_center arc_center;
LPFNDLL_fast_arc_center fast_arc_center;
LPFNDLL_arc_final arc_final;
LPFNDLL_repeat_pmove repeat_pmove;
LPFNDLL_helical_move helical_move;
LPFNDLL_start_backlash start_backlash;
LPFNDLL_end_backlash end_backlash;
LPFNDLL_set_backlash set_backlash;
LPFNDLL_write_com write_com;
LPFNDLL_write_3byte write_3byte;
LPFNDLL_get_count get_count;
LPFNDLL_DmcSetBatchProcessFlag DmcSetBatchProcessFlag;
LPFNDLL_DmcGetLastError DmcGetLastError;
LPFNDLL_DmcGetError DmcGetError;
LPFNDLL_DmcResetError DmcResetError;
LPFNDLL_set_batch_flag set_batch_flag;
LPFNDLL_get_last_err get_last_err;
LPFNDLL_get_err get_err;
LPFNDLL_reset_err reset_err;
LPFNDLL_DmcSetMultCmdRampFlag DmcSetMultCmdRampFlag;
LPFNDLL_set_ramp_flag set_ramp_flag;
LPFNDLL_change_vmove change_vmove;
LPFNDLL_get_cur_dir get_cur_dir;
LPFNDLL_set_abs_pos set_abs_pos;
LPFNDLL_set_dir set_dir;
LPFNDLL_check_alarm check_alarm;
LPFNDLL_check_SD check_SD;
LPFNDLL_delay_time delay_time;
LPFNDLL_check_delay_status check_delay_status;
LPFNDLL_Outport Outport;
LPFNDLL_Inport Inport;
LPFNDLL_check_home check_home;
LPFNDLL_check_limit check_limit;
LPFNDLL_check_batch_done check_batch_done;
LPFNDLL_check_buffer check_buffer;
LPFNDLL_set_port set_port;
LPFNDLL_check_EncB check_EncB;
LPFNDLL_check_EncZ check_EncZ;
LPFNDLL_checkin_byte checkin_byte;
LPFNDLL_checkin_bit checkin_bit;
LPFNDLL_outport_byte outport_byte;
LPFNDLL_outport_bit outport_bit;
LPFNDLL_set_servo_clr set_servo_clr;
LPFNDLL_set_servo_on set_servo_on;
LPFNDLL_set_home_logic set_home_logic;
LPFNDLL_set_arc_precision set_arc_precision;
LPFNDLL_get_cmd_counter get_cmd_counter;
LPFNDLL_reset_cmd_counter reset_cmd_counter;
LPFNDLL_get_lib_ver get_lib_ver;
LPFNDLL_check_IC check_IC;
};
#endif // !defined(AFX_LOADDLL_H__B8267873_59D6_11D5_B5A0_B42C742B6543__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -