I am curious about the gory details of modbus_master and tcp.test
I notice that there is a plain modbus_master available from the cli
Is that the same functionality as the ubus call modbus_master ?
are all of the "descriptors": mandatory ? or can one supply just the positional parameters in classic *ix style ?
I note that the function is called tcp.test does that imply a transient temporary functionality ?
or is it suitable for production code ?
I had previously contrived a means for the telemetry system to push date/time yyyy mm dd hh mm ss to the PLC to keep the PLCs with rather drifty clocks to remain synchronized.
I was looking for a way to have the teltonika replicate the same functionality and seemed to have run into a dead end
since it seems there was no way to write (function 6) dynamic data.
I have a good sense that there is sufficient functionality here to perform the required functionality.
Is there any issue with interference/collision between the modbus communications run from the CLI / cron scripts and the
web-ui configured modbus requestors ? Maybe the daemon is clever enough to manage that... ?
Any guidance would be appreciated...
Oh yeah ... what is the syntax for the data values to be written by function 6 and 16 ?
At this point my ideal scenario would be to write the someting like:
ubus call modbus_master tcp.test '{"ip":"192.168.1.11", "port":502, "id":1, "timeout":1, "function":6, "first_reg":10007, "reg_count":"1", "data_type":"16bit_uintxxx", "no_brackets":1}'
and better yet:
ubus call modbus_master tcp.test '{"ip":"192.168.1.11", "port":502, "id":1, "timeout":1, "function":16, "first_reg":10007, "reg_count":"6", yyyy,mm,dd,HH,MM,SS,"data_type":"16bit_uintxxx", "no_brackets":1}'
I don't know the 16 bit descriptor nor the "data1" syntax
oh yeah, is the cli modbus stuff 0-based or 1-based ?
seems that is still an active dichotomy - for those for whom the discovery of 0 is a recent phenomenon ;-)
********************************************************************************************************************************************
I figured out some of the data_type codes:
hex ascii pdu 8bit_int 8bit_uint
16bit_int_hi_first 16bit_int_low_first 16bit_uint_hi_first 16bit_uint_low_first
32bit_float1234 32bit_float4321 32bit_float2143 32bit_float3412
32bit_int1234 32bit_int4321 32bit_int2143 32bit_int3412
32bit_uint1234 32bit_uint4321 32bit_uint2143 32bit_uint3412
by inspecting the modbus_master executable looking for recognizeable strings
the 16bit stuff was handled in a klunky way
having established numeric byte order for 32 bit
using that for 16bit was a natural extension (or rather contraction):
16bit_int12 16bit_int21 16bit_uint12 16bit_uint21