siemens_mpi.h
来自「本源代码演示了通过串口利用MPI协议与西门子PLC S7-300系统通讯的实现方」· C头文件 代码 · 共 94 行
H
94 行
//
//SIEMENS_MPI.H
//
#ifndef _FILE_SIEMENS_MPI_H_FILE
#define _FILE_SIEMENS_MPI_H_FILE
#ifdef __cplusplus
extern "C" {
#endif
//Show error message
void WINAPI ErrorMessage(int errorNo,char* buffer);
//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,char* adr_table);
int WINAPI ClosePLC();
void WINAPI SwapShort(short& data);
void WINAPI SwapLong(long& data);
int WINAPI New_ss(int no);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif //_FILE_SIEMENS_MPI_H_FILE
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?