This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Universal Modbus TCP/RTU Slave
#43
(14.03.2023, 07:39)rw_echo Wrote:
(14.03.2023, 06:18)admin Wrote: holdingregisters = registers, you need to use inputregisters instead.
mb.setfloat16precision(2) sets how float16 is converted to integer. By default it's 2 decimals (0.01 precision). Change 2 to 0 to convert to integer without any decimals.

I tried to change "registers" to "inputegisters", but it still doesn't work. I disabled and then re-enabled the resident script, but the address mapped by "inputegister" still doesn't work.

This is the changed code:
Code:
mb.setmapping({
  [7] = {
    coils = {
      [1] = '0/0/1',
      [2] = '0/0/2',
      [3] = '0/0/3',
    },
    registers = {
      [1] = '0/1/1',
      [2] = '0/1/2',
      [3] = '0/1/3',
    } ,
    inputregisters = {
      [1] = '0/1/4',
      [2] = '0/1/5',
    }
  }
})

In addition, I want to implement the knx address' 1/1/1 'to' 1/1/100 'to map the continuous list of registered addresses [0] to [100]. Now I need to write 100 mapping statements to implement it. Is there a fast implementation method?

ChatGPT will be fast enough 
Code:
inputregisters = {
      [1] = '1/1/0',
      [2] = '1/1/1',
      [3] = '1/1/2',
      [4] = '1/1/3',
      [5] = '1/1/4',
      [6] = '1/1/5',
      [7] = '1/1/6',
      [8] = '1/1/7',
      [9] = '1/1/8',
      [10] = '1/1/9',
      [11] = '1/1/10',
      [12] = '1/1/11',
      [13] = '1/1/12',
      [14] = '1/1/13',
      [15] = '1/1/14',
      [16] = '1/1/15',
      [17] = '1/1/16',
      [18] = '1/1/17',
      [19] = '1/1/18',
      [20] = '1/1/19',
      [21] = '1/1/20',
      [22] = '1/1/21',
      [23] = '1/1/22',
      [24] = '1/1/23',
      [25] = '1/1/24',
      [26] = '1/1/25',
      [27] = '1/1/26',
      [28] = '1/1/27',
      [29] = '1/1/28',
      [30] = '1/1/29',
      [31] = '1/1/30',
      [32] = '1/1/31',
      [33] = '1/1/32',
      [34] = '1/1/33',
      [35] = '1/1/34',
      [36] = '1/1/35',
      [37] = '1/1/36',
      [38] = '1/1/37',
      [39] = '1/1/38',
      [40] = '1/1/39',
      [41] = '1/1/40',
      [42] = '1/1/41',
      [43] = '1/1/42',
      [44] = '1/1/43',
      [45] = '1/1/44',
      [46] = '1/1/45',
      [47] = '1/1/46',
      [48] = '1/1/47',
      [49] = '1/1/48',
      [50] = '1/1/49',
      [51] = '1/1/50',
      [52] = '1/1/51',
      [53] = '1/1/52',
      [54] = '1/1/53',
      [55] = '1/1/54',
      [56] = '1/1/55',
      [57] = '1/1/56',
      [58] = '1/1/57',
      [59] = '1/1/58',
      [60] = '1/1/59',
      [61] = '1/1/60',
      [62] = '1/1/61',
      [63] = '1/1/62',
      [64] = '1/1/63',
      [65] = '1/1/64',
      [66] = '1/1/65',
      [67] = '1/1/66',
      [68] = '1/1/67',
      [69] = '1/1/68',
      [70] = '1/1/69',
      [71] = '1/1/70',
      [72] = '1/1/71',
      [73] = '1/1/72',
      [74] = '1/1/73',
      [75] = '1/1/74',
      [76] = '1/1/75',
      [77] = '1/1/76',
      [78] = '1/1/77',
      [79] = '1/1/78',
      [80] = '1/1/79',
      [81] = '1/1/80',
      [82] = '1/1/81',
      [83] = '1/1/82',
      [84] = '1/1/83',
      [85] = '1/1/84',
      [86] = '1/1/85',
      [87] = '1/1/86',
      [88] = '1/1/87',
      [89] = '1/1/88',
      [90] = '1/1/89',
      [91] = '1/1/90',
      [92] = '1/1/91',
      [93] = '1/1/92',
      [94] = '1/1/93',
      [95] = '1/1/94',
      [96] = '1/1/95',
      [97] = '1/1/96',
      [98] = '1/1/97',
      [99] = '1/1/98',
      [100] = '1/1/99',
      [101] = '1/1/100',
}
    

Attached Files Thumbnail(s)
   
Reply


Messages In This Thread
Universal Modbus TCP/RTU Slave - by Daniel - 07.10.2022, 12:55
RE: Universal Modbus TCP Slave - by palomino - 07.10.2022, 17:30
RE: Universal Modbus TCP Slave - by Daniel - 07.10.2022, 17:53
RE: Universal Modbus TCP Slave - by Daniel - 07.10.2022, 17:55
RE: Universal Modbus TCP Slave - by palomino - 10.10.2022, 13:39
RE: Universal Modbus TCP Slave - by Daniel - 10.10.2022, 13:44
RE: Universal Modbus TCP Slave - by palomino - 11.10.2022, 16:22
RE: Universal Modbus TCP Slave - by palomino - 23.02.2023, 12:44
RE: Universal Modbus TCP Slave - by admin - 23.02.2023, 12:47
RE: Universal Modbus TCP Slave - by palomino - 24.02.2023, 12:41
RE: Universal Modbus TCP Slave - by admin - 24.02.2023, 12:48
RE: Universal Modbus TCP Slave - by palomino - 27.02.2023, 13:02
RE: Universal Modbus TCP Slave - by Daniel - 27.02.2023, 13:10
RE: Universal Modbus TCP Slave - by palomino - 27.02.2023, 14:00
RE: Universal Modbus TCP Slave - by Daniel - 27.02.2023, 14:03
RE: Universal Modbus TCP Slave - by palomino - 28.02.2023, 02:32
RE: Universal Modbus TCP Slave - by admin - 28.02.2023, 07:02
RE: Universal Modbus TCP Slave - by Fahd - 06.03.2023, 14:11
RE: Universal Modbus TCP Slave - by Daniel - 06.03.2023, 14:35
RE: Universal Modbus TCP Slave - by Fahd - 06.03.2023, 14:50
RE: Universal Modbus TCP Slave - by Daniel - 06.03.2023, 14:55
RE: Universal Modbus TCP Slave - by Daniel - 06.03.2023, 15:16
RE: Universal Modbus TCP Slave - by Fahd - 07.03.2023, 07:59
RE: Universal Modbus TCP Slave - by rw_echo - 14.03.2023, 05:22
RE: Universal Modbus TCP Slave - by Daniel - 07.03.2023, 11:55
RE: Universal Modbus TCP Slave - by rw_echo - 07.03.2023, 12:32
RE: Universal Modbus TCP Slave - by Daniel - 07.03.2023, 12:34
RE: Universal Modbus TCP Slave - by rw_echo - 07.03.2023, 12:49
RE: Universal Modbus TCP Slave - by Daniel - 07.03.2023, 12:59
RE: Universal Modbus TCP Slave - by David - 13.03.2023, 15:40
RE: Universal Modbus TCP Slave - by admin - 13.03.2023, 15:42
RE: Universal Modbus TCP Slave - by David - 13.03.2023, 15:58
RE: Universal Modbus TCP Slave - by Daniel - 13.03.2023, 16:00
RE: Universal Modbus TCP Slave - by David - 13.03.2023, 16:07
RE: Universal Modbus TCP Slave - by Daniel - 13.03.2023, 16:15
RE: Universal Modbus TCP Slave - by David - 13.03.2023, 16:32
RE: Universal Modbus TCP Slave - by Daniel - 13.03.2023, 16:41
RE: Universal Modbus TCP Slave - by admin - 13.03.2023, 16:45
RE: Universal Modbus TCP Slave - by David - 13.03.2023, 19:31
RE: Universal Modbus TCP Slave - by admin - 14.03.2023, 06:18
RE: Universal Modbus TCP Slave - by rw_echo - 14.03.2023, 07:39
RE: Universal Modbus TCP Slave - by Fahd - 14.03.2023, 08:27
RE: Universal Modbus TCP Slave - by admin - 14.03.2023, 08:15
RE: Universal Modbus TCP Slave - by rw_echo - 14.03.2023, 08:35
RE: Universal Modbus TCP Slave - by admin - 14.03.2023, 08:35
RE: Universal Modbus TCP/RTU Slave - by admin - 06.06.2023, 15:34
RE: Universal Modbus TCP/RTU Slave - by admin - 12.06.2023, 08:59
RE: Universal Modbus TCP/RTU Slave - by admin - 28.03.2024, 08:26

Forum Jump: