📄 _485_defs.h
字号:
//
// _485_defs.H
//
// Definitions of 485 communications
//
// Copyright (c) 2007 XK Tech, Tsinghua Univ.
//
//
// Author : Shangyuan Li
// Date : 2007-8-1
// Version : 1.0
//
// Date : 2007-08-17
// Version : 1.1
// Comment : Move function declarations here
//
#ifndef ___485_defs_H__
#define ___485_defs_H__
// define instrument type
#define INSTR_TUOKE_DH4 0x01
#define _485_STN_NUM_1 1
#define _485_STN_NUM_2 2
#define _485_STN_NUM_3 3
#define _485_STN_NUM_4 4
#define _485_STN_NUM_5 5
#define _485_STN_NUM_6 6
#define _485_STN_NUM_7 7
#define _485_STN_NUM_8 8
#define _485_STN_NUM_9 9
#define _485_STN_NUM_10 10
#define _485_STN_NUM_11 11
#define _485_STN_NUM_12 12
#define _485_STN_NUM_13 13
#define _485_STN_NUM_14 14
#define _485_STN_NUM_15 15
#define _485_STN_NUM_16 16
// define data structure of intelligent instruments
typedef struct {
ubyte pre[3];
ubyte stn;
ubyte fc;
ubyte addr;
ubyte dat_L;
ubyte dat_H;
ubyte CRC_L;
ubyte CRC_H;
ubyte suf;
} _t_485_tuoke_dh4;
typedef struct {
ubyte stn;
ubyte fc;
ubyte addr;
ubyte dat_L;
ubyte dat_H;
ubyte CRC_L;
ubyte CRC_H;
} _t_485_tuoke_dh4_rx;
#define INSTR_TUOKE_DH4_FRAME_LEN 11
// INSTR_TUOKE_DH4 Frame Structure
// PRE, PRE, PRE, STN, FC, ADDR, DAT_L, DAT_H, CRC_L, CRC_H, SUF
// Compressed Frame Structure for INSTR_TUOKE_DH4
// PRE, PRE, PRE, STN, FC<<4|ADDR, DAT_L, DAT_H, CRC_L, CRC_H, SUF
// prefixes and suffixes
#define INSTR_TUOKE_DH4_TX_PRE 0xfe
#define INSTR_TUOKE_DH4_TX_SUF 0xaa
#define INSTR_TUOKE_DH4_RX_PRE 0x81
#define INSTR_TUOKE_DH4_RX_SUF 0xbb
#define INSTR_TUOKE_DH4_READ_DATA 0x00
#define INSTR_TUOKE_DH4_SAVE_DATA 0x02
#define INSTR_TUOKE_DH4_ALT_PARAM 0x04
#define INSTR_TUOKE_DH4_READ_PARAM 0x06
#define INSTR_TUOKE_DH4_C_READ_DATA 0x00
#define INSTR_TUOKE_DH4_C_SAVE_DATA 0x20
#define INSTR_TUOKE_DH4_C_ALT_PARAM 0x40
#define INSTR_TUOKE_DH4_C_READ_PARAM 0x60
// Address for data operations, where the fc is 0x00 and 0x02
#define INSTR_TUOKE_DH4_ADDR_DATA 0x00
// Address for parameter operations, while the fc is 0x04 and 0x06
#define INSTR_TUOKE_DH4_ADDR_AH 0x00
#define INSTR_TUOKE_DH4_ADDR_AHL 0x01
#define INSTR_TUOKE_DH4_ADDR_AL 0x02
#define INSTR_TUOKE_DH4_ADDR_ALT 0x03
#define INSTR_TUOKE_DH4_ADDR_IN 0x04
#define INSTR_TUOKE_DH4_ADDR_PB 0x05
#define INSTR_TUOKE_DH4_ADDR_FILE 0x06
#define INSTR_TUOKE_DH4_ADDR_OUT 0x07
#define INSTR_TUOKE_DH4_ADDR_STN 0x08
#define INSTR_TUOKE_DH4_ADDR_CON 0x09
#define INSTR_TUOKE_DH4_ADDR_H 0x0A
#define INSTR_TUOKE_DH4_ADDR_L 0x0B
#define INSTR_TUOKE_DH4_ADDR_O0 0x0C
#define INSTR_TUOKE_DH4_ADDR_OFS 0x0D
#define INSTR_TUOKE_DH4_ADDR_A0 0x0E
#define INSTR_TUOKE_DH4_ADDR_AFS 0x0F
// 485 Communication Stuff
extern ubyte _485_Init();
extern ubyte _485_GenerateReadFrame(ubyte stntype, ubyte stn, void * pFrame);
extern void _485_Tuoke_DH4_CRC(ubyte *);
extern ubyte _485_Tuoke_DH4_CRCCheck(ubyte *);
extern void _485_SendData(ubyte stntype);
extern ubyte _485_ReceiveData();
#endif // ___485_defs_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -