Offline
Newbie
Karma: 0
Posts: 3
|
 |
« on: February 02, 2013, 10:56:12 am » |
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
Newbie
Karma: 0
Posts: 14
|
 |
« Reply #1 on: February 09, 2013, 04:12:43 am » |
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 3
|
 |
« Reply #2 on: February 09, 2013, 05:18:28 am » |
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
Jr. Member
Karma: 0
Posts: 62
Electronics needs smoke to work, if it escapes its broken
|
 |
« Reply #3 on: February 09, 2013, 06:27:23 am » |
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
Newbie
Karma: 0
Posts: 3
|
 |
« Reply #5 on: February 09, 2013, 02:13:57 pm » |
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
Newbie
Karma: 0
Posts: 14
|
 |
« Reply #6 on: February 09, 2013, 04:29:33 pm » |
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
Newbie
Karma: 0
Posts: 10
|
 |
« Reply #7 on: February 21, 2013, 06:39:56 am » |
|
|
|
|
|
Logged
|
|
|
|
|
Napoli
Offline
Full Member
Karma: 3
Posts: 200
Post fata resurgo
|
 |
« Reply #8 on: February 22, 2013, 02:16:33 pm » |
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
|
|
|
|
|
|