Modbus for Xmega

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

Hello, I'm trying to get modbus working from freemodbus.com. I've downloaded the version for the Mega and started to change all settings for the Xmega.

Now the compiler gives no error but I cant send or receive anything. The whole controller just freezes up.

Does anyone has a working version for Xmega? I'm using the Xmega16A4u.

Fixed it, code is down

Last Edited: Tue. Apr 2, 2013 - 02:43 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
started to change all settings for the Xmega.
Maybe you could post the chages you have made to see if anyone can spot anything wrong?

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

aand its gone

Last Edited: Thu. Apr 4, 2013 - 01:04 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A diff would have been easier!

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

What do u mean?

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

Quote:
A diff would have been easier!
Or a ZIP file containing either a diff or full source.

Quote:
What do u mean?
Putting full source code for multiple files into a post is not only UGLY but also makes capturing your code a pain. Put it all in a ZIP file and attach it to your post.

Gamu The Killer Narwhal
Portland, OR, US
_________________
Atmel Studio 6.2
Windows 8.1 Pro
Xplained boards mostly

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

I have not read through the code above.

Just want to say I did minimal changes, mainly in portserial.c and porttimer.c and of course the demo code. A diff would not be many lines. (Mine would, as I put in a lot of my own requirements, sorry.)

The only not so easy thing is the baud calculations. I just manipulated the registers directly.

And as usual in such code: handle all interrupts! Also those you are not (intentionally) using. IMO that would be the most probable cause when you port code and it freezes.

And I had to change ".com" to ".org" to make it work. ;-)

The RTU server works like a charm here. And it does not eat a lot of CPU.

Einar Sjaavik

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

:arrow:

Attachment(s): 

Last Edited: Mon. Apr 8, 2013 - 07:04 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There's only one empty file in the zip container.

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

Quote:
A diff would have been easier!

Well I still have no idea what u mean with a diff?

Quote:
Putting full source code for multiple files into a post is not only UGLY but also makes capturing your code a pain. Put it all in a ZIP file and attach it to your post.

Was CTRL+C CTRL+V to hard?
I had posted the code and the only thing I hear that I should add it to a zip because the post looked to ugly. Well too bad, I can't give the complete solution because of work so I posted the things I've changed from the mega version. It seems that no one was happy with the code so I removed it.

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

Diff is a program that outputs the differences between two files.
http://en.wikipedia.org/wiki/Diff

Einar Sjaavik

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

Code updated