Modbus

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi everybody!

Is there anybody who have implementet the modbus protocoll in codevision?
I am doing a project now and begin to run out of time, so if it is somebody who can help me with this I will be very content. It does not have to be the code, just a place who will get me started. I have never used the modbus protocoll before..

In advance, thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Here's a link to a modbus implementation.
http://freemodbus.berlios.de/

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Do a search on my posts - I have posted parts of the modbus code before. I do not have access to my computer at the moment so I can't repost. Nevertheless, the code is quite straightforward - you can use the methods described on the documents from www.modbus.org

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

modbus is really really simple protocol and you'll have a simple system running in 4 hours.

How many different types of devices are you dealing with?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There is Modbus, and then there is Modbus. ASCII? RTU? Ethernet? Master and/or slave? Do you have control over both ends, or do you have to interact with "standard" full Modbus devices?

If you are the master and only need to do a couple simple queries, then it is indeed quite straightforward and you should find lots of examples on the 'Net. If you need to do a "full" Modbus-RTU slave that can interact with an arbitrary master, that ends up taking about half of a Mega88 in code space, so a several week job. Probably a little longer if you are not familiar with Modbus. Three things come to mind: the dead time between packets is end-of-transmission, so there is a timer involved. The checksum generation and recognition needs to be done. And the 16-bit values come in/go out big-endian, so you normally need to byte-swap everything.

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

theusch,

thanks for correcting me. Indeed, there might be much more complex cases involved.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello!

I am dealing with only 1 device, the master. My slave must understand 5 different function codes and it is a modbus rtu.
I did download the modbus implementation from http://freemodbus.berlios.de/, but when I try to make the project in CodeVision I got a lot of errors. This errors does not appear when I compile the project.
The errors appear in .asm file and say undefined symbol... What is all this about?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Likely the syntax of the assembler used isn't the same as the assembler you're using ;)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks!

There was som files I had forgot to implement..

There are some trouble here. When I try to compile the demo project for avr in the http://freemodbus.berlios.de/
I still got some errors. It say implicit declaration of function eMBInint. I know what it means but I thought the demo had all the files I need to run it. Is there anbody else who have had the same troubles?