TOOTHPIC RF Solutions, TOOTHPIC Datasheet - Page 39

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)
Page 39
3. To customize the I/O configuration, you will need to modify the I/O configuration data structure
initialized in DARCIIConfig.c and described in detail in DARCIIConfig.h. Rather than modify the
DARCIIConfig.c file directly, it is better to overwrite the data during program initialization. This
allows you to use the macros in DARCIITestRes.h so that if you add or delete controls, the control
ID information is automatically updated. (The SetBytes function only writes to Flash memory if the
values are different from the desired values, so this will not exhaust the Flash memory.) To customize
the I/O configuration, open the file DARC-II.c and insert the following lines at the beginning of the
main() function (or copy them from the file DARC-II Customized.c file in the development kit):
9-Apr-06
// main program
#include "DARCIITestRes.h"
rom unsigned char szMyName[] = "My Product Title";
void main( void )
{
unsigned char cVal;
PulseClearCountDown = 0;
RefeshInputsNow = 0;
// if no BlueMatik, flash red led rapidly
while ((ToothPICSemaphores&TPSF_BMTEXISTS)==0)
{
}
// customize DARCcfg
cVal = 0x55;
SetBytes( STR_ROM00, (ADD)&DARCcfg.Initialized, 0, &cVal, 1 );
// device name
SetBytes( STR_ROM00, (ADD)DARCcfg.ServerName, szMyName, 0, MAXNAMELENGTHINCZ );
// four analog channels, AN0 to AN3
cVal = 0x04;
SetBytes( STR_ROM00, (ADD)&DARCcfg.nAnalogChannel, 0, &cVal,
// configure I/O; note default values are zeroes so if a value is zero,
/
// DARCcfg.h explains the cVal values being used
cVal = 0x01;
SetBytes( STR_ROM00, (ADD)&DARCcfg.PinFuncAN9, 0, &cVal,
SetBytes( STR_ROM00, (ADD)&DARCcfg.PinFuncAN10, 0, &cVal,
SetBytes( STR_ROM00, (ADD)&DARCcfg.PinFuncAN11, 0, &cVal,
SetBytes( STR_ROM00, (ADD)&DARCcfg.PinFuncTxD, 0, &cVal,
SetBytes( STR_ROM00, (ADD)&DARCcfg.PinFuncSCL, 0, &cVal,
SetBytes( STR_ROM00, (ADD)&DARCcfg.PinFuncSDA, 0, &cVal,
SetBytes( STR_ROM00, (ADD)&DARCcfg.PinFuncSDO, 0, &cVal,
cVal = 0x02;
SetBytes( STR_ROM00, (ADD)&DARCcfg.PinFuncCCP1, 0, &cVal,
SetBytes( STR_ROM00, (ADD)&DARCcfg.PinFuncCCP2, 0, &cVal,
SetBytes( STR_ROM00, (ADD)&DARCcfg.PinFuncCCP3, 0, &cVal,
cVal = 0x03;
SetBytes( STR_ROM00, (ADD)&DARCcfg.ParallelA, 0, &cVal,
SetBytes( STR_ROM00, (ADD)&DARCcfg.ParallelC, 0, &cVal,
cVal = 0x02;
SetBytes( STR_ROM00, (ADD)&DARCcfg.ParallelA, 0, &cVal,
cVal = 0xFF;
SetBytes( STR_ROM00, (ADD)&DARCcfg.PWMPeriod, 0, &cVal,
cVal = 0x05;
SetBytes( STR_ROM00, (ADD)&DARCcfg.RefreshRate, 0, &cVal,
// link controls to I/O
cVal = TFP_BILT_TxD;
SetBytes( STR_ROM00, (ADD)&DARCcfg.ToFromPin[ID_TxD_1B], 0, &cVal,
cVal = TFP_BILT_SDO;
SetBytes( STR_ROM00, (ADD)&DARCcfg.ToFromPin[ID_SDO_7], 0, &cVal,
cVal = TFP_BILT_SDA;
SetBytes( STR_ROM00, (ADD)&DARCcfg.ToFromPin[ID_SDA_8], 0, &cVal,
cVal = TFP_BILT_SCL;
SetBytes( STR_ROM00, (ADD)&DARCcfg.ToFromPin[ID_SCL_9], 0, &cVal,
cVal = TFP_NDTM_AN0;
SetBytes( STR_ROM00, (ADD)&DARCcfg.ToFromPin[ID_AN0_18], 0, &cVal,
cVal = TFP_NDTM_AN1;
SetBytes( STR_ROM00, (ADD)&DARCcfg.ToFromPin[ID_AN1_C], 0, &cVal,
cVal = TFP_NDTM_AN2;
SetBytes( STR_ROM00, (ADD)&DARCcfg.ToFromPin[ID_AN2_D], 0, &cVal,
cVal = TFP_NDTM_AN3;
SetBytes( STR_ROM00, (ADD)&DARCcfg.ToFromPin[ID_AN3_E], 0, &cVal,
cVal = TFP_NDTM_ParallelC;
Toothpick 3.0.00007
we don't bother altering it
LedRed = ~LedRed;
msDelay(50);
// indicates config data has been initialized
// output
// PWM output
// Parallel A and Parallal C are both 3-bits wide
// Timebase is 3.2us (
// PWM period is (0xFF + 1) = 256 Timebase units
// Refresh every two seconds
DS380-8
© FlexiPanel Ltd
Patents apply and/or pending
1 );
1 );
1 );
1 );
1 );
1 );
1 );
1 );
1 );
1 );
1 );
1 );
1 );
1 );
1 );
1 );
1 );
1 );
1 );
1 );
1 );
1 );
www.FlexiPanel.com
1 );
1 );

Related parts for TOOTHPIC