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 |
|
|
Serial communication command in the low 4 bits |
|
1 |
|
|
Contains either configuration info or data buffer. |
_tConfig structure (Serial Configuration):
The union for serial communication information is defined as follows. On a rev1 flange, flange_serial_open fills these fields from its parameters; see flange_serial_open for the accepted values. On a rev2 flange, flange_serial_open sets only _iCommand (nPort * 16) and these fields stay zero.
BYTE# |
Field Name |
Data Type |
Value |
Remarks |
|---|---|---|---|---|
0 |
|
|
ASCII |
Baud rate as 7-byte text |
7 |
|
|
byte size |
|
8 |
|
|
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: 35 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;