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

📄 nmccom.h

📁 This includes the project using a stereo vision to catch the ball shot from a high pressure air cann
💻 H
字号:
#include <windows.h>

//---------------------------------------------------------------------------
#ifndef nmccomH
#define nmccomH
//---------------------------------------------------------------------------
#endif
typedef unsigned char byte;

typedef struct _NMCMOD {
	byte	modtype;		//module type
    byte	modver;			//module version number
	byte	statusitems;	//definition of items to be returned
	byte	stat;  			//status byte
    byte	groupaddr;		//current group address
    BOOL	groupleader;	//TRUE if group leader
    void *	p;				//pointer to specific module's data structure
    } NMCMOD;

#define MAXSIOERROR 2

//Define PIC baud rate divisors
#define	PB19200		64
#define	PB57600		21
#define	PB115200	10
#define	PB230400	5

//Module type definitions:
#define	SERVOMODTYPE	0
#define	ADCMODTYPE		1
#define	IOMODTYPE		2
#define	STEPMODTYPE		3
//The following must be created for each new module type:
//		data structure XXXMOD
//		Initializer function NewXXXMod
//		Status reading function GetXXXStat
//		NMCInit and SendNmcCmd must be modified to include calls
//			to the two functions above

#define CKSUM_ERROR		0x02	//Checksum error bit in status byte

//--------------------- ADC Module specific stuff --------------------------
typedef struct _ADCMOD {
    //******  Move all this data to the NMCMOD structure *******
	short int ad0;	//definition of items to be returned
	short int ad1;
	short int ad2;
	short int ad3;
	short int ad4;
	short int ad5;
    } ADCMOD;


#define MAXNUMMOD	33

//Function prototypes:
 ADCMOD *   AdcNewMod();
   BOOL AdcGetStat(byte addr);

//Initialization and shutdown
   int NmcInit(char *portname, unsigned int baudrate);
   void InitVars(void);
   BOOL NmcSendCmd(byte addr, byte cmd, char *datastr, byte n, byte stataddr);
   void FixSioError(byte addr);
   void NmcShutdown(void);

//Module type independant commands (supported by all module types)
   BOOL NmcSetGroupAddr(byte addr, byte groupaddr, BOOL leader);
   BOOL NmcDefineStatus(byte addr, byte statusitems);
   BOOL NmcReadStatus(byte addr, byte statusitems);
   BOOL NmcSynchOutput(byte groupaddr, byte leaderaddr);
   BOOL NmcChangeBaud(byte groupaddr, unsigned int baudrate);
   BOOL NmcSynchInput(byte groupaddr, byte leaderaddr);
   BOOL NmcNoOp(byte addr);
   BOOL NmcHardReset(byte addr);

//Retrieve module type independant data from a module's data structure
   byte NmcGetStat(byte addr);
   byte NmcGetStatItems(byte addr);
   byte NmcGetModType(byte addr);
   byte NmcGetModVer(byte addr);
   byte NmcGetGroupAddr(byte addr);
   BOOL NmcGroupLeader(byte addr);




⌨️ 快捷键说明

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