RS 485 modbus RTU

Dear Tom,

I saw your blog where you connected the wind speed sensor with Arduino.

I have a similar application where I have a sensor which have RS 485 output.

I used same sketch with little modification but when I am trying to compile it is giving compiling error.

the error is as below:

Arduino: 1.8.5 (Windows 10), Board: "Industruino D21G"

Archiving built core (caching) in: C:\Users\Jagroop\AppData\Local\Temp\arduino_cache_568578\core\core_industruino_samd_industruino_d21g_1a7f4adcfc38261adc8385f1111cc5e2.a
libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `modbus_construct(Packet*, unsigned char, unsigned char, unsigned int, unsigned int, unsigned int)':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:150: multiple definition of `construct_F15()'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:150: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `processReply()':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:184: multiple definition of `construct_F16()'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:184: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `waiting_for_turnaround()':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:205: multiple definition of `waiting_for_turnaround()'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:205: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `processError()':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:380: multiple definition of `processError()'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:380: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `processSuccess()':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:396: multiple definition of `processSuccess()'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:396: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `process_F1_F2()':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:315: multiple definition of `process_F1_F2()'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:315: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `process_F3_F4()':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:349: multiple definition of `process_F3_F4()'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:349: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `process_F5_F6_F15_F16()':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:368: multiple definition of `process_F5_F6_F15_F16()'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:368: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `modbus_configure(HardwareSerial*, long, unsigned char, long, long, unsigned char, unsigned char, Packet*, unsigned int, unsigned int*)':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:413: multiple definition of `modbus_configure(HardwareSerial*, long, unsigned char, long, long, unsigned char, unsigned char, Packet*, unsigned int, unsigned int*)'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:413: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `modbus_construct(Packet*, unsigned char, unsigned char, unsigned int, unsigned int, unsigned int)':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:466: multiple definition of `modbus_construct(Packet*, unsigned char, unsigned char, unsigned int, unsigned int, unsigned int)'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:466: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `calculateCRC(unsigned char)':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:473: multiple definition of `calculateCRC(unsigned char)'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:473: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `processReply()':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:268: multiple definition of `processReply()'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:268: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `waiting_for_reply()':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:212: multiple definition of `waiting_for_reply()'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:212: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `sendPacket(unsigned char)':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:497: multiple definition of `sendPacket(unsigned char)'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:497: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `constructPacket()':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:101: multiple definition of `constructPacket()'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:101: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `idle()':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:76: multiple definition of `idle()'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:76: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `modbus_update()':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:51: multiple definition of `modbus_update()'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:51: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `modbus_construct(Packet*, unsigned char, unsigned char, unsigned int, unsigned int, unsigned int)':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:150: multiple definition of `ModbusPort'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:150: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `modbus_construct(Packet*, unsigned char, unsigned char, unsigned int, unsigned int, unsigned int)':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:150: multiple definition of `register_array'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:150: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `modbus_construct(Packet*, unsigned char, unsigned char, unsigned int, unsigned int, unsigned int)':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:150: multiple definition of `packet'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:150: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `modbus_construct(Packet*, unsigned char, unsigned char, unsigned int, unsigned int, unsigned int)':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:150: multiple definition of `packetArray'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:150: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `modbus_construct(Packet*, unsigned char, unsigned char, unsigned int, unsigned int, unsigned int)':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:150: multiple definition of `total_no_of_packets'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:150: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `modbus_construct(Packet*, unsigned char, unsigned char, unsigned int, unsigned int, unsigned int)':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:150: multiple definition of `delayStart'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:150: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `modbus_construct(Packet*, unsigned char, unsigned char, unsigned int, unsigned int, unsigned int)':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:150: multiple definition of `frameDelay'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:150: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `modbus_construct(Packet*, unsigned char, unsigned char, unsigned int, unsigned int, unsigned int)':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:150: multiple definition of `T1_5'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:150: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `modbus_construct(Packet*, unsigned char, unsigned char, unsigned int, unsigned int, unsigned int)':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:150: multiple definition of `polling'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:150: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `modbus_construct(Packet*, unsigned char, unsigned char, unsigned int, unsigned int, unsigned int)':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:150: multiple definition of `timeout'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:150: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `modbus_construct(Packet*, unsigned char, unsigned char, unsigned int, unsigned int, unsigned int)':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:150: multiple definition of `buffer'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:150: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `modbus_construct(Packet*, unsigned char, unsigned char, unsigned int, unsigned int, unsigned int)':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:150: multiple definition of `frame'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:150: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `modbus_construct(Packet*, unsigned char, unsigned char, unsigned int, unsigned int, unsigned int)':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:150: multiple definition of `TxEnablePin'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:150: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `modbus_construct(Packet*, unsigned char, unsigned char, unsigned int, unsigned int, unsigned int)':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:150: multiple definition of `retry_count'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:150: first defined here

libraries\SimpleModbusMasterV2rev2\SimpleModbusMaster.cpp.o: In function `modbus_construct(Packet*, unsigned char, unsigned char, unsigned int, unsigned int, unsigned int)':

C:\Users\Jagroop\Documents\Arduino\libraries\SimpleModbusMasterV2rev2/SimpleModbusMaster.cpp:150: multiple definition of `state'

sketch\SimpleModbusMaster.cpp.o:sketch/SimpleModbusMaster.cpp:150: first defined here

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Industruino D21G.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Jagroop Singh
Jagroop Singh
7
| 0 0 0
Asked on 8/21/18, 11:41 AM
0
vote
63 Views

Hi,

 I have only one file in my sketch

Another file of same version in C:\users\arduino\libraries\...........

if I remove the file from libraries then it says compilation error

if i keep still it gives same above error

 

Jagroop Singh
Jagroop Singh
7
| 0 0 0
Answered on 8/22/18, 6:33 AM
0
vote

Hi, it seems you have multiple versions of the modbus library files on your system; maybe you have put an extra copy in your sketch folder? please check

Tom
Tom
5210
| 0 0 1
Answered on 8/22/18, 12:45 AM
0
vote

Your answer

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!

Ask a Question

Keep Informed

About This Forum

This community is for professionals and enthusiasts of our products and services.

Read Guidelines

Question tools

46 follower(s)

Stats

Asked: 8/21/18, 11:41 AM
Seen: 63 times
Last updated: 8/22/18, 6:33 AM