freemodbus_AVR
所属分类:通讯编程
开发工具:C/C++
文件大小:64KB
下载次数:126
上传日期:2008-12-11 20:50:19
上 传 者:
baichaoying
说明: 此为modbus/rtu 通信 ,在atmega128上调试通过,本人想做modbus/tcp的,多多交流
(This is the modbus/rtu communications, in the ATmega128 debugging through, I want to modbus/tcp, and more exchanges)
文件列表:
freemodbus_AVR\avrdude.conf (239882, 2006-02-25)
freemodbus_AVR\default\dep\demo.o.d (0, 2008-12-04)
freemodbus_AVR\default\Makefile (3102, 2007-07-27)
freemodbus_AVR\demo.c (3231, 2007-07-27)
freemodbus_AVR\demo_rtu.bat (83, 2006-05-01)
freemodbus_AVR\excoils.c (3819, 2007-07-27)
freemodbus_AVR\freemodbus.aps (4522, 2007-07-28)
freemodbus_AVR\freemodbus.aws (1171, 2008-12-04)
freemodbus_AVR\functions\mbfunccoils.c (9887, 2007-02-19)
freemodbus_AVR\functions\mbfuncdiag.c (1662, 2006-12-07)
freemodbus_AVR\functions\mbfuncdisc.c (4613, 2007-07-27)
freemodbus_AVR\functions\mbfuncholding.c (12197, 2007-07-27)
freemodbus_AVR\functions\mbfuncinput.c (4835, 2007-07-27)
freemodbus_AVR\functions\mbfuncother.c (3532, 2007-07-27)
freemodbus_AVR\functions\mbutils.c (5096, 2007-07-27)
freemodbus_AVR\include\mb.h (19714, 2006-12-07)
freemodbus_AVR\include\mbconfig.h (5047, 2007-07-27)
freemodbus_AVR\include\mbframe.h (3788, 2006-12-07)
freemodbus_AVR\include\mbfunc.h (3114, 2006-12-07)
freemodbus_AVR\include\mbport.h (4881, 2006-12-07)
freemodbus_AVR\include\mbproto.h (3677, 2006-12-07)
freemodbus_AVR\include\mbutils.h (4218, 2006-12-07)
freemodbus_AVR\Makefile22 (2876, 2006-09-04)
freemodbus_AVR\mb.c (12678, 2007-07-27)
freemodbus_AVR\port\mbcrc.c (5057, 2006-05-14)
freemodbus_AVR\port\port.h (4177, 2007-07-27)
freemodbus_AVR\port\portevent.c (1755, 2007-07-27)
freemodbus_AVR\port\portserial.c (3622, 2007-07-27)
freemodbus_AVR\port\porttimer.c (2730, 2007-07-27)
freemodbus_AVR\rtu\mbcrc.c (5529, 2007-07-27)
freemodbus_AVR\rtu\mbcrc.h (1771, 2006-12-07)
freemodbus_AVR\rtu\mbrtu.c (11710, 2007-07-27)
freemodbus_AVR\rtu\mbrtu.h (2380, 2006-12-07)
freemodbus_AVR\说明.txt (362, 2007-07-30)
freemodbus_AVR\default\dep (0, 2008-12-04)
freemodbus_AVR\default (0, 2008-12-04)
freemodbus_AVR\functions (0, 2007-07-30)
freemodbus_AVR\include (0, 2007-07-30)
freemodbus_AVR\port (0, 2007-07-30)
... ...
FREEMODBUS 0.4 AVR EXAMPLE
==========================
REQUIREMENTS
============
This example contains a simple demo program for FreeMODBUS for an ATMega168
processor. It requires a wired serial port to a host processor and a Modbus
Master Software on the PC side to be useful. Demo versions of Modbus Masters
can be found in [1] and [2].
In addition it requires an ATMega168 target microcontroller. The micro-
controller must be configured for 20Mhz if the binary image is going to
be used. Otherwise the constant F_CPU in the Makefile must be changed
and the source code recompiled.
INSTALLATION
============
If avrdude [3] is used for flashing the Makefile contains a target 'flash'
which can be executed by calling 'make flash'. This programs the micro-
controller with the current binary named 'demo.hex'.
SOURCE
======
If one wants to recompile the software the WinAVR tools should be installed
if the host platform is Microsoft Windows. For Unix the necessary tools
must be recompiled from source. The WinAVR tools can be found at [4].
TESTING
=======
Start the Modbus Sample Application and test if the input registers starting
at protocol address 1000 can be read. There are four registers value available
and the output should look like:
Polling slave (Ctrl-C to stop) ...
[1000]: ***74
[1001]: 0
[1002]: 0
[1003]: 0
Polling slave (Ctrl-C to stop) ...
[1000]: -8831
[1001]: 0
[1002]: 0
[1003]: 0
Polling slave (Ctrl-C to stop) ...
The simple testing utility used in the 'demo_rtu.bat' script can be found
at [5].
PROBLEMS
========
If the provided binary is not working as expected make sure that the fuse
bits for the microcontroller are programmed correctly. In addition it would
be a good idea to download a simple serial test programm to test serial
communication with the host. The fuse bits required for an ATMega168 with
an 20Mhz crystal must be set to the following values:
Fuse Low Byte: 1XXXXXX
|
CKDIV8
The other values depend on the crystal used and the startup time. The
authors configuration used a value of 0xFF. Again if avrdude is used the
value can be set by:
avrdude -p m168 -c stk200 -U lfuse:w:0xFF:m
where the 0xFF at the end of line is the actual value.
[1] WinTech ModScan32: http://www.win-tech.com/html/modscan32.htm
[2] Modus Poll: http://www.modbustools.com/modbus_poll.asp
[3] AVRDUDE AVR Downloader/UploaDEr: http://www.nongnu.org/avrdude/
[4] WinAVR: http://winavr.sourceforge.net/
[5] FieldTalk Modpoll: http://www.focus-sw.com/fieldtalk/modpoll.html
Version: $Id: README.txt,v 1.1 2006/05/08 21:07:01 wolti Exp $
近期下载者:
相关文件:
收藏者: