FLANGE_SERIAL_DATA
Serial communication information is defined using a union, composed of:
Serial communication setting information (
_tConfig)Serial communication data information (
_tValue)
It is used with _iCommand to determine which field is valid:
0: Open1: Close2: Send3: Receive
BYTE# |
Field Name |
Data Type |
Value |
Remarks |
|---|---|---|---|---|
0 |
|
|
0~3 |
Serial communication command |
1 |
|
|
Contains either configuration info or data buffer. |
_tConfig structure (Serial Configuration):
Union for serial communication information is defined as follows.
BYTE# |
Field Name |
Data Type |
Value |
Remarks |
|---|---|---|---|---|
0 |
|
|
ASCII |
7byte baudrate value (e.g., |
7 |
|
|
0~7 |
byte size |
8 |
|
|
0: None, 1: Odd, 2: Even |
Parity Check |
9 |
|
|
1 or 2 |
Stop bits |
_tValue structure (Serial Data Buffer):
Serial communication data information is defined as follows.
BYTE# |
Field Name |
Data Type |
Value |
Remarks |
|---|---|---|---|---|
0 |
|
|
RX/TX data length (bytes) |
|
2 |
|
|
Data buffer (up to 32 bytes) |
Total size: 36 bytes
Defined in: DRFS.h
typedef struct _FLANGE_SERIAL_DATA
{
unsigned char _iCommand; // 0: Open, 1: Close, 2: Send, 3: Recv
union {
struct {
unsigned char _szBaudrate[7]; // "0115200"(ASCII)
unsigned char _szDataLength; // 0: 1bit, 7: 8bit
unsigned char _szParity; // 0x00: None, 0x01: Odd, 0x02: Even
unsigned char _szStopBit; // 0x01: 1 Stop bit, 0x02: 2 Stop bits
} _tConfig;
struct {
unsigned short _iLength; // RX Data Length
unsigned char _szValue[MAX_SYMBOL_SIZE]; // RX/TX Data (32 bytes)
} _tValue;
} _tData;
} FLANGE_SERIAL_DATA, *LPFLANGE_SERIAL_DATA;