aboutsummaryrefslogtreecommitdiffstats
path: root/src/hal/drivers/mesa-hostmot2/modbus/mesa_modbus.mod.sample
blob: c56811cbbd6916f3a2ae43b3db201d9e9732e0b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
The format of the channel descriptors is:

{TYPE, FUNC, ADDR, COUNT, pin_name}

TYPE is one of HAL_BIT, HAL_FLOAT, HAL_S32, HAL_U32
FUNC = 1, 2, 3, 4, 5, 6, 15, 16 - Modbus commands
COUNT = number of coils/registers to read
*/

#define MAX_MSG_LEN 16   // may be increased if necessary to max 251

static const hm2_modbus_chan_descriptor_t channels[] = {
/*  {TYPE,     FUNC, ADDR,   COUNT, pin_name} */
// Create 8 HAL bit pins coil-00 .. -07 supplying the values of coils at 0x0000
    {HAL_BIT,   1,   0x0000, 8,     "coil"},
// Create 8 HAL bit pins input-00 .. -07 supplying the values of inputs at 0x0000
    {HAL_BIT,   2,   0x0000, 8,     "input"},
// Create a HAL pin to set the coil at address 0x0010
    {HAL_BIT,   5,   0x0010, 1,     "coil-0"},
// Create 8 HAL pins to set the coils at 0x0020
    {HAL_BIT,   15,  0x0020, 8,     "more_coils"},
// Create a scaled floating point pin calculated from input register 0x0100
    {HAL_FLOAT, 4,   0x0100, 1,     "float"},
// Create 4 unsigned integer HAL pins from the holding registers at 0x0200-0x203
    {HAL_S32,   3,   0x0003, 4,     "holding"},
// Create a single signed int HAL pin to control the register at 0x0300
    {HAL_S32,   6,   0x0300, 1,     "relay-3"},
// Create 7 scaled FP HAL pins to control holfing registers at 0x400-0x406
    {HAL_FLOAT, 16,  0x0300, 1,     "more_floats"},
};
bues.ch cgit interface