The sketch get compiled now.
I have another problem
I want to set the Modbus RTU parameter. in your windsensor example the parameters are set like.
modbus_construct(&packets[PACKET1], 1, READ_HOLDING_REGISTERS, , 1, 0);
modbus_configure(&Serial, baud, SERIAL_8N2, timeout, polling, retry_count, TxEnablePin, packets, TOTAL_NO_OF_PACKETS, regs);
// Serial1 = INDUSTRUINO RS485
I want to set Stopbit 2,parity none baud rate 9600.
My sensor is giving some float value. so I must read Register 40001
So how to set this
Hi, if your sensor gives a float value, then you probably need to read 2 16-bit registers and combine them to a float, see https://industruino.com/blog/our-news-1/post/modbus-tips-for-industruino-26
But first you have to find those registers; if your doc says address 40001 then start looking with
modbus_construct(&packets[PACKET1], 1, READ_HOLDING_REGISTERS, 0, 2, 0);
That means: slave register index 0 for slave address 40001; 2 registers to read; store in master index 0 (and 1, as you're reading 2 registers)
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!