2.1 Introduction
The Data Logger Module is a C-library for micro controller applications.
The Data Logger Module checks if an input pin has been changed (change
of state) and stores the new data (event) including a time stamp
(also including the date) in a FIFO (First In First Out) buffer.
Trigger conditions can be configured by the software. Trigger logic
can also be extended very easy by the programmer). The library can
be driven by an interrupt or using software polling. The library
is able to capture 16 input pins in parallel.
2.2 Funktionalty
Running in an main loop or driven by a ISR (Interrupt Service
Routine) pre defined input pins of the rabbit controller module
are read in and will be checked by the trigger logic. If a trigger
condition has been fulfilled the data will be stored in a FIFO (ring
buffer) including a time stamp. A further field, called INFO holds
the information if a buffer overflow has been occurred. This information
can later be used in the application to investigate what data are
valid.
Abbildung 2.1: Funktionsweise des Datenlogger-Moduls
2.3 Field
of applications
-
If changes of a long time period has to be watched
-
If data has to be transmitted e.g. over a network connections
in batches
-
If input frequency of the input pins is high
-
If changes on inputs are not very often. E.g. for a mobile
device or a data logger
2.4 Configuration/Parameters
2.4.1 Start of acquisition
Data acquistion can be started by different ways outlined in figure
2.2.:
Trigger condition |
Description |
Trigger by Event |
Acquistion starts if a defined event occurs |
Trigger by Bit |
Acquistion starts if a defined bit has been
changed |
Trigger by Software |
Acquistion starts by software command |
No Trigger |
Acquistion starts on startup of the system,
no special conditions |
Figure 2.2: Trigger conditions for data acquistion
2.4.2 Strategy for reading input pins
Scan process |
Description |
Scan all Inputs |
All input pins are captured at the same
time |
Scan specific Inputs |
Selected input pins can be switched of or
on (masking). |
Figure 2.3: Strategy for reading input pins
2.4.3 Selection of trigger edge
The trigger edge specifies if data acquistion starts on a falling
or a risig edge of selected input pins. It can be configured by
a method in the library.
Trigger edge |
Decription |
Trigger on positve Edge |
Data acquistion starts if selected input
pin changes ist state from logic level 0 to logic level 1 (rising
edge) |
Trigger on negative Edge |
Data acquistion starts if selected input
pin changes ist state from logic level 1to logic level 0 (falling
edge) |
Figure 2.4: Selectable trigger edges
2.4.4 Strategy of event buffer
Based on the requirements of the application the event buffer can
be configured to allow overwriting of data if an overflow occurs
or disallows data storing in the FIFO buffer. The two possible strategies
are outlined in figure 2.5.
Buffer sttrategy |
Description |
Overwrite Buffer |
If an overflow occurs, event data will be
overwritten. |
Do not overwrite Buffer |
If an overflow occurs, data storing in the
FIFO buffer is disallowed. The event buffer waits until at least
one new event can be placed in the buffer. |
Figure 2.5: Possible buffer strategies
2.4.5 Detection of buffer overflows
If the count of captured events exceeds the buffer size a buffer
overflow will occur. This situation can happen if a lot of events
occur in a short time and the system is not able to process the
data (e.g. read out the buffer and transmit it to another point).
In this case the INFO field indicates the first valid and the last
valid event. This data can later on be used by the application.
Possible values for an event are outlined in figure 2.6.
Value |
Description |
0 |
valid event |
1 |
first valid event after buffer overflow |
2 |
first invalid event after buffer overflow |
Abbildung 2.6: Meaning of Info field of the
event buffer
2.4.6 Polling vs. Interrupt mode
Following description outlines possibe operation modes for data
capturing and shows some advantages and disadvantages of the specific
operation mode.
2.4.6.1 Polling mode
Im Polling-Betrieb (Hauptprogrammschleife) werden die Eingänge
mit dem Durchlauf der Hauptprogramm¬schleife zyklisch überprüft.
Mit dieser Variante wird beim Einsatz des Datenlogger-Moduls gearbeitet.
Advantages |
Disadvantages |
- very good system stability
- no problems with concurrent writing an reading of event
buffer data
- easy to implement
- independent on hardware and consequently easy adaptable
to other micro controller systems
|
- processor will be used although no changes on input changes
occur
- accuracy of time capturing if trigger by software
|
Abbildung 2.7: Advantages and disadvantages
of polling operation mode
2.4.6.2 Interrupt mode
Using interrupt operation mode data acquistion is only performed
on specified changes of input pins or by a accurate timer.
Advantages |
Disadvantages |
- processor ressources ony needed if changes on inputs
occur
|
- hardware specific programming necessary
- event buffer hast to be thread save if program read
and writes data at the same timer
- if a lot of events occurs, the system can hang (system
stability)
|
Figure 2.8:Advantages and disadvantages of interrupt
operation mode
The Data Logger Module can be integrated very well in the Rabbit
Application Framework..
2.5Limitations
2.5.1 Capture frequency
The capture frequency depends on the performance of the other part
of the application. By using a RABBIT RCM 3200 micro controller
board and an application which only has the task to capture data
and to transmit it over network capture frequencies > 1KHz has
been measured.
2.5.2 Buffer size
Depending on the available RAM or ROM (e.g. by using a multi media
card) the buffer size can vary. For a RCM3200 micro controller module
holding 1024 events with 16 bit data a buffer size of 9 bytes (2
byte data, 1 byte info field, 6 byte of date and time), around 10
Kb RAM is necessary.
2.5.3 Program size
The data logger module needs around 1Kb of program memory.
2.5.3 Time stamps
Using the Dynamic C™ compiler with the included libraries
a variable SEC_TIMER is available. This variable will automatically
be incremented by the system every 1 second. Counting starts on
1.1.1989 00:00:00 a clock. Furthermore a variable MS_TIMER can be
accessed. This variable will overflow every 47 days after last reset
(unsigned long value). This can be inconvenient if the data logger
should capture data over long time period – longer than 47
days. For this reason the Dynamic C™ library vdriver.lib was
extended to a ms-timer that is synchronized with the RTC (Real Time
Clock) of the controller board and counts each second starting from
0 to 999 ms. Information about the necessary changes
can be found here.
2.6 Example Applications
2.6.1 Easy logic analyzer
A micro controller watches 16 digital input pins. The data will
be transmitted over a TCP-IP connection in packets to a Personal
Computer. On the Personal Computer the data will be processed and
plotted.
2.6.2 Acquisition of temperature over a long time period
On each eight input bits an ADC (Analogue to Digital Converter)
converts analogue values e.g. of a temperature and an air pressure
sensor. Data will be captured every 5 minutes and stored in the
FIFO buffer. After one week the data will be read out on the micro
controller an processed on a PC.
2.7 Scope of delivery
Buying the Data Logger Module library you get
-
the source code of the data logger module,
-
a description of the functionality of the essential procedures
and methods, also a description of the basic concept as well
as
-
two or more example applications demonstrating the use of
the library..
2.8 Price
2.9 Shipping
The library is available as archive in zip format As it can be
downloaded there are no further shipping cost. Alternatively a CD
can be ordered for addition Euro 5.- n Austria, shipping to other
at cost.
2.10 Links to other related products
Rabbit
Application Framework
Log-Server
for micro controller networks
Interface-Board
for Rabbit RCM3200-Modul (designed together with the data logger
module)
TCP-IP control
for Visual Studio™
|