Download Print this page

Analog Devices DC2515B Demo Manual page 12

6-channel battery-stack monitor with daisy-chain interface

Advertisement

DEMO MANUAL DC2515B
APPENDIX A: THE SKETCHBOOK CONTENTS
What Is A Sketch
A sketch is simply another word for a microcontroller/
Linduino program. The term is generally only used when
referring to Arduino-based programs, as sketches have
several abstractions that remove some of the complex-
ity of a standard microcontroller (MCU) program. All
sketches contain two primary functions, the setup() and
the loop() function. These are in fact the only functions
that are mandatory in a sketch and are almost always
implemented in some form in a typical MCU program.
The setup() function is run once at power on or after the
MCU is reset. The setup() function generally is used to
initialize the MCU peripheral circuits and to initialize all
of the control variables. The loop() function is similar to
a main() function that has implemented an infinite loop
inside a standard C program. The code within the loop()
function is typically where the primary program code is
placed. The code within the loop() function will repeat
infinitely.
Sketch Modifications
Sketches can be modified to a set of applications spe-
cific requirements. All sketches are written such that the
most common modifications can be made by changing
the variables listed in the /*Setup Variables */ table at the
top of the sketch. For reference, example modifications
to a DC2259 (LTC6811) sketch are shown below. These
modifications are applicable to most of the available BMS
ICs in the sketchbook.
Common modifications can be made by changing the
Setup Variables. The most common application changes
are listed below. After the variables are changed, the
sketch will need to be recompiled and uploaded to the
Linduino.
1. To change the number of ICs in the isoSPI network,
change the TOTAL_IC variable. A number between 1
12
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
and 4 should be entered. In an application that has 2
devices in the network the modified line will look like
the following.
const uint8_t TOTAL_IC = 2;
2. Often an application may need to sample data at a rate
faster than the default 500ms (2Hz). To modify the loop/
sample rate the MEASUREMENT_LOOP_TIME variable
should be changed. The loop time must be entered in
milliseconds and should be a number larger than 20ms.
To change the loop rate to roughly 10 measurements
a second the loop rate should be changed to 100ms.
The modified line will look like the following.
const uint16_t MEASUREMENT_LOOP_TIME = 100;
3. It is possible to modify which measurements fall within
the loop during the Loop Measurements command. The
following list are the measurements that can be looped.
const uint8_t MEASURE_CELL = ENABLED;
// This is ENABLED or DISABLED
const uint8_t MEASURE_AUX = DISABLED;
// This is ENABLED or DISABLED
const uint8_t MEASURE_STAT = DISABLED;
//This is ENABLED or DISABLED
By default, only a cell measurement is done, as noted
by MEASURE_CELL = ENABLED. What measurements
are made can be changed by setting what the Measure
field is equal to. To Measure Cells and the Status register
but not the AUX register, the variables would be setup
as shown below.
const uint8_t MEASURE_CELL = ENABLED;
// This is ENABLED or DISABLED
const uint8_t MEASURE_AUX = DISABLED;
// This is ENABLED or DISABLED
const uint8_t MEASURE_STAT = ENABLED;
//This is ENABLED or DISABLED
Rev. 0

Advertisement

loading
Need help?

Need help?

Do you have a question about the DC2515B and is the answer not in the manual?

Questions and answers