📄 relay.h
字号:
/*-----------------------------------------------------------------------*/
/* FS-MTS 1.0 Ver. */
/* Copyright (C) 2000 FIRST SAIL */
/* All Rights Reserved */
/* Warning: */
/* This program author is GuoHeng,this system is protected */
/* by copyright law and international Treaties . Unauthorized */
/* reproduction of distribution of this system, or any portion */
/* of it , may result in severe civil and criminal penalties , */
/* and will be prosecuted to the maximum extern possible under */
/* the law. */
/* */
/* Update Date:2002-06-25 */
/* Update Time:22:35:00 */
/*-----------------------------------------------------------------------*/
#ifndef _RELAY_H_
#define _RELAY_H_
//输出/输出口的消息映射定义
#define BEGIN_PORT_MAP() unsigned int dwAfxVirtualPort[][2]={
#define ON_PORT(a,b) (int)a,(int)b,
#define END_PORT_MAP() 0,0};
#define MAX_INPUT_COUNT 30 //最大支持的输入口数量
#define MAX_RELAY_COUNT 170 //最大支持的输出口数据
#define STD_OUTPORT_BYTE_BOARD 0 //8位数据0有效
#define PC_OUTPORT_BYTE_BOARD 1 //8位数据1有效
#define STD_OUTPORT_WORD_BOARD 2 //16位数据0有效
#define PC_OUTPORT_WORD_BOARD 3 //16位数据1有效
#define STD_OUTPORT_DWORD_BOARD 4 //32位数据0有效
#define PC_OUTPORT_DWORD_BOARD 5 //32位数据1有效
#define MAX_RELAY_NAME_LENGTH 16 //输入/输出口的名称最大数符数 - 1
#define MAX_DRAW_RELAY_COUNT 22
//输入/输出口属性
typedef struct _tagRELAYINFORMATION
{
char strRelayName[MAX_RELAY_NAME_LENGTH];
int nPort;
int nBit;
}RELAYINFORMATION;
//获得输出口的类型
int far GetOutportBoardStyle();
//获得输入口的类型
int far GetInportBoardStyle();
//建立输入和输出口
BOOL far BuildRelayInformation(CRegister *pRegister);
//建立输入口(严禁调用)
//BOOL far BuildInputInformation(CRegister *pRegister);
//获得指定输出口的端口号和字(节)的位序号
BOOL far GetRelayPortAndBit(char *pStr,int *pnPort,int *pnBit);
//获得指定输入口的端口号和字(节)的位序号
BOOL far GetInputPortAndBit(char *pStr,int *pnPort,int *pnBit);
//判断指定输入口的逻辑状态
BOOL far ActiveInput(char *pStr,CRegister *pRegister);
//高级端口8位读
unsigned char INPORTB(unsigned nPort);
//高级端口8位写
void far OUTPORTB(unsigned nPort, unsigned char nValue);
//高级端口16位写
void OUTPORT(unsigned nPort, WORD wValue);
//高级端口16位读
WORD INPORT(unsigned nPort);
//执行输出字符串(老版本)
BOOL far ExculatateRelay(char *pStr,
CRegister *pRegister, BOOL bDisplay=FALSE,BOOL bOpen=TRUE);
//执行输出字符串(新版本)
BOOL far ExecuteRelay(char *pStr,
CRegister *pRegister, BOOL bDisplay=FALSE,BOOL bOpen=TRUE);
void FlushRelay(int nTime);
//打开I/O映射文件
CRegister* far OpenRelayRegister(char *pStr);
//关闭I/O映射文件
BOOL far CloseRelayRegister(CRegister **pRegister);
//设置调试状态输出串执行属性
void far SetRelayAttrib(BOOL bDebug=FALSE,int nTime=2000);
//初始化输出板
BOOL far InitOutportBoard();
//将输出端口的指定位清“0”
void far ResetOutportBit(int nPort,int nBit);
//将输出端口的指定位置“1”
void far SetOutportBit(int nPort,int nBit);
//获得初始化时的输出口值
WORD far GetInitOutportBoardCommand();
WORD far GetInitInportBoardCommand();
//获得输入/输出板名称
char *GetBoardName(int nIndex);
//获得输出板的数据
int far GetOutportBoardCount();
//获得输入板的数据
int far GetInportBoardCount();
//获得指定输出端口的索引板号
int far GetRelayPortIndex(int nPort);
//获得指定索引的输入板端口号
int far GetInputPort(int nIndex);
WORD far GetPrivOutportValue(int nPort);
void Set586CPUAttrib (BOOL bCPU586, WORD wLoop);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -