Hello Zafar:
I got the modbus program into the Arduino sketch file finally. Looking it over, it uses a higher level language, C++ perhaps, than the standard Arduino, and is definitely not user friendly to decipher. However, after some effort, I got it to recognize digital input pins, i.e., D2, D3, and compile. What threw me off was the program setup section has analog input pins listed as the letter "t". ??
Also, I did a search on the Arduino site, and located the list of Modbus functions used, and their meaning. In the Arduino sketch, they list the functions like 0x01; 0x03; but do not use the comment feature to explain what they do.
-----------------------
0x01 - Read Coils
0x02 - Read discrete Inputs
0x05 - Write Single Coil
0x0F - Write Multiple Coils
0x03 - Read Holding Registers
0x04 - Read Input Registers
0x06 - Write Single Register
0x10 - Write Multiple Registers
0x16 - Mask Write Register
0x17 - Read Write Multiple Registers
--------------------
Anyhow, I will try it on a Mega, and see if the digital inputs higher than 15 will work.
Thanks for your effort. The zip file was appreciated.
I did find an un-zipper for RAR on the SourceForge site. All the winRAR files I located by Google were 40 to 50 megabytes, and were a pain to try to use. The SourceForge program was very small, and downloaded in a few seconds.
If the program will run the Mega pins above 15, you could have lots of digital I/O available.
Regards,
John