TOOTHPIC RF Solutions, TOOTHPIC Datasheet - Page 40

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 version of DARC-II that you have created should perform in exactly the same way as the example in the
Evaluation Version, except that now you can modify the rest of the code as you wish. The key features of the
source code are described below.
Initialization
After variables are initialized, the I/O and Bluetooth security are set as specified by the DARCcfg data
structure. The FlexiPanel user interface server is started. Finally, the function RefreshInputs() is called
to correctly set the state of any controls which are driven by the state of the I/O pins.
Main Program Loop
In the main program loop, the software determines whether the semaphore PulseClearCountDown has
been raised to request that it clears, after a 50ms pause, any I/O pins which are configured for pulse output. If
the semaphore is raised at any time while it is counting up to 50ms, is starts its 50ms delay count again. This
ensures that if two pins are pulsed in rapid succession, both pulses will be at least 50ms long. If the
semaphore was not raised at all, DARC-II simply waits 50ms. Either way, the delay is probably 50ms,
possibly a bit more.
If the refresh rate is 100ms, 200ms or 500ms, DARC-II waits the specified time (less the 50ms already waited)
and calls RefreshInputs()to update the inputs. If the refresh rate is longer than this, the LowInterrupt
callback will raise the semaphore RefeshInputsNow if it is time to refresh the inputs. In this case, DARC-II
inspects the semaphore to decide whether to call RefreshInputs().
High Interrupt
No high priority interrupts are expected nor provided for.
Low Interrupt
One type of low priority interrupts is provided for: when the clock ticks.
Every second, a SWI_Tick software interrupt will be received. DARC-II inverts the green LED to show that is
it working correctly. Note that this is not infallible indication since, if the main program loop hangs, SWI_Tick
software interrupts will probably still be generated correctly.
Next DARC-II decides whether it is time to raise the RefeshInputsNow semaphore and does so if required.
Page 40
4. Compile the code and program it into the ToothPIC.
9-Apr-06
SetBytes( STR_ROM00, (ADD)&DARCcfg.ToFromPin[ID_PC3_F], 0, &cVal,
cVal = TFP_L_ParallelA;
SetBytes( STR_ROM00, (ADD)&DARCcfg.ToFromPin[ID_PC3_F], 0, &cVal,
cVal = ID_CCP1_11;
SetBytes( STR_ROM00, (ADD)&DARCcfg.ToFromPin[TFP_NDTM_CCP1], 0, &cVal,
cVal = ID_CCP2_12;
SetBytes( STR_ROM00, (ADD)&DARCcfg.ToFromPin[TFP_NDTM_CCP2], 0, &cVal,
cVal = ID_CCP3_13;
SetBytes( STR_ROM00, (ADD)&DARCcfg.ToFromPin[TFP_NDTM_CCP3], 0, &cVal,
cVal = TFP_BILT_AN4;
SetBytes( STR_ROM00, (ADD)&DARCcfg.ToFromPin[ID_AN4_14], 0, &cVal,
cVal = TFP_BILT_AN5;
SetBytes( STR_ROM00, (ADD)&DARCcfg.ToFromPin[ID_AN5_15], 0, &cVal,
cVal = TFP_BILT_AN6;
SetBytes( STR_ROM00, (ADD)&DARCcfg.ToFromPin[ID_AN6_16], 0, &cVal,
cVal = TFP_BILT_AN7;
SetBytes( STR_ROM00, (ADD)&DARCcfg.ToFromPin[ID_AN7_17], 0, &cVal,
// if darc data has been programmed, set name and pin code
// new name only appears in device discovery after ToothPIC reset
if (DARCcfg.Initialized==0x55)
{
}
Toothpick 3.0.00007
SetBytes( STR_ROM00, (ADD)pLocalName, DARCcfg.ServerName, 0,MAXNAMELENGTHINCZ);
SetBytes( STR_ROM00, (ADD)pszPIN, DARCcfg.PINCode, 0, MAXPINLENGTHINCZ );
DS380-8
© FlexiPanel Ltd
Patents apply and/or pending
1 );
1 );
www.FlexiPanel.com
1 );
1 );
1 );
1 );
1 );
1 );
1 );

Related parts for TOOTHPIC