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

📄 mpc08a.h

📁 演示vc与专业控制器的连接
💻 H
字号:
#ifndef _INTERACT_H
#define _INTERACT_H

#ifndef _MSC_VER
#define WINAPI __stdcall
#endif

#ifdef __cplusplus
extern "C" {
#endif

enum FUNCITEM
{
	TYPE0=0,
	GET_MAX_AXE,
	GET_BOARD_NUM,
	GET_AXE,
	SET_OUTMODE,
	SET_HOME_MODE,
	SET_MAXSPEED,
	SET_CONSPEED,
	GET_CONSPEED,
	SET_PROFILE,
	GET_PROFILE,
	GET_RATE,
	SET_ARC_PRECISION,
	SET_ELLIPSE_RATIO,
	TYPE1,
	CON_PMOVE,
	FAST_PMOVE,
	CON_PMOVE2,
	FAST_PMOVE2,
	CON_PMOVE3,
	FAST_PMOVE3,
	CON_PMOVE4,
	FAST_PMOVE4,
	CON_VMOVE,
	FAST_VMOVE,
	CON_VMOVE2,
	FAST_VMOVE2,
	CON_VMOVE3,
	FAST_VMOVE3,
	CON_VMOVE4,
	FAST_VMOVE4,
	CON_HMOVE,
	FAST_HMOVE,
	CON_HMOVE2,
	FAST_HMOVE2,
	CON_HMOVE3,
	FAST_HMOVE3,
	CON_HMOVE4,
	FAST_HMOVE4,
	SET_VECTOR_CONSPEED,
	SET_VECTOR_PROFILE,
	GET_VECTOR_CONSPEED,
	GET_VECTOR_PROFILE,
	CON_LINE2,
	CON_LINE3,
	CON_LINE4,
	FAST_LINE2,
	FAST_LINE3,
	FAST_LINE4,
	ARC_CENTER,
	FAST_ARC_CENTER,
	ARC_FINAL,
	HELICAL_MOVE,
	MOVE_PAUSE,
	MOVE_RESUME,
	TYPE2,
	SET_ABS_POS,
	RESET_POS,
	RESET_CMD_COUNTER,
	SET_GETPOS_MODE,
	SET_ENCODER_MODE,
	SET_DIR,
	ENABLE_SD,
	ENABLE_EL,
	ENABLE_ORG,
	ENABLE_ALM,
	SET_SD_LOGIC,
	SET_EL_LOGIC,
	SET_ORG_LOGIC,
	SET_ALM_LOGIC,
	TYPE3,
	GET_ABS_POS,
	GET_REL_POS,
	GET_ENCODER,
	GET_CUR_DIR,
	CHECK_STATUS,
	CHECK_DONE,
	CHECK_LIMIT,
	CHECK_HOME,
	CHECK_SD,
	CHECK_ALARM,
	GET_CMD_COUNTER,
	TYPE4,
	CHECKIN_BYTE,
	CHECKIN_BIT,
	OUTPORT_BIT,
	OUTPORT_BYTE,
	//SET_IO_POS,
	CHECK_SFR,
	CHECK_SFR_BIT,
	TYPE5,
	SET_BACKLASH,
	START_BACKLASH,
	END_BACKLASH,
	CHANGE_SPEED,
	CHANGE_ACCEL,
	SET_WATCHDOG_TIME,
	RESET_WATCHDOG,
	START_WATCHDOG,
	STOP_WATCHDOG,
	GET_WATCHDOG_STATUS,
	OUTPORT,
	INPORT,
	SET_RAMP_FLAG,
	CHECK_IC,
	SET_UNIT_FLAG,
	SET_UNIT,
	GET_UNIT,
	GET_ERR,
	GET_LAST_ERR,
	RESET_ERR,
	GET_LIB_VER,
	GET_SYS_VER,
	GET_CARD_VER,
};
/////////////////////////////////////////////////////
int WINAPI auto_set(void);
int WINAPI init_board(void);
int WINAPI get_max_axe(void);
int WINAPI get_board_num();
int WINAPI get_axe(int board_no);
int WINAPI set_outmode(int ch,int mode,int logic);
int WINAPI set_home_mode(int ch,int origin_mode);
int WINAPI set_maxspeed(int ch , double speed);
int WINAPI set_conspeed(int ch , double conspeed);
double WINAPI get_conspeed(int ch);
int WINAPI set_profile(int ch , double vl , double vh , double ad);
int WINAPI get_profile(int ch , double *vl , double *vh , double *ad);
int WINAPI set_vector_conspeed(double conspeed);
int WINAPI set_vector_profile(double vec_vl , double vec_vh ,double vec_ad);
double WINAPI get_vector_conspeed();
int WINAPI get_vector_profile(double *vec_vl , double *vec_vh ,double *vec_ad);
double WINAPI get_rate(int ch);
int WINAPI set_arc_precision(double precision);//设置圆弧插补精度
int WINAPI set_ellipse_ratio(double ratio);

///////////////////////////////////////////////////////////////
//运动指令函数
int WINAPI con_pmove(int ch,double step);
int WINAPI fast_pmove(int ch,double step);
int WINAPI con_pmove2(int ch1,double step1,int ch2,double step2);
int WINAPI fast_pmove2(int ch1,double step1,int ch2,double step2);
int WINAPI con_pmove3(int ch1,double step1,int ch2,double step2,int ch3,double step3);
int WINAPI fast_pmove3(int ch1,double step1,int ch2,double step2,int ch3,double step3);
int WINAPI con_pmove4(int ch1,double step1,int ch2,double step2,int ch3,double step3,int ch4,double step4);
int WINAPI fast_pmove4(int ch1,double step1,int ch2,double step2,int ch3,double step3,int ch4,double step4);
int WINAPI con_vmove(int ch,int dir);
int WINAPI fast_vmove(int ch,int dir);
int WINAPI con_vmove2(int ch1,int dir1,int ch2,int dir2);
int WINAPI fast_vmove2(int ch1,int dir1,int ch2,int dir2);
int WINAPI con_vmove3(int ch1,int dir1,int ch2,int dir2,int ch3,int dir3);
int WINAPI fast_vmove3(int ch1,int dir1,int ch2,int dir2,int ch3,int dir3);
int WINAPI con_vmove4(int ch1,int dir1,int ch2,int dir2,int ch3,int dir3,int ch4,int dir4);
int WINAPI fast_vmove4(int ch1,int dir1,int ch2,int dir2,int ch3,int dir3,int ch4,int dir4);
int WINAPI con_hmove(int ch,int dir);
int WINAPI fast_hmove(int ch,int dir);
int WINAPI con_hmove2(int ch1,int dir1,int ch2,int dir2);
int WINAPI fast_hmove2(int ch1,int dir1,int ch2,int dir2);
int WINAPI con_hmove3(int ch1,int dir1,int ch2,int dir2,int ch3,int dir3);
int WINAPI fast_hmove3(int ch1,int dir1,int ch2,int dir2,int ch3,int dir3);
int WINAPI con_hmove4(int ch1,int dir1,int ch2,int dir2,int ch3,int dir3,int ch4,int dir4);
int WINAPI fast_hmove4(int ch1,int dir1,int ch2,int dir2,int ch3,int dir3,int ch4,int dir4);
int WINAPI con_line2(int ch1,double step1,int ch2, double step2);
int WINAPI con_line3(int ch1,double step1,int ch2,double step2,int ch3,double step3);
int WINAPI con_line4(int ch1,double step1,int ch2,double step2,int ch3,double step3,int ch4,double step4);
int WINAPI fast_line2(int ch1,double step1,int ch2,double step2);
int WINAPI fast_line3(int ch1,double step1,int ch2,double step2,int ch3,double step3);
int WINAPI fast_line4(int ch1,double step1,int ch2,double step2,int ch3,double step3,int ch4,double step4);
int WINAPI arc_center(int ch1,int ch2,double cen1,double cen2,double angle );
int WINAPI arc_final(int ch1,int ch2,int dir,double fx,double fy,double r);
int WINAPI fast_arc_center(int ch1,int ch2,double cen1,double cen2,double angle );
int WINAPI helical_move(int ch1,int ch2,int ch3,double cen1,double cen2,double angle, double pitch);
///////////////////////////////////////////////////////////////
//制动函数
int WINAPI sudden_stop(int ch);
int WINAPI sudden_stop2(int ch1,int ch2);
int WINAPI sudden_stop3(int ch1,int ch2,int ch3);
int WINAPI sudden_stop4(int ch1,int ch2,int ch3,int ch4);
int WINAPI decel_stop(int ch);
int WINAPI decel_stop2(int ch1,int ch2);
int WINAPI decel_stop3(int ch1,int ch2,int ch3);
int WINAPI decel_stop4(int ch1,int ch2,int ch3,int ch4);
int WINAPI move_pause(int ch);
int WINAPI move_resume(int ch);

///////////////////////////////////////////////////////////////
//位置和状态设置函数
int WINAPI set_abs_pos(int ch,double pos);
int WINAPI reset_pos(int ch);
int WINAPI reset_cmd_counter();
int WINAPI set_getpos_mode(int ch,int mode);
int WINAPI set_encoder_mode(int ch,int mode,int multip,int count_unit);
int WINAPI set_dir(int ch,int dir);
int WINAPI enable_sd(int ch,int flag);//flag--1,有效;flag--0,无效
int WINAPI enable_el(int ch,int flag);//flag--1,有效;flag--0,无效
int WINAPI enable_org(int ch,int flag);//flag--1,有效;flag--0,无效
int WINAPI enable_alm(int flag);//flag--1,有效;flag--0,无效
int WINAPI set_sd_logic(int ch,int flag);//flag--0,低电平有效;flag--1,高电平有效
int WINAPI set_el_logic(int ch,int flag);//flag--0,低电平有效;flag--1,高电平有效
int WINAPI set_org_logic(int ch,int flag);//flag--0,低电平有效;flag--1,高电平有效
int WINAPI set_alm_logic(int flag);//flag--0,低电平有效;flag--1,高电平有效

//状态查询函数
int WINAPI get_abs_pos(int ch,double *pos);
int WINAPI get_rel_pos(int ch,double *pos);
int WINAPI get_encoder(int ch,long *count);
int WINAPI get_cur_dir(int ch);
int WINAPI check_status(int ch);
int WINAPI check_done(int ch);
int WINAPI check_limit(int ch);
int WINAPI check_home(int ch);
int WINAPI check_SD(int ch);
int WINAPI check_alarm(int ch);
//int WINAPI check_watchdog(int cardno);
int WINAPI get_cmd_counter();

///////////////////////////////////////////////////////////////
int WINAPI checkin_byte(int cardno);
int WINAPI checkin_bit(int cardno,int bitno);
int WINAPI outport_bit(int cardno,int bitno,int status);
int WINAPI outport_byte(int cardno,int bytedata);
//int WINAPI set_io_pos(int ch,long open_pos,long close_pos);
int WINAPI check_sfr(int cardno);
int WINAPI check_sfr_bit(int cardno,int bitno);

///////////////////////////////////////////////////////////////
//其它函数
int WINAPI set_backlash(int ch,double blash);
int WINAPI start_backlash(int ch);
int WINAPI end_backlash(int ch);
int WINAPI change_speed(int ch,double speed);
int WINAPI change_accel(int ch,double ad);
int WINAPI set_watchdog_time(int cardno,long time);
int WINAPI reset_watchdog(int cardno);
int WINAPI start_watchdog(int cardno);
int WINAPI stop_watchdog(int cardno);
int WINAPI get_watchdog_status(int cardno);
int WINAPI Outport(int portid,unsigned char byte); 
int WINAPI Inport(int portid);
int WINAPI check_IC(int cardno);
int WINAPI set_ramp_flag(int flag);
int WINAPI set_unit_flag(int flag);//0--pulse,1--mm
int WINAPI set_unit(double dl);//mm/p
int WINAPI get_unit(double* dl);
int WINAPI get_lib_ver(long* major,long *minor1,long *minor2);
int WINAPI get_sys_ver(long* major,long *minor1,long *minor2);
int WINAPI get_card_ver(int cardno,long* type,long* major,long *minor1,long *minor2);

//错误代码处理
int WINAPI get_err(int index,int *data);
int WINAPI get_last_err();
int WINAPI reset_err();
int WINAPI get_debug_ivar(int index,int *data);
int WINAPI get_debug_dbvar(int index,double *data);
int WINAPI get_sys_var(int index,int *data);

//MPC07调试使用
int WINAPI write_reg(int ch,int reg,long data);
int WINAPI read_reg(int ch,int reg,long *data);
int WINAPI write_card_reg(int cardno, int addr,long data);
int WINAPI read_card_reg(int cardno, int addr,long* data);

#ifdef __cplusplus
}
#endif

#endif

⌨️ 快捷键说明

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