can.h 2.23 KB
#ifndef __CAN_H
#define __CAN_H	 
#include "sys.h"	    
	
//CAN1接收RX0中断使能
#define CAN1_RX0_INT_ENABLE	1		//0,不使能;1,使能.								    
//#define PI 3.1415926
//										 							 				    
//typedef struct {
//		float Velocity; //  mm/s
//		double Position;  //mm
//		signed long speed;
//		signed long local;
//		signed long local_old;
//		unsigned short err;
//		double local_delta;

//	
//	
//}Motor;//由于最早只有驱动是CAN,所以在CAN的头文件中添加了关于轴相关的变量

//extern Motor Motor1;
//extern Motor Motor2;
//extern Motor Motor3;//最早的车是世远的车,只有3轴,行走2个+1升降轴
//extern signed long origin;

u8 CAN1_Mode_Init(u8 tsjw,u8 tbs2,u8 tbs1,u16 brp,u8 mode);//CAN初始化
//extern CanTxMsg tx_message;
////下述这些有点模仿倍福的意思,把轴的功能申明定义了
//void MC_Jog(unsigned short id,float local,signed long Velocity,u8 mode);//轴点动 速度M/S 距离MM
////void MC_GearOut(void);//解耦
//void speed_set_rpm(unsigned short id,signed long Velocity,signed long a,signed long d);//单位rpm/min
//void speed_set_mmps(unsigned short id,signed long Velocity,signed long a,signed long d);//单位mm/s

////轴函数-直接与驱动地址关联读取或者修改的函数
//void MC_Mode_Set(unsigned short id,unsigned char Mode);//驱动模式选择函数
//void MC_ControlWord(unsigned short id,unsigned short ControlWord);//驱动控制字配置函数
//void MC_Pos_Set(unsigned short id,signed long PosVa);//驱动位置参数配置函数(适用于位置模式+插补模式)
//void MC_PosSpeed_set(unsigned short id,signed long PosSpeed);//驱动梯形速度参数配置函数(适用于位置模式时的速度)
//void MC_TargetSpeed_set(unsigned short id,signed long TargetSpeed);//目标速度参数配置函数(适用于速度模式下)
//void MC_Accelerated_speed_set(unsigned short id,unsigned long acc);//驱动加速度配置函数
//void MC_Decelerated_speed_set(unsigned short id,unsigned long dec);//驱动减速度配置函数
//void MC_Read_State(unsigned short id);//读取轴状态
//void MC_Read_ActualVelocity(unsigned short id);//读取当前速度
//void MC_Read_ActualPosition(unsigned short id);//读取当前位置
//void MC_Read_ActualCurrent(unsigned short id);//读取轴电流
//void MC_Read_ErrCode(unsigned short id);//读取驱动错误码
//void MC_Read_ServoDin(unsigned short id);//读取轴状态	
//void MC_Read_ServoDout(unsigned short id);//读取轴状态






#endif