Welcome, Guest
Username: Password: Remember me

TOPIC: Modbus tcp with arduino

Re: Modbus tcp with arduino 10 years 11 months ago #5188

  • siamect
  • siamect's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 116
  • Thank you received: 1
  • Karma: 1
Dear Angelferni

You don't need to declare those ones... they are declared in the Mudbus.h file but in the later versions they are also named differently because I support more function codes than what the original versions did.

They look like this in the Mudbus.h file:
#define MB_N_C_0x 100 //Max coils for Modbus is 100 due to limited memory
#define MB_N_I_1x 100 //Max inputs for Modbus is 100 due to limited memory
#define MB_N_IR_3x 64 //Max 16 bit input registers is 64 due to limited memory
#define MB_N_HR_4x 64 //Max 16 bit holding registers is 64 due to limited memory
#define MB_PORT 502


Take a look at the example copy_in2out_mb. There you can see how things can be done.
Sorry I haven't corrected the content of the Keywords file...

Martin
The administrator has disabled public write access.

Re: Modbus tcp with arduino 10 years 11 months ago #5189

  • siamect
  • siamect's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 116
  • Thank you received: 1
  • Karma: 1
I just corrected the Keywords file...
Last Edit: 10 years 11 months ago by siamect.
The administrator has disabled public write access.

Re: Modbus tcp with arduino 10 years 9 months ago #5436

  • bobo13
  • bobo13's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
  • Karma: 0
Hi

I doing small project only one Di a one Do with modbus tcp with arduino but I still have problem to start runtime monitor
I still have this error and I didn't find out solving in this forum

F Could not open file /usr/local/pwrp/modbus/bld/common/load/ld_boot_bobo_0999.dat -- this boot file doesn't exist
I Reading Node file /usr/local/pwrp/modbus/bld/common/load/ld_node_bobo_0999.dat
F Cannot find my own node in /usr/local/pwrp/modbus/bld/common/load/ld_node_bobo_0999.dat


pwrp@bobo:/etc$ cat proview.cnf
#
# Configuration file for Proview
#
# Default QCOM Bus Id
#
qcomBusId 999


I have linux 64bit and this configuration. I atach setup as picture.
Please help me setup proview to start comunication

Regards Bobo
Attachments:
The administrator has disabled public write access.

Re: Modbus tcp with arduino 10 years 9 months ago #5438

  • claes
  • claes's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 3178
  • Thank you received: 502
  • Karma: 133
Hi Bobo,

You shouldn't have the same busid for the simulation and production bus. I suggest that you change the busid for the BusConfig object Prd999 in the directory volume, and rebuild the node.

/Claes
The administrator has disabled public write access.

Re: Modbus tcp with arduino 10 years 9 months ago #5452

  • bobo13
  • bobo13's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
  • Karma: 0
Hi Claes
Sorry for late answer I was on holiday. I resolved last problem but I think so that I have problem with setting adress.
I using this code for arduino

void loop()
{
Mb.Run();


//Digital inputs
Mb.C[7] = digitalRead(7); //pin 7 to Mb.C[7]

//Digital outputs
digitalWrite(8, Mb.C[8]); //pin 8 from Mb.C[8]
}

When I pushing input I haven't any response on graph
I rather attach picture that I trying describe problem, I think is easier
Attachments:
The administrator has disabled public write access.

Re: Modbus tcp with arduino 10 years 9 months ago #5453

  • toringej
  • toringej's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 19
  • Karma: 0
Hi bobo13,

I noticed something strange with your configuration, when using Modpoll you are using FC03 (Read Holding Registers), while in Proview you are using the function code FC01 (Read Coils). You should probably change your command in Modpoll so it uses FC01 as well (use: -t 0). It might be better to simply set Mb.C[1], Mb.C[2] etc. to 1 and then poll them from Modpoll to check that you can read them correctly. This eliminates the possibility that something goes wrong when you read the pin state.

Also: if you attach a screenshot showing the status of the "Modbus_TCP_Client" it is possible to see if Proview is able to poll the device and get a reply.

Unfortunately I don't have my Arduino with me right now, so I can't
The administrator has disabled public write access.
Time to create page: 9.251 seconds