Pages: [1]   Go Down
Author Topic: Modbus RTU  (Read 1863 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am starting a project to build a Modbus RTU slave using a MAX485 and an UNO. I have seen all the projects available on the web but all seem to be outdated. Any information or code to get started would be appreciated
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 30
I am passionate about electronics, industrial and home automation. Love DIY stuff
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi
I hope this tutorial http://www.biemmeitalia.net/blog/android-touchscreen-communicates-with-arduino-using-modbus-rs485 might help you.

elle
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the information the project looks great

I have tried to compile your code and the original SImpleModbusSlave example and both give the same error

SimpleModbusSlaveExample.ino: In function 'void setup()':
SimpleModbusSlaveExample:85: error: 'modbus_configure' was not declared in this scope
SimpleModbusSlaveExample.ino: In function 'void loop()':
SimpleModbusSlaveExample:95: error: 'modbus_update' was not declared in this scope

There is some information that this is related to the version of Arduino and I ahve compiled in 1.01 and the error is the same

Any ideas?
Logged

Lake District, UK
Offline Offline
Jr. Member
**
Karma: 0
Posts: 71
Electronics needs smoke to work, if it escapes its broken
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

looks like you dont have the modbus rtu library installed.
the code is making refference to it but its not there.
find your arduinos program directory - look for a folder called libraries and see if its in there, if not do a google search for it, download it and add it to this folder - restart the arduino application.
and it should be ok.

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 30
I am passionate about electronics, industrial and home automation. Love DIY stuff
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

right
You'll find the modbus library used in the project at http://code.google.com/p/simple-modbus/.

elle
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the help I am making some progress. I have got the slave communicating with a master using the SimpleSlaveModbus example. When I try to use the code from the Android/Arduino project there is an error on line 34. I have tried to find the problem from the reference but no solution as yet.

sketch_feb09a.ino: In function 'void setup()':
sketch_feb09a:34: error: expected `;' before 'pinMode'
sketch_feb09a:34: error: expected `)' before ';' token
sketch_feb09a.ino: At global scope:
sketch_feb09a:38: error: expected constructor, destructor, or type conversion before '(' token
sketch_feb09a:39: error: expected constructor, destructor, or type conversion before '(' token
sketch_feb09a:40: error: expected constructor, destructor, or type conversion before '(' token
sketch_feb09a:41: error: expected constructor, destructor, or type conversion before '(' token
sketch_feb09a:44: error: expected constructor, destructor, or type conversion before '(' token
sketch_feb09a:47: error: expected constructor, destructor, or type conversion before '(' token
sketch_feb09a:50: error: expected unqualified-id before 'for'
sketch_feb09a:50: error: expected constructor, destructor, or type conversion before '<' token
sketch_feb09a:50: error: expected constructor, destructor, or type conversion before '++' token
sketch_feb09a:53: error: expected declaration before '}' token
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 30
I am passionate about electronics, industrial and home automation. Love DIY stuff
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry mtoko, there was a minor issue with the website so that the source code was not correctly displayed. Now it should work.
Thank you for point it out!

Remember: the two parts of the code (the one with the setup and the other with loop function) belong to the same Arduino sketch, so they must be together

elle
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Use this library. It is so simple and works.

http://code.google.com/p/arduino-modbus-slave/downloads/detail?name=MODBUS.zip&can=2&q=
Logged

Napoli
Offline Offline
Sr. Member
****
Karma: 7
Posts: 356
Post fata resurgo
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I've build a C code for Modbus TCP/RTU included in an open source project called Souliss, you can get the code from there.

If you need any help to get it out, just ask.

Regards,
Dario.
Logged

Souliss - Open-source Distributed Home Automation with Arduino and Android

http://www.souliss.net
Follow at @soulissteam

@veseotech

Pages: [1]   Go Up
Jump to: