📄 commplus.h
字号:
/* CommPlus(TM) function heading files */
#define _CP_BIOS_INT 0xe8
#define _GET_MODE 0x81
#define _SET_MODE 0x82
#define _GET_SNO 0x83
#define _SET_SNO 0x84
#define _ENA_RX 0x85
#define _DIS_RX 0x86
#define _PUT_PAK 0x87
#define _GET_PAK 0x88
#define _PUT_AUX 0x89
#define _PRE_GET_AUX 0x8a
#define _GET_AUX 0x8b
#define _IMD_GET_AUX 0x8c
#define _SELECT_PORT 0x8d
#define _BlkGetAux 0x8e;
#define _BlkPutAux 0x8f;
#define _GetNinthBit 0x90;
#define _PutNinthBit 0x91;
#define _CP_OS_INT 0x0e7
#define _SET_WAIT_MD 0x80
#define _OPEN_EXF 0x81
#define _READ_EXF 0x82
#define _WRT_EXF 0x83
#define _CLOS_EXF 0x84
#define _COMT_REQ 0x85
#define _GET_REQ 0x86
#define _REP_REQ 0x87
#define _TX_FILE 0x88
#define _RX_FILE 0x89
#define _EXF_SERV 0x8a
#define _EXF_PUT 0x8b
#define _EXF_GET 0x8c
#define _WRT_REQ 1
#define _READ_REQ 2
#define _LST_REQ 3
#define _DEL_REQ 4
#define _SNO_REQ 5
#define _SPC_REQ 6
#define _MDIR_REQ 7 (在 HT2800上有效)
#define _RDIR_REQ 8 (在 HT2800上有效)
#define _LSTN_REQ 9 (在 HT2800上有效)
#define _STM_REQ 10 (在 HT2800上有效)
#define _REJECTED -2
#define _READ 0
#define _WRITE 1
#define _PAK_MODE 2
#define _AUX_MODE 3
#define _par_EVEN 0x80
#define _par_ODD 0
#define _mod_STD 0
#define _mod_7D1P 0x10
#define _mod_8D1P 0x30
#define _mod_7D 0x40
#define _NOT_SLNT 1
#define _SLNT 0
#define _IN_CHI 0
#define _IN_ENG 2
typedef struct {
unsigned char ReqDescLen;
char ReqDescStr[257];
} REQ_DESC;
typedef struct {
unsigned char ShowInfor;
unsigned char Language;
char far *Buffer;
unsigned int BufferSize;
char far *Localf;
char far *Remotef;
unsigned int ValidSNO;
} FCOM_PARA;
#ifndef __COMMPLUS
extern far int pascal InstallComPls(unsigned char CommPort);
/*
1 安装通信内核
*/
extern far int pascal UninstComPls(void);
/*
2 卸掉通信内核
*/
extern int ComPlsInstalled(void);
/*
3 测试通讯内核是否安装
参数: 无
返回参数: 无
函数值: 0 未安装
非0 已安装
*/
extern void GetCommMode(unsigned char far *WorkMode,
unsigned char far *CommPort,
unsigned int far *BaudRate);
/*
4 取得当前通信口、工作模式和波特率。
参数:
WorkMode
CommPort
BaudRate
返回参数:
WorkMode 工作模式
_PAK_MODE 数据包传送/接收方式
_AUX_MODE 字符流传送/接收方式
CommPort 当前通信口
0 串行口1(COM1)
1 串行口2(COM2)
BaudRate 当前波特率
150 150bps
300 300bps
600 600bps
1200 1200bps
2400 2400bps
4800 4800bps
9600 9600bps
19200 19200bps
38400 38400bps
57600 57600bps
0fff0h 115200bps (在 HT2800上有效)
函数值: 无
*/
extern int SetCommMode(unsigned char WorkMode,
unsigned char CommPort,
unsigned int BaudRate);
/*
5 设置通信口、工作模式和波特率。
参数:
WorkMode 工作模式
_PAK_MODE 2 数据包传送/接收方式
_AUX_MODE 3 字符流传送/接收方式 8N1
_AUX_MODE+_mod_8D1P+_par_ODD 51 字符流传送/接收方式 8O1
_AUX_MODE+_mod_8D1P+_par_EVEN 179 字符流传送/接收方式 8E1
_AUX_MODE+_mod_7D1P+_par_ODD 19 字符流传送/接收方式 7O1
_AUX_MODE+_mod_7D1P+_par_EVEN 147 字符流传送/接收方式 7E1
_AUX_MODE+_mod+7D 67 字符流传送/接收方式 7N1
_AUX_MODE+_mod_8D1P+_mod_7D 115 字符流传送/接收方式 9N1
(9N1 仅适用于HT1820,在 HT2800上无效 !)
CommPort 当前通信口
0 串行口1(COM1)
1 串行口2(COM2)
BaudRate 当前波特率
150 150bps
300 300bps
600 600bps
1200 1200bps
2400 2400bps
4800 4800bps
9600 9600bps
19200 19200bps
38400 38400bps
57600 57600bps
0fff0h 115200bps (在 HT2800上有效)
返回参数:
无
函数值:
0 设置成功
4 非法模式
5 非法波特率
*/
extern unsigned int GetSerialNo(void);
/*
6 取得机器系列号。
参数:
无
返回参数:
无
函数值:
机器系列号
*/
extern void SetSerialNo(unsigned int SerialNo);
/*
7 设置机器系列号。
参数:
SerialNo 机器系列号
机器系列号的范围在 0 至 65535 之间
返回参数:
无
函数值:
无
*/
extern void EnableRx(unsigned int RxSerialNo);
/*
8 允许串行口接收具指定系列号的机器发送来的数据。
参数:
SerialNo 机器系列号
机器系列号的范围在 0 至 65535 之间
返回参数:
无
函数值:
无
【注释】 机器系列号为零表明允许接收任何机器发送来的数据。
字符流工作方式下机器系列号无意义。
发此调用将清除数据包和字符流缓冲区内的所有数据。
*/
extern void DisableRx(void);
/*
9 禁止串行口接收任何数据。
参数:
无
返回参数:
无
函数值:
无
*/
extern int RxPackage(unsigned char far *Buffer);
/*
10 数据包传送/接收方式下接收数据
参数:
Buffer 数据包缓冲区指针
返回参数:
无
函数值:
0 没有接收到任何数据包
大于 0 数据包长度(字节)
小于 0 接收到错误数据包个数(的相反数)
*/
extern int TxPackage(unsigned char far *Buffer, unsigned int BufLength);
/*
11 数据包传送/接收方式下发送数据包。
参数:
Buffer 数据包缓冲区指针
BufLength 数据包长度
返回参数:
无
函数值:
0 发送成功
1 通信超时
2 链路错误
3 数据包过长
4 非法工作模式(当前工作模式不是数据包方式)
【注释】 最大数据包长度为 512 个字节。
*/
extern int PutAuxByte(unsigned char AuxByte);
/*
12 字符流传送/接收方式下发送字符。
参数:
AuxByte 被发送的字符
返回参数:
无
函数值:
0 发送成功
非0 当前工作方式不是字符流传送/接收方式
*/
extern int AuxByteExist(unsigned char far *AuxByte,
unsigned char far *Status);
/*
13 字符流传送/接收方式下取得字符接收状态。
参数:
AuxByte 接收字符
Status 接收状态
返回参数:
AuxByte 返回字符
Status 返回状态
函数值:
0 未接收到任何字符
非0 已接收到字符
【注释】 该字符并未由字符流缓冲区中读取出来。
*/
extern int GetAuxByte(unsigned char far *AuxByte,
unsigned char far *Status);
/*
14 字符流传送/接收方式下读取字符。
参数:
AuxByte 接收字符
Status 接收状态
返回参数:
AuxByte 返回字符
Status 返回状态
函数值:
0 接收到字符
非0 当前工作方式不是字符流传送/接收方式
或因按ESC(ON)键中断退出
【注释】 该字符已从字符流缓冲区中读取出来。
*/
extern int ExistAuxBGot(unsigned char far *AuxByte,
unsigned char far *Status);
/*
15 取得字符接收状态并读取已接收到的字符
参数:
AuxByte 接收字符
Status 接收状态
返回参数:
AuxByte 返回字符
Status 返回状态
函数值:
0 未接收到任何字符
非0 已接收到字符
【注释】 该字符已从字符流缓冲区中读取出来。
*/
extern unsigned int GetAuxBlock(char _far *buffer, unsigned int buffsize,
unsigned int waitsec);
/*
16
*/
extern unsigned int PutAuxBlock(char _far *buffer, unsigned int buffsize);
/*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -