User Manual
Version 1.1
2011-07-15
deRFnode and deRFgateway
dresden elektronik
ingenieurtechnik gmbh
Enno-Heidebroek-Str. 12
12 7 Dr
n
rm  n
Tel.: +49 351 31 85 00
Fax: +49 351 3 18 50 10
wireless@dresden-elektronik.de
www. r
n- l k r nik.
Page 42 of 56
9.4.    Software programming model
This chapter is designated to describe how selected components of the deRFnode/gateway-
baseboard series may be accessed from a developers point of view. As stated in the previ-
ous chapters, we only support the GCC, so the following explanations may not fully work with
different compilers. Since this should not become a programming tutorial, please refer to the
individual device datasheets for details. Also the code snippets given in the following chap-
ters are only extracts. If you like to use them, its up to you, to surround them with a working
main application and add inclusions for necessary header files that may have been left.
For ARM-MCU based development, the AT91SAM7-Software Package [12] delivers besides
many application examples the so called AT91Library, a large collection of higher-level-
functions simplifying the development process. Since all following chapters base on it, down-
load and extract it to a directory of your desire. Now change to the packages subdirectory,
where you will find a set of application examples, one archive per application and compiler.
Delete all non-GNU-based examples and extract the resting to a common directory, confirm
to overwrite files when asked. This is necessary, since the AT91Lib is provided in parts only
where each is specially tailored to the belonging application example. Any path stated in fu-
ture   is   to   be   seen   relative   to   \at91sam7x-
ek\packages\\at91lib.
9.4.1. Enabling the reset supervisor
As already described in chapter 3 the Reset Supervisors output pin is routed to the MCUs
reset pin if JP 4 is shortcut. When using an AVR MCU, no further configuration is required.
But when using an ARM MCU, the reset pin functionality must be explicitly enabled. The re-
quired    library    module    is    /peripherals/rstc/rstc.c;    an    invocation    of
RSTC_SetUserResetEnable() may be used to enable or disable it.
9.4.2. Initialize and use I2C devices
All of the deRFnode/gateway boards include three environmental sensors which are acces-
sible via the two-wire (aka I
2
C)-Interface (TWI). To use them, you basically have to perform
the following steps:
(1) enable the TWI bus
(2) make the MCU the TWI master,
(3) configure the devices behavior and
(4) communicate with the device.
The first step is only necessary if you use deRFmega128-based radio modules. Here you
explicitly have to enable the both pull-ups on the SDA/SCL lines by setting PD6 to Low level:
DDRD |= (1<
// make PD6 an output pin
PORTD &= ~(1<
// switch to Low level
The second step is quite simple since there already exist ready-to-use functions. On AVR
MCUs, you may use Peter Fleurys library or its improved version from Manfred Langemann
(ask your favourite search engine). On ARM, the AT91Lib provides equivalent functionality
under drivers/twi and peripherals/twi. Independently of the implementation, you
usually must decide for a interface speed. 100 up to 400kHz is a good value. TWI libraries
may either run interrupt-driven or in polling mode. The latter case is enough for first tests
while if excessive using the I2C interface, interrupt-based implementations should be pre-
ferred.
相關(guān)代理商/技術(shù)參數(shù) |
參數(shù)描述 |
3077-0-00-01-00-00-33-0 |
制造商:Mill-Max Mfg Corp 功能描述: |
30770001 |
制造商: 功能描述: 制造商:undefined 功能描述: |
3077-0-00-15-00-00030 |
制造商:Mill-Max Mfg Corp 功能描述:3077 DOUBLE TAIL HEADER PIN |
307706 |
制造商:Weidmuller 功能描述:WBP-1/2IN NPT,STOPPING PLUG, -EA - Bulk |
307707 |
制造商:Weidmuller 功能描述:WBP-3/4IN NPT,STOPPING PLUG, -EA - Bulk |