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

📄 runtime.h

📁 美国Delta Tau公司PMAC多轴运动控制卡的VC++示例程序
💻 H
📖 第 1 页 / 共 3 页
字号:
#ifndef RUNTIME_H
  #define RUNTIME_H

  #include "Pmacu.h"
  extern  HINSTANCE   hPmacLib; // Instantiated in Runtime.CPP
  
  #define DRIVERNAME          TEXT("Pcomm32.dll") //name of the user-dll driver

  #ifdef  __BORLANDC__
    #ifdef  __BORLANDC__ >= 0x0530 // C Builder 3.0 doesn't do enums
      #define PROGRAM        int   // as ints if we are using vcl so
      #define MOTION         int   // make them ints
      #define MOTIONMODE     int
      #define PMACDEVICETYPE int
      #define ASCIIMODE      int
      #define BUSTYPE        int
      #define LOCATIONTYPE   int
      #define GATMODE        int
    #endif
  #endif

//************************************************************************
// COMM Type Defines
//************************************************************************
typedef void( CALLBACK *PMACDPRPCITEST ) ( DWORD dwDevice );
typedef BOOL( CALLBACK *OPENPMACDEVICE ) ( DWORD dwDevice );
typedef long (CALLBACK * SELECTPMACDEVICE) ( HWND hwnd );
typedef long (CALLBACK *NUMBEROFDEVICES)();
typedef BOOL (CALLBACK *CLOSEPMACDEVICE) ( DWORD dwDevice );
typedef BOOL (CALLBACK *PMACSETLANGUAGE) ( const DWORD dwDevice, char *locale );
typedef BOOL (CALLBACK *PMACSETWINDOW) ( DWORD dwDevice, HWND hWnd );
typedef void (CALLBACK *PMACLMH) ( HANDLE * hndl );
typedef BOOL (CALLBACK *SETLANGUAGEMODULE) ( const char *locale, const HANDLE hProcess, HANDLE * h );
typedef LPSTR( CALLBACK *SZLOADSTRINGA ) ( HANDLE hInst, int iID );
typedef PCHAR( CALLBACK *SZSTRIPCONTROLCHARA ) ( PCHAR str );
typedef PCHAR (CALLBACK *SZSTRIPWHITESPACEA) ( PCHAR str );
typedef int (CALLBACK *GETERROR) ( DWORD dwDevice );
typedef ASCIIMODE (CALLBACK *GETASCIICOMM) ( DWORD dwDevice );
typedef BOOL (CALLBACK *SETASCIICOMM) ( DWORD dwDevice, ASCIIMODE m );
typedef LOCATIONTYPE (CALLBACK *GETLOCATION) (DWORD dwDevice);
typedef int (CALLBACK *GETENUMERATION) (DWORD dwDevice);
typedef BOOL (CALLBACK *MOTIONBUFOPEN) ( DWORD dwDevice );
typedef BOOL (CALLBACK *ROTBUFOPEN) ( DWORD dwDevice );
typedef BOOL (CALLBACK *GETVARIABLESTRA) ( DWORD dwDevice, CHAR ch, LPSTR str, UINT num );
typedef short int (CALLBACK *GETIVARIABLE) ( DWORD dwDevice, UINT num, short int def );
typedef long (CALLBACK *GETVARIABLELONG) ( DWORD dwDevice, TCHAR ch, UINT num, long def );
typedef double (CALLBACK *GETVARIABLEDOUBLE) ( DWORD dwDevice, TCHAR ch, UINT num, double def );
typedef long (CALLBACK *GETIVARIABLELONG) ( DWORD dwDevice, UINT num, long def );
typedef double (CALLBACK *GETIVARIABLEDOUBLE) ( DWORD dwDevice, UINT num, double def );
typedef void (CALLBACK *SETIVARIABLE) ( DWORD dwDevice, UINT num, short int val );
typedef void (CALLBACK *SETIVARIABLELONG) ( DWORD dwDevice, UINT num, long val );
typedef void (CALLBACK *SETIVARIABLEDOUBLE) ( DWORD dwDevice, UINT num, double val );
typedef int (CALLBACK *GETPROGRAMINFO) ( DWORD dwDevice, BOOL plc, int num, UINT * sadr, UINT * fadr );
//typedef int    (CALLBACK* GETProgramInfo)(DWORD dwDevice,BOOL plc,int num,UINT *sadr,UINT *fadr);
typedef PUSER_HANDLE( CALLBACK *GETUSERHANDLE ) ( DWORD dwDevice );
typedef BOOL (CALLBACK *CONFIGURE) ( HWND hwnd, DWORD dwDevice );
typedef void (CALLBACK *LOCKPMAC) ( DWORD dwDevice );
typedef void (CALLBACK *RELEASEPMAC) ( DWORD dwDevice );
typedef BOOL (CALLBACK *SETCRITICALIVARS) ( DWORD dwDevice );
typedef BOOL (CALLBACK *PMACISTURBO) ( DWORD dwDevice );
typedef BOOL (CALLBACK *DOCHECKSUMS) ( DWORD dwDevice, BOOL bVal );

typedef BOOL (CALLBACK *SERDOCHECKSUMS) ( DWORD dwDevice, BOOL do_checksums );
typedef BOOL (CALLBACK *SERCHECKSENDLINEA) ( DWORD dwDevice, char *outstr, char *command_csum );
typedef int (CALLBACK *SERCHECKGETLINEA) ( DWORD dwDevice, PCHAR response, UINT maxchar, PUINT num_char );
typedef int (CALLBACK *SERCHECKRESPONSEA) ( DWORD dwDevice, char *response, UINT maxchar, char *outstr );
typedef int (CALLBACK *SERCHECKALLWENTWELL)(DWORD dwDevice,int ret,char *cp,char csum) ;

typedef DWORD( CALLBACK *SERGETPORT ) ( DWORD dwDevice );
//typedef BOOL (CALLBACK *SERSETPORT) ( DWORD dwDevice, DWORD p );
typedef DWORD (CALLBACK *SERGETBAUDRATE) ( DWORD dwDevice );
typedef BOOL (CALLBACK *SERSETBAUDRATE) ( DWORD dwDevice, DWORD br );

// ASCII string exported functions
typedef PCHAR (CALLBACK *GETROMDATEA) ( DWORD dwDevice, LPSTR s, int maxchar );
typedef PCHAR (CALLBACK *GETROMVERSIONA) ( DWORD dwDevice, LPSTR s, int maxchar );
typedef int (CALLBACK *GETPMACTYPE) ( DWORD dwDevice );
typedef BOOL (CALLBACK *GETIVARIABLESTRA) ( DWORD dwDevice, LPSTR str, UINT num );
typedef int (CALLBACK *MULTIDOWNLOADA) ( DWORD dwDevice, DOWNLOADMSGPROC msgp, LPCSTR outfile,
                LPCSTR inifile, LPCSTR szUserId, BOOL macro, BOOL map, BOOL log, BOOL dnld );
typedef int (CALLBACK *ADDDOWNLOADFILEA) ( DWORD dwDevice, LPCSTR inifile, LPCSTR szUserId, LPCSTR szDLFile );
typedef int (CALLBACK *REMOVEDOWNLOADFILEA) ( DWORD dwDevice, LPCSTR inifile, LPCSTR szUserId, LPCSTR szDLFile );
typedef void (CALLBACK *RENUMBERFILESA) ( DWORD dwDevice, int file_num, LPCSTR szIniFile );
typedef int (CALLBACK *GETERRORSTRA) ( DWORD dwDevice, LPSTR str, int maxchar );

// Unicode string exported functions
typedef BOOL (CALLBACK *GETIVARIABLESTRW) ( DWORD dwDevice, LPWSTR str, UINT num );
typedef WORD( CALLBACK *GETPLCSTATUS ) ( DWORD dwDevice, TOTAL_PLC_STATUS_STRUCT *plc_stat );
typedef WORD( CALLBACK *ISANYPLCRUNNING) (DWORD dwDevice);

typedef int (CALLBACK *MULTIDOWNLOADW) ( DWORD dwDevice, DOWNLOADMSGPROC msgp, PWCHAR outfile,
                PWCHAR inifile, PWCHAR szUserId, BOOL macro, BOOL map, BOOL log, BOOL dnld );
typedef int (CALLBACK *ADDDOWNLOADFILEW) ( DWORD dwDevice, PWCHAR inifile, PWCHAR szUserId, PWCHAR szDLFile );
typedef int (CALLBACK *REMOVEDOWNLOADFILEW) ( DWORD dwDevice, PWCHAR inifile, PWCHAR szUserId, PWCHAR szDLFile );
typedef void (CALLBACK *RENUMBERFILESW) ( DWORD dwDevice, int file_num, PWCHAR szIniFile );
typedef int (CALLBACK *GETERRORSTRW) ( DWORD dwDevice, PWCHAR str, int maxchar );


typedef BOOL (CALLBACK *READREADY) ( DWORD dwDevice );
typedef int (CALLBACK *SENDCHARA) ( DWORD dwDevice, CHAR outch );
typedef int (CALLBACK *SENDCHARW) ( DWORD dwDevice, WCHAR outch );
typedef int (CALLBACK *SENDLINEA) ( DWORD dwDevice, LPCTSTR outstr );
typedef int (CALLBACK *SENDLINEW) ( DWORD dwDevice, PWCHAR outstr );
typedef int (CALLBACK *GETLINEA) ( DWORD dwDevice, LPTSTR s, UINT maxchar );
typedef int (CALLBACK *GETLINEEXA) ( DWORD dwDevice, LPTSTR s, UINT maxchar );
typedef int (CALLBACK *WAITGETLINEA) ( DWORD dwDevice, LPTSTR s, UINT maxchar );
typedef int (CALLBACK *GETLINEW) ( DWORD dwDevice, PWCHAR s, UINT maxchar );
typedef int (CALLBACK *GETRESPONSEA) ( DWORD dwDevice, LPTSTR s, UINT maxchar, LPCTSTR outstr );
typedef int (CALLBACK *GETRESPONSEW) ( DWORD dwDevice, PWCHAR s, UINT maxchar, PWCHAR outstr );
typedef int (CALLBACK *GETCONTROLRESPONSEA) ( DWORD dwDevice, LPTSTR s, UINT maxchar, CHAR outchar );
typedef int (CALLBACK *GETCONTROLRESPONSEW) ( DWORD dwDevice, PWCHAR s, UINT maxchar, WCHAR outchar );
typedef int (CALLBACK *GETRESPONSEEXA) ( DWORD dwDevice, LPTSTR s, UINT maxchar, LPCTSTR outstr );
typedef int (CALLBACK *GETRESPONSEEXW) ( DWORD dwDevice, PWCHAR s, UINT maxchar, PWCHAR outstr );
typedef int (CALLBACK *GETCONTROLRESPONSEEXA) ( DWORD dwDevice, LPTSTR s, UINT maxchar, CHAR outchar );
typedef int (CALLBACK *GETCONTROLRESPONSEEXW) ( DWORD dwDevice, PWCHAR s, UINT maxchar, WCHAR outchar );
typedef void (CALLBACK *FLUSH) ( DWORD dwDevice );
typedef void (CALLBACK *SENDCOMMANDA) ( DWORD dwDevice, LPCTSTR outchar );
typedef void (CALLBACK *SENDCOMMANDW) ( DWORD dwDevice, PWCHAR outstr );
typedef int (CALLBACK *SENDCTRLCHARA) ( DWORD dwDevice, CHAR outstr );
typedef int (CALLBACK *SENDCTRLCHARW) ( DWORD dwDevice, WCHAR outstr );
typedef BOOL (CALLBACK *INBOOTSTRAP) ( DWORD dwDevice );
typedef int (CALLBACK *GETBUFFERA) ( DWORD dwDevice, LPTSTR s, UINT maxchar );
typedef BOOL (CALLBACK *PMACCONFIGURE) ( HANDLE hwnd, DWORD dwDevice );
typedef LONG( CALLBACK *TESTDPRAM ) ( DWORD dwDevice, DPRTESTMSGPROC msgp, DPRTESTPROGRESS prgp );
typedef void  (CALLBACK *TESTDPRABORT) ( void );

typedef void (CALLBACK *DPRSETHOSTBUSYBIT) ( DWORD dwDevice, int value );
typedef int (CALLBACK *DPRGETHOSTBUSYBIT) ( DWORD dwDevice );
typedef int (CALLBACK *DPRGETPMACBUSYBIT) ( DWORD dwDevice );
typedef int (CALLBACK *DPRGETSERVOTIMER) ( DWORD dwDevice );
typedef void (CALLBACK *DPRSETMOTORS) ( DWORD dwDevice, UINT n );
typedef BOOL  (CALLBACK *DPRAVAILABLE) ( DWORD dwDevice );
typedef PVOID( CALLBACK *DPRGETPTR ) ( DWORD dwDevice );

typedef BOOL  (CALLBACK *RESTORELINKLIST) ( char *buf );


typedef BOOL  (CALLBACK *GETUSRESPONSE)(DWORD dwDevice, PCHAR buf, UINT maxchar);
typedef BOOL  (CALLBACK *USREADREADY) (DWORD dwDevice);
typedef BOOL  (CALLBACK *STOREUSRESPONSE)(DWORD dwDevice,CHAR * buf, DWORD size);

typedef BOOL  (CALLBACK *CHANGEGET)(DWORD dwDevice, PCHAR buf, UINT maxchar);
typedef BOOL  (CALLBACK *CHANGEREADREADY) (DWORD dwDevice);
typedef BOOL  (CALLBACK *CHANGESTORE)(DWORD dwDevice,CHAR * buf);

typedef DWORD (CALLBACK *MAPDEVICENUMTOENUANDLOC)(LOCATIONTYPE loc,DWORD dwEnum);
typedef DWORD (CALLBACK *MAPLOCANDENUMFROMDEVICENUM) (DWORD dwDevNum, LOCATIONTYPE * loc,DWORD * dwEnum);
typedef BOOL  (CALLBACK *DEVICESHUTDOWNPMAC)(DWORD dwDevice,BOOL bForceShutdown);


typedef void (CALLBACK *DPRROTBUFCLEAR) ( DWORD dwDevice, UINT bufnum );
typedef SHORT( CALLBACK *DPRROTBUFPUT ) ( DWORD dwDevice, int num_put, LPDWORD rotdat, int bufnum );
typedef void (CALLBACK *SETMAXDOWNLOADERRORS) ( UINT max );
typedef void (CALLBACK *ABORTDOWNLOAD) ( DWORD dwDevice );

// Turbo Specific
// Turbo Handshaking
typedef void (CALLBACK *DPRRESETDATAREADYBIT) ( DWORD dwDevice );
typedef long (CALLBACK *DPRGETDATAREADYBIT) ( DWORD dwDevice );
//typedef long (CALLBACK*  DPRUPDATEREALTIME)(DWORD dwDevice);
typedef BOOL (CALLBACK *DPRUPDATEREALTIME) ( DWORD dwDevice );
// Turbo Initialization
// Data Access
typedef struct ssTurbo( CALLBACK *DPRMOTORSERVOSTATUSTURBO ) ( DWORD dwDevice, int mtr );

typedef  BOOL (CALLBACK *DPRREALTIME) ( DWORD dwDevice, UINT period, int on );
typedef  void (CALLBACK *DPRREALTIMESETMOTOR) ( DWORD dwDevice, long mask );
typedef  BOOL (CALLBACK *DPRBACKGROUND) ( DWORD dwDevice, int on );
typedef  BOOL (CALLBACK *DPRBACKGROUNDEX) ( DWORD dwDevice, int on, UINT period, UINT crd );
typedef  BOOL (CALLBACK *DPRBACKGROUNDVAR) ( DWORD dwDevice, int on );
typedef  BOOL (CALLBACK *DPRREALTIMEEX) ( DWORD dwDevice, long mask, UINT period, int on );




typedef int (CALLBACK *DOWNLOADA) ( DWORD dwDevice, DOWNLOADMSGPROC msgp, DOWNLOADGETPROC getp,
                            DOWNLOADPROGRESS ppgr, PCHAR filename, BOOL macro, BOOL map, BOOL log, BOOL dnld );
typedef int (CALLBACK *DOWNLOAD_SHOWPROGRESS)(BOOL bDoChecksums,BOOL bAlwaysShow,HWND hWnd,  DWORD dwDevice,
                            PCHAR filename, BOOL macro, BOOL map, BOOL log, BOOL dnld );

typedef int (CALLBACK *DOWNLOADTHREADA) ( DWORD dwDevice, DOWNLOADMSGPROC msgp, DOWNLOADGETPROC getp,
                            DOWNLOADPROGRESS ppgr, PCHAR filename, BOOL macro, BOOL map, BOOL log, BOOL dnld );
typedef int (CALLBACK *DOWNLOADW) ( DWORD dwDevice, DOWNLOADMSGPROC msgp, DOWNLOADGETPROC getp,
                            DOWNLOADPROGRESS ppgr, PWCHAR fname, BOOL macro, BOOL map, BOOL log, BOOL dnld );
typedef void (CALLBACK *DOWNLOADFILE) ( DWORD dwDevice, char *fname );
typedef BOOL (CALLBACK *COMPILEPLCC) ( DWORD dwDevice, char *plccName, char *outName );
typedef BOOL (CALLBACK *WRITEDICTIONARY) ( const char *tblName, PMACRO * root );
typedef BOOL (CALLBACK *READDICTIONARY) ( const char *tblName, PMACRO * root );
typedef int (CALLBACK *DOWNLOADFIRMWAREFILE) ( DWORD dwDevice, char *cFilename, DOWNLOADMSGPROC msgp );
typedef void (CALLBACK *ABORTDOWNLOAD) ( DWORD dwDevice );
typedef void (CALLBACK *SETMAXDOWNLOADERRORS) ( UINT max );

typedef void (CALLBACK *DPRSTATUS) ( DWORD dwDevice, UINT *comm, UINT *bg, UINT *bgv,
                UINT *rt, UINT *cp, UINT *rot );
// Lips stuff
typedef long (CALLBACK *WHYMOTORNOTMOVING) ( DWORD dwDevice, UINT motor );
typedef LPCSTR( CALLBACK *WHYMOTORNOTMOVINGSTRING ) ( long err );
typedef long (CALLBACK *WHYMOTORNOTMOVINGTURBO) ( DWORD dwDevice, UINT motor );
typedef LPCSTR (CALLBACK *WHYMOTORNOTMOVINGSTRINGTURBO) ( long err );
typedef long (CALLBACK *WHYCSNOTMOVING) ( DWORD dwDevice, UINT CS );
typedef LPCSTR (CALLBACK *WHYCSNOTMOVINGSTRING) ( long err );
typedef LPCSTR (CALLBACK *WHYCSNOTMOVINGSTRINGTURBO) ( long err );
typedef long (CALLBACK *WHYCSNOTMOVINGTURBO) ( DWORD dwDevice, UINT CS );
typedef int (CALLBACK *INITDATAGARHERING) ( DWORD dwDevice, int size );
typedef int (CALLBACK *STARTGATHER) ( DWORD dwDevice );
typedef int (CALLBACK *STOPGATHER) ( DWORD dwDevice );
typedef int (CALLBACK *IGETNUMGATHERSAMPLES) ( DWORD dwDevice );
typedef BOOL (CALLBACK *GETBITVALUE) ( char *s, int bit );
typedef long (CALLBACK *HEXLONG2) ( char *in_str, int str_ln );
typedef BOOL (CALLBACK *INBUFFEREDMODE) ( DWORD dwDevice );

// Numeric read/write functions
// Standard
typedef PVOID (CALLBACK *PMACDPRGETMEM)( DWORD dwDevice, DWORD offset, size_t count, PVOID val );
typedef PVOID (CALLBACK *PMACDPRSETMEM)( DWORD dwDevice, DWORD offset, size_t count, PVOID val );


typedef WORD (CALLBACK *DPRGETWORD) ( DWORD dwDevice, UINT offset );
typedef void (CALLBACK *DPRSETWORD) ( DWORD dwDevice, UINT offset, WORD val );
typedef DWORD (CALLBACK *DPRGETDWORD) ( DWORD dwDevice, UINT offset );
typedef void (CALLBACK *DPRSETDWORD) ( DWORD dwDevice, UINT offset, DWORD val );
typedef float (CALLBACK *DPRGETFLOAT) ( DWORD dwDevice, UINT offset );
typedef void (CALLBACK *DPRSETFLOAT) ( DWORD dwDevice, UINT offset, double val );
// Masking
typedef BOOL (CALLBACK *DPRDWORDBITSET) ( DWORD dwDevice, UINT offset, UINT bit );
typedef void (CALLBACK *DPRSETDWORDBIT) ( DWORD dwDevice, UINT offset, UINT bit );
typedef void (CALLBACK *DPRRESETDWORDBIT) ( DWORD dwDevice, UINT offset, UINT bit );
typedef void (CALLBACK *DPRSETDWORDMASK) ( DWORD dwDevice, UINT offset, DWORD val, BOOL onoff );
typedef DWORD (CALLBACK *DPRGETDWORDMASK) ( DWORD dwDevice, UINT offset, DWORD val );

typedef double (CALLBACK *DPRFLOAT) ( long d[], double scale );
typedef double (CALLBACK *DPRLFIXED) ( long d[], double scale );
typedef long (CALLBACK *DPRADDRESSRANGE) ( DWORD dwDevice, BOOL Upper, BOOL PC_offsets );


typedef double (CALLBACK *DPRCOMMANDED) ( DWORD dwDevice, int coord, char axchar );
typedef double (CALLBACK *DPRVELOCITY) ( DWORD dwDevice, int mtr, double units );
typedef double (CALLBACK *DPRVECTORVELOCITY) ( DWORD dwDevice, int num, int mtr[], double units[] );
typedef BOOL (CALLBACK *DPRSETBACKGROUND) ( DWORD dwDevice );

// Functions pertaining to coord systems
typedef long (CALLBACK *DPRPE) ( DWORD dwDevice, int cs );
typedef BOOL (CALLBACK *DPRROTBUFFULL) ( DWORD dwDevice, int crd );
typedef BOOL (CALLBACK *DPRSYSINPOSITION) ( DWORD dwDevice, int crd );
typedef BOOL (CALLBACK *DPRSYSWARNFERROR) ( DWORD dwDevice, int crd );
typedef BOOL (CALLBACK *DPRSYSFATALFERROR) ( DWORD dwDevice, int crd );
typedef BOOL (CALLBACK *DPRSYSRUNTIMEERROR) ( DWORD dwDevice, int crd );
typedef BOOL (CALLBACK *DPRSYSCIRCLERADERROR) ( DWORD dwDevice, int crd );
typedef BOOL (CALLBACK *DPRSYSAMPFAULTERROR) ( DWORD dwDevice, int crd );
typedef BOOL (CALLBACK *DPRPROGRUNNING) ( DWORD dwDevice, int crd );
typedef BOOL (CALLBACK *DPRPROGSTEPPING) ( DWORD dwDevice, int crd );
typedef BOOL (CALLBACK *DPRPROGCONTMOTION) ( DWORD dwDevice, int crd );
typedef BOOL (CALLBACK *DPRPROGCONTREQUEST) ( DWORD dwDevice, int crd );
typedef int (CALLBACK *DPRPROGREMAINING) ( DWORD dwDevice, int crd );

// Functions pertaining to individual motors
// Background-Functions pertaining to individual motors

⌨️ 快捷键说明

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