📄 siemens_mpi.h
字号:
//
//SIEMENS_MPI.H
//
#ifndef _FILE_SIEMENS_MPI_H_FILE
#define _FILE_SIEMENS_MPI_H_FILE
#ifdef __cplusplus
extern "C" {
#endif
/***************************************************************************/
/* typedef for addess table max 16 connections */
/***************************************************************************/
#pragma pack(1)
typedef struct
{
unsigned char adr; /* stationsadresse default 2 */
unsigned char segmentid; /* segment id default 0 */
unsigned char slotno; /* slot no default 2 */
unsigned char rackno; /* rack no default 0 */
} adr_table_type;
#pragma pack()
/***************************************************************************/
//Show error message
void WINAPI ErrorMessage(int errorNo,char* buffer);
//Open the comm with specific parameters
BOOL WINAPI ComOpen( LPVOID pData );
//close the comm port
void WINAPI ComClose();
//bit read and write
//deviceNo: the device number, I3.1,deviceNo is 3
//bitNo: offset of bit,I3.1,bitNo is 1
//value: store the result of I3.1,0 or 1
//return value: the error code
//对Discrete Inputs读取Data (bit)
int WINAPI PLC_R_I(int deviceNo,int bitNo,int* value);
// int PLC_W_I(int deviceNo,int bitNo,bool bValue)
// {
// int iValue;
// int error;
// error = e_field_read(deviceNo,1,&iValue);
// iValue = BitSet(iValue,bitNo,bValue);
//
// }
int WINAPI PLC_R_Q(int deviceNo,int bitNo,int* value);
int WINAPI PLC_W_Q(int deviceNo,int bitNo,bool bValue);
int WINAPI PLC_R_M(int deviceNo,int bitNo,int* value);
int WINAPI PLC_W_M(int deviceNo,int bitNo,bool bValue);
int WINAPI PLC_R_DB(int blockNo,int deviceNo,int bitNo,int* value);
int WINAPI PLC_W_DB(int blockNo,int deviceNo,int bitNo,bool bValue);
//WORD and DWORD read and write
int WINAPI PLC_R_IW(int deviceNo,int amount,void* buffer);
int WINAPI PLC_R_ID(int deviceNo,int amount,void* buffer);
int WINAPI PLC_R_QW(int deviceNo,int amount,void* buffer);
int WINAPI PLC_W_QW(int deviceNo,int amount,void* buffer);
int WINAPI PLC_R_QD(int deviceNo,int amount,void* buffer);
int WINAPI PLC_W_QD(int deviceNo,int amount,void* buffer);
int WINAPI PLC_R_MW(int deviceNo,int amount,void* buffer);
int WINAPI PLC_W_MW(int deviceNo,int amount,void* buffer);
int WINAPI PLC_R_MD(int deviceNo,int amount,void* buffer);
int WINAPI PLC_W_MD(int deviceNo,int amount,void* buffer);
int WINAPI PLC_R_DBW(int blockNo,int deviceNo,int amount,void* buffer);
int WINAPI PLC_W_DBW(int blockNo,int deviceNo,int amount,void* buffer);
int WINAPI PLC_R_DBD(int blockNo,int deviceNo,int amount,void* buffer);
int WINAPI PLC_W_DBD(int blockNo,int deviceNo,int amount,void* buffer);
int WINAPI PLC_R_T(int deviceNo,int amount,void* buffer);
int WINAPI PLC_R_C(int deviceNo,int amount,void* buffer);
void WINAPI Gp_to_Float(void* gpValue,void*flValue);
void WINAPI Float_to_Gp(void* flValue,void* gpValue);
int WINAPI OpenPLC(int nr,char* device,adr_table_type* adr_table);
int WINAPI ClosePLC();
void WINAPI SwapShort(short& data);
void WINAPI SwapLong(long& data);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif //_FILE_SIEMENS_MPI_H_FILE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -