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

📄 itkprotocol.h

📁 工业强度的PLC模拟程序
💻 H
字号:
// @dlg
//
// @module		itkProtocol.h
//
//
// Maintenance:
//	
// Version		Date		Who		What
// -------		--------	---		-------------------------------------
// 7.0			06/01/97	jra		Created
// 7.1			04/30/98	mvs		Added TCP/IP Support
// 7.1			05/20/98	mvs		Added UDP Support
//

// Prevent multiple inclusion
#if !defined(AFX_ITKPROTOCOL_H__C8DD8F2B_038F_11D1_B77E_0060971E5E37__INCLUDED_)
#define AFX_ITKPROTOCOL_H__C8DD8F2B_038F_11D1_B77E_0060971E5E37__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000


#define SERIAL_PROTOCOL			0
#define TCPIP_PROTOCOL			1
#define UDPIP_PROTOCOL			2

#define FIVE_SECONDS			5000
#define TRANSMIT_BUFFER_SIZE	2048
#define REGISTERS_PER_ROW		10
#define PLC_MEMORY_SIZE			1024

#define STATS_TIMER				99
#define REGISTER_TIMER			100

#define UPDATE_ONLY				0
#define CLEAR_MEMORY			1
#define SET_MEMORY				2


// States for the protocol state machine
#define DLE1					1
#define STX1					2
#define SRC1					3	// source station address
#define	DEST1					4	// destination station address
#define CMD1					5	// command
#define	TRANHI					6	// transaction # hi-byte
#define	TRANLO					7	// transaction # lo-byte
#define ADDLO					8	// start address lo-byte
#define ADDHI					9	// start address hi-byte
#define LEN1					10	// length of data
#define DATA1					11
#define DATA2					12
#define DLE2					13
#define ETX1					14
#define BCC1					15	// checksum
#define SET1					16
#define SET2					17
#define RESET1					18
#define RESET2					19
#define DLE_SKIP				20
#define DATA_DLE				21
#define DATA_DLE2				22

// Protocol commands
#define NAK						0x15
#define ACK						0x06
#define DLE						0x10
#define STX						0x2
#define ETX						0x3

// ITKPLC protocol commands
#define READ_CMD				1
#define BIT_WRITE_CMD			2
#define WRITE_CMD				3
#define READ_RESPONSE_CMD		129
#define	BIT_WRITE_RESPONSE_CMD	130
#define	WRITE_RESPONSE_CMD		131

// Datatypes for PLC memory map view
#define	DT_UNSIGNED				0
#define DT_SIGNED				1
#define DT_FLOAT				2
#define DT_LONG					3
#define	DT_HEX					4
#define DT_ASCII				5

const int nLastRow = (int)(PLC_MEMORY_SIZE / REGISTERS_PER_ROW);
#define	NUM_ROWS	PLC_MEMORY_SIZE / REGISTERS_PER_ROW


#endif // !defined(AFX_ITKPROTOCOL_H__C8DD8F2B_038F_11D1_B77E_0060971E5E37__INCLUDED_)

⌨️ 快捷键说明

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