TOOTHPIC RF Solutions, TOOTHPIC Datasheet - Page 35

MODULE, BLUETOOTH, DATA ACQUISITION

TOOTHPIC

Manufacturer Part Number
TOOTHPIC
Description
MODULE, BLUETOOTH, DATA ACQUISITION
Manufacturer
RF Solutions
Datasheet

Specifications of TOOTHPIC

Svhc
No SVHC (15-Dec-2010)
The application code for the ToothPIC DARC-I firmware solution is extensive and the entire project is
available for inspection in the development kit. The most important file to note is the application source code
file DARC-I.c. The key features of the source code are discussed below.
Static Declarations
ROM and RAM spaces provided for the user are reserved using static variables such as pFxPRAM000 and
p010000. This prevents the linker from using them for other purposes. The sample record array record is
declared statically for storing one record of data since this is faster than allocating it dynamically on the stack.
Initialization
When the application starts, settings are read from ROM and static variables are initialized. Then external
memory and security settings are enabled as required. Finally, both LEDs are flashed to provide visual
confirmation that the module is running.
Main Program Loop
The main program loop does nothing except put the BlueMatik module into slave mode if the application has
just initialized or if a remote device disconnects.
High Interrupt
No high priority interrupts are provided for. The only high priority interrupt expected is data from BlueMatik,
and ToothPIC Services manages that automatically.
Low Interrupt
Several types of low priority interrupts are expected:
When timer 4 overflows, the interrupt flag is immediately cleared. This allows the timer to interrupt again
when the next overflow occurs. This is not normally regarded as good practice since it is difficult to plan for
multiple interrupts making the stack overflow. However, in this case, we next detect whether a second
interrupt has been received while the previous one is still being processed; if it has, the ‘overflow’ error
semaphore is set and the timer is disabled. The interrupt processing routine then decrements a countdown
clock and, when it reaches zero, takes samples and stores or streams the data as necessary.
Every second, a SWI_Tick software interrupt will be received. When it is, the real time clock is compared to
the LogRate variable and, if due, a sample is taken and stored in memory.
When the BlueMatik receive buffer is updated, DARC-I first checks whether streaming is in process. If it is, it
will be interpreted as the instruction to stop streaming. Otherwise, it is interpreted as a partial or complete
command and is inspected for obvious errors. If there are any, or all the bytes of a command have been
received, a software interrupt is raised to process the command.
When the software interrupt is raised indicating that a complete command is awaiting processing, it is
processed as appropriate.
ErrorStatus
No errors are expected. If an error occurs, the auxiliary function InternalError() performs whatever task
is supposed to be performed in the event of an error.
Page 35
• When timer 4 overflows, which it may be configured to do every 200µs. .
• When the real time clock ticks each second.
• When the BlueMatik receive buffer has received a new byte.
• When a software interrupt is raised to indicate that a complete command is awaiting processing.
9-Apr-06
Toothpick 3.0.00007
DS380-8
© FlexiPanel Ltd
Patents apply and/or pending
www.FlexiPanel.com

Related parts for TOOTHPIC