rllib  1
Public Attributes | List of all members
rlModbus::DATA Union Reference

#include <rlmodbus.h>

Public Attributes

unsigned char u_char [4]
 
char s_char [4]
 
unsigned short u_short [2]
 
short s_short [2]
 
unsigned int u_int
 
int s_int
 
float s_float
 

Detailed Description

data exchanged by Modbus is either: 
1byte unsigned for coils 
2byte unsigned for registers
Helper union for converting Modbus data to data types that are not standard Modbus data types
Example:
rlModbus::DATA data;
data.u_short[0] = registers[0]; // store an unsigned 16 bit register in union data
printf("print registers[0] as signed int value=%d\n", data.s_short[0]);

Definition at line 162 of file rlmodbus.h.

Member Data Documentation

◆ s_char

char rlModbus::DATA::s_char[4]

Definition at line 165 of file rlmodbus.h.

◆ s_float

float rlModbus::DATA::s_float

Definition at line 170 of file rlmodbus.h.

◆ s_int

int rlModbus::DATA::s_int

Definition at line 169 of file rlmodbus.h.

◆ s_short

short rlModbus::DATA::s_short[2]

Definition at line 167 of file rlmodbus.h.

◆ u_char

unsigned char rlModbus::DATA::u_char[4]

Definition at line 164 of file rlmodbus.h.

◆ u_int

unsigned int rlModbus::DATA::u_int

Definition at line 168 of file rlmodbus.h.

◆ u_short

unsigned short rlModbus::DATA::u_short[2]

Definition at line 166 of file rlmodbus.h.


The documentation for this union was generated from the following file: