This port was done with the Atmel ATmega168 using two tools:
1. The WinAVR compiler avr-gcc (GCC) 4.1.2 (WinAVR 20070525)
and tools from <http://winavr.sourceforge.net/>, hints and
sample code from <http://www.avrfreaks.net/> and
<http://savannah.gnu.org/projects/avr-libc/>.
"avr-binutils, avr-gcc, and avr-libc form the heart of the
Free Software toolchain for the Atmel AVR microcontrollers."
2. AVR Studio from Atmel <http://atmel.com/>
Alternatively, the project also builds using IAR Embedded Workbench AVR.
The hardware is expected to utilize the signals as defined
in the spreadsheet hardware.ods (OpenOffice.org calc).
Attach a DS75176 RS-485 transceiver (or similar) to the USART.
DS75176 ATmega168
------ ---------
RO RXD
/RE --choice of I/O
DE --choice of I/O
DI TXD
GND GND
DO --to RS-485 wire
DO --to RS-485 wire
+5V From 5V Regulator
The makefile allows you to build just the dlmstp or a simple
server. dlmstp is the datalink layer for MS/TP over RS-485.
I used the makefile from the command line on Windows:
C:\code\bacnet-stack\ports\atmega168> make clean all
CStack check for GCC is included in the device object as property 512.
The compile shows 648 bytes of RAM used, and the ATmega168 has 1024 bytes
of RAM, leaving 376 for the CStack. Property 512 index 0 returns 376 from
a ReadProperty request. My understanding is that the remaining unallocated
RAM is used for the CStack. Keep this in mind when developing.
After some ReadProperty and WriteProperty requests, the CStack shows
159 CStack bytes free, meaning that 216 bytes of CStack are used.
Note that the value 0xC5 (197) was used to paint the CStack.
I also used the bacnet.aps project file in AVR Studio to
make the project and simulate it, but have not kept it updated (FIXME).
Compiler settings for IAR Embedded Workbench (FIXME: makefile?):
General Options
---------------
Target
Processor configuration: --cpu=m168. ATmega168
Memory Model: Small
System configuration: Configure system using dialogs (not in .XCL file)
Output
Executable
Output Directories: Debug\Exe, Debug\Obj, Debug\List
Library Configuration
Library: CLIB
Library Options
Printf formatter: Small
Scanf formatter: Medium
Heap Configuration
CLIB heap size: 0x10
System
CSTACK: 0x200
RSTACK: 32
Initialize unused interrupt vectors with RETI instructions (enabled)
Enable bit defnitions in I/O-Include files. (enabled)
MISRA C
not enabled
C/C++ Compiler
--------------
Language
Language: C
Require prototypes (not enabled)
Allow IAR extensions
Plain 'char' is Signed
Enable multibyte support (not enabled)
Code
Memory utilization:
Place aggregate initializers in flash memory (enabled)
Force generation of all global and static variables (not enabled)
Register utilization:
Number of registers to lock for global variables: 0
Use ICCA90 1.x calling convention (not enabled)
Optimizations
Size: High (Maximum optimization)
Number of cross-call passes: Unlimited
Always do cross call optimization (not enabled)
Output
Module type: Override default (not enabled)
Object module name (not enabled)
Generate debug information (enabled)
No error messages in output files (not enabled)
List
Output list file (not enabled)
Output assembler file (enabled)
Preprocessor
Ignore standard include paths (not enabled)
Include paths:
$PROJ_DIR$
$PROJ_DIR$\..\..\include
Preinclude file: (none)
Defined symbols:
BACDL_MSTP
MAX_APDU=50
BIG_ENDIAN=0
MAX_TSM_TRANSACTIONS=0
BACAPP_REAL
BACAPP_UNSIGNED
BACAPP_ENUMERATED
BACAPP_CHARACTER_STRING
BACAPP_OBJECT_ID
WRITE_PROPERTY
Diagnostics
(not enabled)
MISRA C
(not enabled)
Extra Options
Use command line options (not enabled)
Note: The BACnet Stack at Sourceforge source code has to be built
with lots of different compilers. The IAR compiler has particularly
strong (pedantic) source checking and generates several warnings when
compiling the source code. Unfortunately not all warnings can be
fixed by modifying the source code. Some warnings have therefore been
disabled in the project file.
Compiler Diagnostics:
(Pe550) I initilize all local variables as a best practice.
Linker Diagnostics:
(w31) The supplied standard libraries expect char parameters to
be unsigned (in functions such as strncpy(), etc.). It may
be possible to recompile the libraries with signed plain char's.
The BACnet Capabilities include WhoIs, I-Am, ReadProperty, and
WriteProperty support. The BACnet objects include a Device object,
10 Binary Value objects, and 10 Analog Value objects. An LED is
controlled by Binary Value object instance 0. All required object
properties can be retrieved using ReadProperty. The Present_Value
property of the Analog Value and Binary Value objects can be
written using WriteProperty. The Object_Identifier, Object_Name,
Max_Info_Frames, Max_Master, and baud rate (property 9600) of the
Device object can be written using WriteProperty.
With full optimization, the statistics on the demo are:
IAR Atmel AVR C/C++ Compiler V5.10A/W32
12 732 bytes of CODE memory (+ 36 range fill )
955 bytes of DATA memory (+ 24 absolute ) (includes CStack=0×200)
avr-gcc (GCC) 4.2.2 (WinAVR 20071221rc1)
Program: 15790 bytes (96.4% Full)
Data: 414 bytes (40.4% Full) (does not include CStack=0×262)
Hopefully you find this code useful!
Steve Karg <skarg@users.sourceforge.net>
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
BACNet(适用于楼宇自动化和各种控制网络的协议栈) (521个子文件)
bacrp.1 4KB
bacwi.1 3KB
bacnet.aps 7KB
.astylerc 175B
makefile.b32 5KB
makefile.b32 4KB
makefile.b32 3KB
makefile.b32 3KB
makefile.b32 3KB
makefile.b32 3KB
makefile.b32 3KB
makefile.b32 3KB
makefile.b32 3KB
makefile.b32 3KB
makefile.b32 3KB
makefile.b32 3KB
makefile.b32 3KB
makefile.b32 3KB
makefile.b32 3KB
build.bat 475B
bvlc.bat 471B
borland.bat 173B
borland.bat 173B
setvars.bat 53B
setvars.bat 26B
README.build 535B
bacdcode.c 75KB
mstp.c 73KB
event.c 60KB
mstp.c 59KB
dlmstp.c 57KB
lc.c 57KB
dlmstp.c 57KB
mstp.c 54KB
dlmstp.c 52KB
bactext.c 51KB
bacapp.c 50KB
bvlc.c 45KB
device.c 38KB
cov.c 34KB
rpm.c 32KB
dlmstp.c 30KB
datetime.c 26KB
lo.c 24KB
dlmstp.c 23KB
dlmstp.c 22KB
dlmstp.c 22KB
device.c 22KB
device.c 21KB
npdu.c 20KB
bacstr.c 20KB
apdu.c 19KB
h_cov.c 19KB
device.c 18KB
keylist.c 18KB
main.c 18KB
ao.c 18KB
mso.c 18KB
arf.c 18KB
bo.c 17KB
av.c 17KB
main.c 17KB
bv.c 17KB
h_rpm.c 16KB
main.c 16KB
av.c 16KB
timer.c 16KB
av.c 16KB
bip-init.c 15KB
address.c 15KB
bi.c 15KB
bacfile.c 15KB
awf.c 14KB
ethernet.c 14KB
ethernet.c 14KB
main.c 14KB
main.c 14KB
lsp.c 14KB
rp.c 14KB
wp.c 14KB
main.c 13KB
main.c 13KB
arcnet.c 13KB
h_wp.c 13KB
main.c 13KB
bacpropstates.c 12KB
bv.c 12KB
bv.c 12KB
rs485.c 12KB
device.c 12KB
rx_fsm.c 11KB
main.c 11KB
bip.c 11KB
ethernet.c 11KB
main.c 11KB
rx_fsm.c 11KB
main.c 11KB
tsm.c 11KB
rs485.c 11KB
h_rpm_a.c 11KB
共 521 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
- yannanfei2992012-07-19怎么是一堆源码啊?让我浪费2分。
- liuzhong1979532013-07-25确实没什么价值,这个源码到处都是。
- changch842012-07-31这个是sourceforge上面bacnet-stack的源码,大家就别浪费积分了。。
- bailiju2013-08-06资料有些参考价值,收藏。
hpain
- 粉丝: 2
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功