| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

Functions | Macros
LTC6813.h File Reference
Battery Management System (BMS) » LTC6813-1: Multicell Battery Monitor

LTC6813: Multicell Battery Monitors. More...

## Detailed Description

LTC6813: Multicell Battery Monitors.

    *The LTC6813 is multi-cell battery stack monitor that measures up to 18 series
    *connected battery cells with a total measurement error of less than 2.2mV.
    *The cell measurement range of 0V to 5V makes the LTC6813 suitable for most
    *battery chemistries. All 18 cell voltages can be captured in 290uS, and lower
    *data acquisition rates can be selected for high noise reduction.
    *Using the LTC6813-1, multiple devices are connected in a daisy-chain with one
    *host processor connection for all devices, permitting simultaneous cell monitoring
    *of long, high voltage battery strings.
    *

https://www.analog.com/en/products/ltc6813-1.html https://www.analog.com/en/design-center/evaluation-hardware-and-software/evaluation-boards-kits/dc2350a-b.html

Copyright 2019(c) Analog Devices, Inc.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
- The use of this software may or may not infringe the patent rights of one or more patent holders. This license does not release you from the requirement that you obtain separate licenses from these patent holders to use this software.
- Use of the software either in source or binary form, must be run on or directly connected to an Analog Devices Inc. component.

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Header for LTC6813-1 Multicell Battery Monitor

Definition in file LTC6813.h.

Go to the source code of this file.

## Functions
void | LTC6813_init_reg_limits (uint8_t total_ic, cell_asic *ic)
| Helper function to initialize register limits. More...
void | LTC6813_wrcfg (uint8_t total_ic, cell_asic *ic)
| Write the LTC6813 configuration register A. More...
void | LTC6813_wrcfgb (uint8_t total_ic, cell_asic *ic)
| Write the LTC6813 configuration register B. More...
int8_t | LTC6813_rdcfg (uint8_t total_ic, cell_asic *ic)
| Reads configuration register A of a LTC6813 daisy chain. More...
int8_t | LTC6813_rdcfgb (uint8_t total_ic, cell_asic *ic)
| Reads configuration register B of a LTC6813 daisy chain. More...
void | LTC6813_adcv (uint8_t MD, uint8_t DCP, uint8_t CH)
| Starts cell voltage conversion. More...
void | LTC6813_adax (uint8_t MD, uint8_t CHG)
| Start a GPIO and Vref2 Conversion. More...
void | LTC6813_adstat (uint8_t MD, uint8_t CHST)
| Start a Status ADC Conversion. More...
void | LTC6813_adcvax (uint8_t MD, uint8_t DCP)
| Starts cell voltage and GPIO 1 & 2 conversion. More...
void | LTC6813_adcvsc (uint8_t MD, uint8_t DCP)
| Starts cell voltage and Sum of cells conversion. More...
uint8_t | LTC6813_rdcv (uint8_t reg, uint8_t total_ic, cell_asic *ic)
| Reads and parses the LTC6813 cell voltage registers. More...
int8_t | LTC6813_rdaux (uint8_t reg, uint8_t nIC, cell_asic *ic)
| Reads and parses the LTC6813 auxiliary registers. More...
int8_t | LTC6813_rdstat (uint8_t reg, uint8_t total_ic, cell_asic *ic)
| Reads and parses the LTC6813 stat registers. More...
uint8_t | LTC6813_pladc ()
| Sends the poll ADC command. More...
uint32_t | LTC6813_pollAdc ()
| This function will block operation until the ADC has finished it's conversion. More...
void | LTC6813_clrcell ()
| Clears the LTC6813 cell voltage registers. More...
void | LTC6813_clraux ()
| Clears the LTC6813 Auxiliary registers. More...
void | LTC6813_clrstat ()
| Clears the LTC6813 Stat registers. More...
void | LTC6813_diagn ()
| Starts the Mux Decoder diagnostic self test Running this command will start the Mux Decoder Diagnostic Self Test This test takes roughly 1mS to complete. More...
void | LTC6813_cvst (uint8_t MD, uint8_t ST)
| Starts cell voltage self test conversion. More...
void | LTC6813_axst (uint8_t MD, uint8_t ST)
| Start an Auxiliary Register Self Test Conversion. More...
void | LTC6813_statst (uint8_t MD, uint8_t ST)
| Start a Status Register Self Test Conversion. More...
void | LTC6813_adol (uint8_t MD, uint8_t DCP)
| Starts cell voltage overlap conversion. More...
void | LTC6813_adaxd (uint8_t MD, uint8_t CHG)
| Start an GPIO Redundancy test. More...
void | LTC6813_adstatd (uint8_t MD, uint8_t CHST)
| Start a Status register redundancy test Conversion. More...
int16_t | LTC6813_run_cell_adc_st (uint8_t adc_reg, uint8_t total_ic, cell_asic *ic, uint8_t md, bool adcopt)
| Helper function that runs the ADC Self Tests. More...
uint16_t | LTC6813_run_adc_overlap (uint8_t total_ic, cell_asic *ic)
| Helper Function that runs the ADC Overlap test. More...
int16_t | LTC6813_run_adc_redundancy_st (uint8_t adc_mode, uint8_t adc_reg, uint8_t total_ic, cell_asic *ic)
| Helper function that runs the ADC Digital Redundancy commands and checks output for errors. More...
void | LTC6813_adow (uint8_t MD, uint8_t PUP, uint8_t CH, uint8_t DCP)
| Start an open wire Conversion. More...
void | LTC6813_axow (uint8_t MD, uint8_t PUP)
| Start GPIOs open wire ADC conversion. More...
void | LTC6813_run_openwire_single (uint8_t total_ic, cell_asic *ic)
| Helper function that runs the data sheet algorithm for open wire for single cell detection. More...
void | LTC6813_run_openwire_multi (uint8_t total_ic, cell_asic *ic)
| Helper function that runs open wire for multiple cell and two consecutive cells detection. More...
void | LTC6813_run_gpio_openwire (uint8_t total_ic, cell_asic *ic)
| Runs open wire for GPIOs. More...
void | LTC6813_set_discharge (int Cell, uint8_t total_ic, cell_asic *ic)
| Helper Function to Set DCC bits in the CFGR Registers. More...
void | LTC6813_clear_discharge (uint8_t total_ic, cell_asic *ic)
| Helper Function to clear DCC bits in the CFGR Registers. More...
void | LTC6813_wrpwm (uint8_t total_ic, uint8_t pwmReg, cell_asic *ic)
| Write the LTC6813 PWM register. More...
int8_t | LTC6813_rdpwm (uint8_t total_ic, uint8_t pwmReg, cell_asic *ic)
| Reads pwm registers of a LTC6813 daisy chain. More...
void | LTC6813_wrsctrl (uint8_t nIC, uint8_t sctrl_reg, cell_asic *ic)
| Write the LTC6813 Sctrl register. More...
int8_t | LTC6813_rdsctrl (uint8_t nIC, uint8_t sctrl_reg, cell_asic *ic)
| Reads sctrl registers of a LTC6813 daisy chain. More...
void | LTC6813_stsctrl ()
| Start Sctrl data communication This command will start the sctrl pulse communication over the spins. More...
void | LTC6813_clrsctrl ()
| Clears the LTC6813 Sctrl registers. More...
void | LTC6813_wrpsb (uint8_t total_ic, cell_asic *ic)
| Write the 6813 PWM/Sctrl Register B. More...
uint8_t | LTC6813_rdpsb (uint8_t total_ic, cell_asic *ic)
| Reading pwm/s control register B. More...
void | LTC6813_wrcomm (uint8_t total_ic, cell_asic *ic)
| Write the LTC6813 COMM register. More...
int8_t | LTC6813_rdcomm (uint8_t total_ic, cell_asic *ic)
| Reads comm registers of a LTC6813 daisy chain. More...
void | LTC6813_stcomm (uint8_t len)
| Issues a stcomm command and clocks data out of the COMM register. More...
void | LTC6813_mute ()
| Mutes the LTC6813 discharge transistors. More...
void | LTC6813_unmute ()
| Clears the LTC6813 Mute Discharge. More...
void | LTC6813_check_pec (uint8_t total_ic, uint8_t reg, cell_asic *ic)
| Helper Function that counts overall PEC errors and register/IC PEC errors. More...
void | LTC6813_reset_crc_count (uint8_t total_ic, cell_asic *ic)
| Helper Function that resets the PEC error counters. More...
void | LTC6813_init_cfg (uint8_t total_ic, cell_asic *ic)
| Helper Function to initialize the CFGR data structures. More...
void | LTC6813_set_cfgr (uint8_t nIC, cell_asic *ic, bool refon, bool adcopt, bool gpio[5], bool dcc[12], bool dcto[4], uint16_t uv, uint16_t ov)
| Helper function to set appropriate bits in CFGR register based on bit function. More...
void | LTC6813_set_cfgr_refon (uint8_t nIC, cell_asic *ic, bool refon)
| Helper function to turn the REFON bit HIGH or LOW. More...
void | LTC6813_set_cfgr_adcopt (uint8_t nIC, cell_asic *ic, bool adcopt)
| Helper function to turn the ADCOPT bit HIGH or LOW. More...
void | LTC6813_set_cfgr_gpio (uint8_t nIC, cell_asic *ic, bool gpio[])
| Helper function to turn the GPIO bits HIGH or LOW. More...
void | LTC6813_set_cfgr_dis (uint8_t nIC, cell_asic *ic, bool dcc[])
| Helper function to turn the DCC bits HIGH or LOW. More...
void | LTC6813_set_cfgr_uv (uint8_t nIC, cell_asic *ic, uint16_t uv)
| Helper function to set UV field in CFGRA register. More...
void | LTC6813_set_cfgr_dcto (uint8_t nIC, cell_asic *ic, bool dcto[4])
| Helper function to set DCTO field in CFGRA register. More...
void | LTC6813_set_cfgr_ov (uint8_t nIC, cell_asic *ic, uint16_t ov)
| Helper function to set OV field in CFGRA register. More...
void | LTC6813_init_cfgb (uint8_t total_ic, cell_asic *ic)
| Helper Function to initialize the CFGR B data structures. More...
void | LTC6813_set_cfgrb (uint8_t nIC, cell_asic *ic, bool fdrf, bool dtmen, bool ps[2], bool gpiobits[4], bool dccbits[7])
| Helper function to set appropriate bits in CFGR register based on bit function. More...
void | LTC6813_set_cfgrb_fdrf (uint8_t nIC, cell_asic *ic, bool fdrf)
| Helper function to turn the FDRF bit HIGH or LOW. More...
void | LTC6813_set_cfgrb_dtmen (uint8_t nIC, cell_asic *ic, bool dtmen)
| Helper function to turn the DTMEN bit HIGH or LOW. More...
void | LTC6813_set_cfgrb_ps (uint8_t nIC, cell_asic *ic, bool ps[])
| Helper function to turn the Path Select bit HIGH or LOW. More...
void | LTC6813_set_cfgrb_gpio_b (uint8_t nIC, cell_asic *ic, bool gpiobits[])
| Helper function to turn the GPIO bit HIGH or LOW. More...
void | LTC6813_set_cfgrb_dcc_b (uint8_t nIC, cell_asic *ic, bool dccbits[])
| Helper function to turn the DCC bit HIGH or LOW. More...

## Macros
#define | CELL 1
#define | AUX 2
#define | STAT 3

## Function Documentation

## ◆ LTC6813_adax()

void LTC6813_adax | ( | uint8_t | MD,
|  | uint8_t | CHG
| ) |  |

Start a GPIO and Vref2 Conversion.

Returns
  void

Parameters

  MD | ADC Conversion Mode
  CHG | Sets which GPIO channels are converted

Definition at line 136 of file LTC6813.cpp.

## ◆ LTC6813_adaxd()

void LTC6813_adaxd | ( | uint8_t | MD,
|  | uint8_t | CHG
| ) |  |

Start an GPIO Redundancy test.

Returns
  void

Parameters

  MD | ADC Conversion Mode
  CHG | Sets which GPIO channels are converted

Definition at line 290 of file LTC6813.cpp.

## ◆ LTC6813_adcv()

void LTC6813_adcv | ( | uint8_t | MD,
|  | uint8_t | DCP,
|  | uint8_t | CH
| ) |  |

Starts cell voltage conversion.

Returns
  void

Parameters

  MD | ADC Conversion Mode
  DCP | Controls if Discharge is permitted during conversion
  CH | Sets which Cell channels are converted

Definition at line 127 of file LTC6813.cpp.

## ◆ LTC6813_adcvax()

void LTC6813_adcvax | ( | uint8_t | MD,
|  | uint8_t | DCP
| ) |  |

Starts cell voltage and GPIO 1 & 2 conversion.

Returns
  void

Parameters

  MD | ADC Conversion Mode
  DCP | Controls if Discharge is permitted during conversion

Definition at line 152 of file LTC6813.cpp.

## ◆ LTC6813_adcvsc()

void LTC6813_adcvsc | ( | uint8_t | MD,
|  | uint8_t | DCP
| ) |  |

Starts cell voltage and Sum of cells conversion.

Returns
  void

Parameters

  MD | ADC Conversion Mode
  DCP | Controls if Discharge is permitted during conversion

Definition at line 160 of file LTC6813.cpp.

## ◆ LTC6813_adol()

void LTC6813_adol | ( | uint8_t | MD,
|  | uint8_t | DCP
| ) |  |

Starts cell voltage overlap conversion.

Returns
  void

Parameters

  MD | ADC Conversion Mode
  DCP | Discharge permitted during conversion

Definition at line 282 of file LTC6813.cpp.

## ◆ LTC6813_adow()

void LTC6813_adow | ( | uint8_t | MD,
|  | uint8_t | PUP,
|  | uint8_t | CH,
|  | uint8_t | DCP
| ) |  |

Start an open wire Conversion.

Returns
  void

Parameters

  MD | ADC Conversion Mode
  PUP | Pull up/Pull down current
  CH | Sets which Cell channels are converted
  DCP | Discharge permitted during conversion

Definition at line 365 of file LTC6813.cpp.

## ◆ LTC6813_adstat()

void LTC6813_adstat | ( | uint8_t | MD,
|  | uint8_t | CHST
| ) |  |

Start a Status ADC Conversion.

Returns
  void

Parameters

  MD | ADC Conversion Mode
  CHST | Sets which Stat channels are converted

Definition at line 144 of file LTC6813.cpp.

## ◆ LTC6813_adstatd()

void LTC6813_adstatd | ( | uint8_t | MD,
|  | uint8_t | CHST
| ) |  |

Start a Status register redundancy test Conversion.

Returns
  void

Parameters

  MD | ADC Mode
  CHST | Sets which Status channels are converted

Definition at line 298 of file LTC6813.cpp.

## ◆ LTC6813_axow()

void LTC6813_axow | ( | uint8_t | MD,
|  | uint8_t | PUP
| ) |  |

Start GPIOs open wire ADC conversion.

Returns
  void

Parameters

  MD | ADC Mode
  PUP | Pull up/Pull down current

Definition at line 375 of file LTC6813.cpp.

## ◆ LTC6813_axst()

void LTC6813_axst | ( | uint8_t | MD,
|  | uint8_t | ST
| ) |  |

Start an Auxiliary Register Self Test Conversion.

Returns
  void

Parameters

  MD | ADC Conversion Mode
  ST | Sets if self test 1 or 2 is run

Definition at line 266 of file LTC6813.cpp.

## ◆ LTC6813_check_pec()

void LTC6813_check_pec | ( | uint8_t | total_ic,
|  | uint8_t | reg,
|  | cell_asic * | ic
| ) |  |

Helper Function that counts overall PEC errors and register/IC PEC errors.

Returns
  void

Parameters

  total_ic | Number of ICs in the system
  reg | Type of register
  ic | A two dimensional array that will store the data

Definition at line 630 of file LTC6813.cpp.

## ◆ LTC6813_clear_discharge()

void LTC6813_clear_discharge | ( | uint8_t | total_ic,
|  | cell_asic * | ic
| ) |  |

Helper Function to clear DCC bits in the CFGR Registers.

Returns
  void

Parameters

  total_ic | Number of ICs in the system
  ic | A two dimensional array that will store the data

Definition at line 442 of file LTC6813.cpp.

## ◆ LTC6813_clraux()

void LTC6813_clraux | ( |  | ) |

Clears the LTC6813 Auxiliary registers.

Returns
  void

Definition at line 236 of file LTC6813.cpp.

## ◆ LTC6813_clrcell()

void LTC6813_clrcell | ( |  | ) |

Clears the LTC6813 cell voltage registers.

Returns
  void

Definition at line 226 of file LTC6813.cpp.

## ◆ LTC6813_clrsctrl()

void LTC6813_clrsctrl | ( |  | ) |

Clears the LTC6813 Sctrl registers.

Returns
  void

Definition at line 501 of file LTC6813.cpp.

## ◆ LTC6813_clrstat()

void LTC6813_clrstat | ( |  | ) |

Clears the LTC6813 Stat registers.

Returns
  void

Definition at line 246 of file LTC6813.cpp.

## ◆ LTC6813_cvst()

void LTC6813_cvst | ( | uint8_t | MD,
|  | uint8_t | ST
| ) |  |

Starts cell voltage self test conversion.

Returns
  void

Parameters

  MD | ADC Conversion Mode
  ST | Self Test Mode

Definition at line 258 of file LTC6813.cpp.

## ◆ LTC6813_diagn()

void LTC6813_diagn | ( |  | ) |

Starts the Mux Decoder diagnostic self test Running this command will start the Mux Decoder Diagnostic Self Test This test takes roughly 1mS to complete.

The MUXFAIL bit will be updated, the bit will be set to 1 for a failure and 0 if the test has been passed.

Returns
  void

Definition at line 252 of file LTC6813.cpp.

## ◆ LTC6813_init_cfg()

void LTC6813_init_cfg | ( | uint8_t | total_ic,
|  | cell_asic * | ic
| ) |  |

Helper Function to initialize the CFGR data structures.

Returns
  void

Parameters

  total_ic | Number of ICs in the system
  ic | A two dimensional array that will store the data

Definition at line 647 of file LTC6813.cpp.

## ◆ LTC6813_init_cfgb()

void LTC6813_init_cfgb | ( | uint8_t | total_ic,
|  | cell_asic * | ic
| ) |  |

Helper Function to initialize the CFGR B data structures.

Returns
  void

Parameters

  total_ic | Number of ICs in the system
  ic | A two dimensional array that will store the data

Definition at line 707 of file LTC6813.cpp.

## ◆ LTC6813_init_reg_limits()

void LTC6813_init_reg_limits | ( | uint8_t | total_ic,
|  | cell_asic * | ic
| ) |  |

Helper function to initialize register limits.

Returns
  void

Parameters

  total_ic | Number of ICs in the system
  ic | A two dimensional array that will store the data

Definition at line 67 of file LTC6813.cpp.

## ◆ LTC6813_mute()

void LTC6813_mute | ( |  | ) |

Mutes the LTC6813 discharge transistors.

Returns
  void

Definition at line 610 of file LTC6813.cpp.

## ◆ LTC6813_pladc()

uint8_t LTC6813_pladc | ( |  | ) |

Sends the poll ADC command.

Returns
  1 byte read back after a pladc command. If the byte is not 0xFF ADC conversion has completed

Definition at line 210 of file LTC6813.cpp.

## ◆ LTC6813_pollAdc()

uint32_t LTC6813_pollAdc | ( |  | ) |

This function will block operation until the ADC has finished it's conversion.

Returns
  uint32_t, counter The approximate time it took for the ADC function to complete.

Definition at line 216 of file LTC6813.cpp.

## ◆ LTC6813_rdaux()

int8_t LTC6813_rdaux | ( | uint8_t | reg,
|  | uint8_t | nIC,
|  | cell_asic * | ic
| ) |  |

Reads and parses the LTC6813 auxiliary registers.

Returns
  int8_t, pec_error PEC Status 0: No PEC error detected -1: PEC error detected, retry read

Parameters

  reg | Controls which GPIO voltage register is read back
  nIC | The number of ICs in the daisy chain
  ic | A two dimensional array of the parsed gpio voltage codes

Definition at line 183 of file LTC6813.cpp.

## ◆ LTC6813_rdcfg()

int8_t LTC6813_rdcfg | ( | uint8_t | total_ic,
|  | cell_asic * | ic
| ) |  |

Reads configuration register A of a LTC6813 daisy chain.

Returns
  int8_t, PEC Status. 0: Data read back has matching PEC -1: Data read back has incorrect PEC

Parameters

  total_ic | Number of ICs in the system
  ic | A two dimensional array that the function stores the read configuration data

Definition at line 107 of file LTC6813.cpp.

## ◆ LTC6813_rdcfgb()

int8_t LTC6813_rdcfgb | ( | uint8_t | total_ic,
|  | cell_asic * | ic
| ) |  |

Reads configuration register B of a LTC6813 daisy chain.

Returns
  int8_t, pec_error PEC Status. 0: Data read back has matching PEC -1: Data read back has incorrect PEC

Parameters

  total_ic | Number of ICs in the system
  ic | A two dimensional array that the function stores the read configuration data

Definition at line 117 of file LTC6813.cpp.

## ◆ LTC6813_rdcomm()

int8_t LTC6813_rdcomm | ( | uint8_t | total_ic,
|  | cell_asic * | ic
| ) |  |

Reads comm registers of a LTC6813 daisy chain.

Returns
  int8_t, pec_error PEC Status. 0: Data read back has matching PEC -1: Data read back has incorrect PEC

Parameters

  total_ic | Number of ICs in the daisy chain
  ic | Two dimensional array that the function stores the read comm data.

Definition at line 594 of file LTC6813.cpp.

## ◆ LTC6813_rdcv()

uint8_t LTC6813_rdcv | ( | uint8_t | reg,
|  | uint8_t | total_ic,
|  | cell_asic * | ic
| ) |  |

Reads and parses the LTC6813 cell voltage registers.

Returns
  uint8_t, pec_error PEC Status. 0: No PEC error detected -1: PEC error detected, retry read

Parameters

  reg | Controls which cell voltage register is read back.
  total_ic | The number of ICs in the daisy chain
  ic | Array of the parsed cell codes from lowest to highest.

Definition at line 168 of file LTC6813.cpp.

## ◆ LTC6813_rdpsb()

uint8_t LTC6813_rdpsb | ( | uint8_t | total_ic,
|  | cell_asic * | ic
| ) |  |

Reading pwm/s control register B.

Returns
  uint8_t, pec_error PEC Status. 0: Data read back has matching PEC -1: Data read back has incorrect PEC

Parameters

  total_ic | Number of ICs in the daisy chain
  ic | A two dimensional array that the function stores the read data

Definition at line 533 of file LTC6813.cpp.

## ◆ LTC6813_rdpwm()

int8_t LTC6813_rdpwm | ( | uint8_t | total_ic,
|  | uint8_t | pwmReg,
|  | cell_asic * | ic
| ) |  |

Reads pwm registers of a LTC6813 daisy chain.

Returns
  int8_t, pec_error PEC Status. 0: Data read back has matching PEC -1: Data read back has incorrect PEC

Parameters

  total_ic | Number of ICs in the daisy chain
  pwmReg | PWM Register A or B
  ic | A two dimensional array that will store the data

Definition at line 459 of file LTC6813.cpp.

## ◆ LTC6813_rdsctrl()

int8_t LTC6813_rdsctrl | ( | uint8_t | nIC,
|  | uint8_t | sctrl_reg,
|  | cell_asic * | ic
| ) |  |

Reads sctrl registers of a LTC6813 daisy chain.

Returns
  int8_t, pec_error PEC Status. 0: Data read back has matching PEC -1: Data read back has incorrect PEC

Parameters

  nIC | Number of ICs in the daisy chain
  sctrl_reg | SCTRL Register A or B
  ic | A two dimensional array that will store the data

Definition at line 479 of file LTC6813.cpp.

## ◆ LTC6813_rdstat()

int8_t LTC6813_rdstat | ( | uint8_t | reg,
|  | uint8_t | total_ic,
|  | cell_asic * | ic
| ) |  |

Reads and parses the LTC6813 stat registers.

Returns
  int8_t, pec_error PEC Status 0: No PEC error detected -1: PEC error detected, retry read

Parameters

  reg | Determines which Stat register is read back.
  total_ic | Number of ICs in the system
  ic | A two dimensional array that will store the data

Definition at line 199 of file LTC6813.cpp.

## ◆ LTC6813_reset_crc_count()

void LTC6813_reset_crc_count | ( | uint8_t | total_ic,
|  | cell_asic * | ic
| ) |  |

Helper Function that resets the PEC error counters.

Returns
  void

Parameters

  total_ic | Number of ICs in the system
  ic | A two dimensional array that will store the data

Definition at line 639 of file LTC6813.cpp.

## ◆ LTC6813_run_adc_overlap()

uint16_t LTC6813_run_adc_overlap | ( | uint8_t | total_ic,
|  | cell_asic * | ic
| ) |  |

Helper Function that runs the ADC Overlap test.

Returns
  uint16_t, error 0: Pass -1: False, Error detected

Parameters

  total_ic | Number of ICs in the system
  ic | A two dimensional array that will store the data

Definition at line 319 of file LTC6813.cpp.

## ◆ LTC6813_run_adc_redundancy_st()

int16_t LTC6813_run_adc_redundancy_st | ( | uint8_t | adc_mode,
|  | uint8_t | adc_reg,
|  | uint8_t | total_ic,
|  | cell_asic * | ic
| ) |  |

Helper function that runs the ADC Digital Redundancy commands and checks output for errors.

Returns
  int16_t, error Number of errors detected.

Parameters

  adc_mode | ADC Mode
  adc_reg | Type of register
  total_ic | Number of ICs in the system
  ic | A two dimensional array that will store the data

Definition at line 353 of file LTC6813.cpp.

## ◆ LTC6813_run_cell_adc_st()

int16_t LTC6813_run_cell_adc_st | ( | uint8_t | adc_reg,
|  | uint8_t | total_ic,
|  | cell_asic * | ic,
|  | uint8_t | md,
|  | bool | adcopt
| ) |  |

Helper function that runs the ADC Self Tests.

Returns
  int16_t, error Number of errors detected.

Parameters

  adc_reg | Type of register
  total_ic | Number of ICs in the system
  ic | A two dimensional array that will store the data
  md | ADC Mode
  adcopt | The adcopt bit in the configuration register

Definition at line 306 of file LTC6813.cpp.

## ◆ LTC6813_run_gpio_openwire()

void LTC6813_run_gpio_openwire | ( | uint8_t | total_ic,
|  | cell_asic * | ic
| ) |  |

Runs open wire for GPIOs.

Returns
  void

Parameters

  total_ic | Number of ICs in the system
  ic | A two dimensional array that will store the data

Definition at line 399 of file LTC6813.cpp.

## ◆ LTC6813_run_openwire_multi()

void LTC6813_run_openwire_multi | ( | uint8_t | total_ic,
|  | cell_asic * | ic
| ) |  |

Helper function that runs open wire for multiple cell and two consecutive cells detection.

Returns
  void

Parameters

  total_ic | Number of ICs in the system
  ic | A two dimensional array that will store the data

Definition at line 391 of file LTC6813.cpp.

## ◆ LTC6813_run_openwire_single()

void LTC6813_run_openwire_single | ( | uint8_t | total_ic,
|  | cell_asic * | ic
| ) |  |

Helper function that runs the data sheet algorithm for open wire for single cell detection.

Returns
  void

Parameters

  total_ic | Number of ICs in the system
  ic | A two dimensional array that will store the data

Definition at line 383 of file LTC6813.cpp.

## ◆ LTC6813_set_cfgr()

void LTC6813_set_cfgr | ( | uint8_t | nIC,
|  | cell_asic * | ic,
|  | bool | refon,
|  | bool | adcopt,
|  | bool | gpio[5],
|  | bool | dcc[12],
|  | bool | dcto[4],
|  | uint16_t | uv,
|  | uint16_t | ov
| ) |  |

Helper function to set appropriate bits in CFGR register based on bit function.

Returns
  void

Parameters

  nIC | The number of ICs in the daisy chain
  ic | A two dimensional array that will store the data
  refon | The REFON bit
  adcopt | The ADCOPT bit
  gpio | The GPIO bits
  dcc | The DCC bits
  dcto | The Dcto bits
  uv | The UV value
  ov | The OV value

Definition at line 653 of file LTC6813.cpp.

## ◆ LTC6813_set_cfgr_adcopt()

void LTC6813_set_cfgr_adcopt | ( | uint8_t | nIC,
|  | cell_asic * | ic,
|  | bool | adcopt
| ) |  |

Helper function to turn the ADCOPT bit HIGH or LOW.

Returns
  void

Parameters

  nIC | The number of ICs in the daisy chain
  ic | A two dimensional array that will store the data
  adcopt | The ADCOPT bit

Definition at line 671 of file LTC6813.cpp.

## ◆ LTC6813_set_cfgr_dcto()

void LTC6813_set_cfgr_dcto | ( | uint8_t | nIC,
|  | cell_asic * | ic,
|  | bool | dcto[4]
| ) |  |

Helper function to set DCTO field in CFGRA register.

Returns
  void

Parameters

  nIC | The number of ICs in the daisy chain
  ic | A two dimensional array that will store the data
  dcto | The Dcto bits

Definition at line 695 of file LTC6813.cpp.

## ◆ LTC6813_set_cfgr_dis()

void LTC6813_set_cfgr_dis | ( | uint8_t | nIC,
|  | cell_asic * | ic,
|  | bool | dcc[]
| ) |  |

Helper function to turn the DCC bits HIGH or LOW.

Returns
  void

Parameters

  nIC | The number of ICs in the daisy chain
  ic | A two dimensional array that will store the data
  dcc | The DCC bits

## ◆ LTC6813_set_cfgr_gpio()

void LTC6813_set_cfgr_gpio | ( | uint8_t | nIC,
|  | cell_asic * | ic,
|  | bool | gpio[]
| ) |  |

Helper function to turn the GPIO bits HIGH or LOW.

Returns
  void

Parameters

  nIC | The number of ICs in the daisy chain
  ic | A two dimensional array that will store the data
  gpio | The GPIO bits

## ◆ LTC6813_set_cfgr_ov()

void LTC6813_set_cfgr_ov | ( | uint8_t | nIC,
|  | cell_asic * | ic,
|  | uint16_t | ov
| ) |  |

Helper function to set OV field in CFGRA register.

Returns
  void

Parameters

  nIC | The number of ICs in the daisy chain
  ic | A two dimensional array that will store the data
  ov | The OV value

Definition at line 701 of file LTC6813.cpp.

## ◆ LTC6813_set_cfgr_refon()

void LTC6813_set_cfgr_refon | ( | uint8_t | nIC,
|  | cell_asic * | ic,
|  | bool | refon
| ) |  |

Helper function to turn the REFON bit HIGH or LOW.

Returns
  void

Parameters

  nIC | The number of ICs in the daisy chain
  ic | A two dimensional array that will store the data
  refon | The REFON bit

Definition at line 665 of file LTC6813.cpp.

## ◆ LTC6813_set_cfgr_uv()

void LTC6813_set_cfgr_uv | ( | uint8_t | nIC,
|  | cell_asic * | ic,
|  | uint16_t | uv
| ) |  |

Helper function to set UV field in CFGRA register.

Returns
  void

Parameters

  nIC | The number of ICs in the daisy chain
  ic | A two dimensional array that will store the data
  uv | The UV value

Definition at line 689 of file LTC6813.cpp.

## ◆ LTC6813_set_cfgrb()

void LTC6813_set_cfgrb | ( | uint8_t | nIC,
|  | cell_asic * | ic,
|  | bool | fdrf,
|  | bool | dtmen,
|  | bool | ps[2],
|  | bool | gpiobits[4],
|  | bool | dccbits[7]
| ) |  |

Helper function to set appropriate bits in CFGR register based on bit function.

Returns
  void

Parameters

  nIC | The number of ICs in the daisy chain
  ic | A two dimensional array that will store the data
  fdrf | The FDRF bit
  dtmen | The DTMEN bit
  ps | Path selection bits
  gpiobits | The GPIO bits
  dccbits | The DCC bits

Definition at line 719 of file LTC6813.cpp.

## ◆ LTC6813_set_cfgrb_dcc_b()

void LTC6813_set_cfgrb_dcc_b | ( | uint8_t | nIC,
|  | cell_asic * | ic,
|  | bool | dccbits[]
| ) |  |

Helper function to turn the DCC bit HIGH or LOW.

Returns
  void

Parameters

  nIC | The number of ICs in The daisy chain
  ic | A two dimensional array that will store The data
  dccbits | The DCC bits

Definition at line 763 of file LTC6813.cpp.

## ◆ LTC6813_set_cfgrb_dtmen()

void LTC6813_set_cfgrb_dtmen | ( | uint8_t | nIC,
|  | cell_asic * | ic,
|  | bool | dtmen
| ) |  |

Helper function to turn the DTMEN bit HIGH or LOW.

Returns
  void

Parameters

  nIC | The number of ICs in the daisy chain
  ic | A two dimensional array that will store the data
  dtmen | The DTMEN bit

Definition at line 736 of file LTC6813.cpp.

## ◆ LTC6813_set_cfgrb_fdrf()

void LTC6813_set_cfgrb_fdrf | ( | uint8_t | nIC,
|  | cell_asic * | ic,
|  | bool | fdrf
| ) |  |

Helper function to turn the FDRF bit HIGH or LOW.

Returns
  void

Parameters

  nIC | The number of ICs in the daisy chain
  ic | A two dimensional array that will store the data
  fdrf | The FDRF bit

Definition at line 729 of file LTC6813.cpp.

## ◆ LTC6813_set_cfgrb_gpio_b()

void LTC6813_set_cfgrb_gpio_b | ( | uint8_t | nIC,
|  | cell_asic * | ic,
|  | bool | gpiobits[]
| ) |  |

Helper function to turn the GPIO bit HIGH or LOW.

Returns
  void

Parameters

  nIC | The number of ICs in the daisy chain
  ic | A two dimensional array that will store the data
  gpiobits | The GPIO bits

Definition at line 753 of file LTC6813.cpp.

## ◆ LTC6813_set_cfgrb_ps()

void LTC6813_set_cfgrb_ps | ( | uint8_t | nIC,
|  | cell_asic * | ic,
|  | bool | ps[]
| ) |  |

Helper function to turn the Path Select bit HIGH or LOW.

Returns
  void

Parameters

  nIC | The number of ICs in the daisy chain
  ic | A two dimensional array that will store the data
  ps | Path selection bits

Definition at line 743 of file LTC6813.cpp.

## ◆ LTC6813_set_discharge()

void LTC6813_set_discharge | ( | int | Cell,
|  | uint8_t | total_ic,
|  | cell_asic * | ic
| ) |  |

Helper Function to Set DCC bits in the CFGR Registers.

Returns
  void

Parameters

  Cell | The cell to be discharged
  total_ic | Number of ICs in the system
  ic | A two dimensional array that will store the data

Definition at line 407 of file LTC6813.cpp.

## ◆ LTC6813_statst()

void LTC6813_statst | ( | uint8_t | MD,
|  | uint8_t | ST
| ) |  |

Start a Status Register Self Test Conversion.

Returns
  void

Parameters

  MD | ADC Conversion Mode
  ST | Sets if self test 1 or 2 is run

Definition at line 274 of file LTC6813.cpp.

## ◆ LTC6813_stcomm()

void LTC6813_stcomm | ( | uint8_t | len | ) |

Issues a stcomm command and clocks data out of the COMM register.

Returns
  void

Parameters

  len | Length of data to be transmitted

Definition at line 604 of file LTC6813.cpp.

## ◆ LTC6813_stsctrl()

void LTC6813_stsctrl | ( |  | ) |

Start Sctrl data communication This command will start the sctrl pulse communication over the spins.

Returns
  void

Definition at line 491 of file LTC6813.cpp.

## ◆ LTC6813_unmute()

void LTC6813_unmute | ( |  | ) |

Clears the LTC6813 Mute Discharge.

Returns
  void

Definition at line 620 of file LTC6813.cpp.

## ◆ LTC6813_wrcfg()

void LTC6813_wrcfg | ( | uint8_t | total_ic,
|  | cell_asic * | ic
| ) |  |

Write the LTC6813 configuration register A.

Returns
  void

Parameters

  total_ic | Number of ICs in the system
  ic | A two dimensional array of the configuration data that will be written

Definition at line 87 of file LTC6813.cpp.

## ◆ LTC6813_wrcfgb()

void LTC6813_wrcfgb | ( | uint8_t | total_ic,
|  | cell_asic * | ic
| ) |  |

Write the LTC6813 configuration register B.

Returns
  void

Parameters

  total_ic | Number of ICs in the system
  ic | A two dimensional array of the configuration data that will be written

Definition at line 99 of file LTC6813.cpp.

## ◆ LTC6813_wrcomm()

void LTC6813_wrcomm | ( | uint8_t | total_ic,
|  | cell_asic * | ic
| ) |  |

Write the LTC6813 COMM register.

Returns
  void

Parameters

  total_ic | Number of ICs in the daisy chain
  ic | A two dimensional array of the comm data that will be written

Definition at line 586 of file LTC6813.cpp.

## ◆ LTC6813_wrpsb()

void LTC6813_wrpsb | ( | uint8_t | total_ic,
|  | cell_asic * | ic
| ) |  |

Write the 6813 PWM/Sctrl Register B.

Returns
  void

Parameters

  total_ic | Number of ICs in the system
  ic | A two dimensional array that will store the data

Definition at line 507 of file LTC6813.cpp.

## ◆ LTC6813_wrpwm()

void LTC6813_wrpwm | ( | uint8_t | total_ic,
|  | uint8_t | pwmReg,
|  | cell_asic * | ic
| ) |  |

Write the LTC6813 PWM register.

Returns
  void

Parameters

  total_ic | Number of ICs in the daisy chain
  pwmReg | PWM Register A or B
  ic | A two dimensional array that will store the data

Definition at line 450 of file LTC6813.cpp.

## ◆ LTC6813_wrsctrl()

void LTC6813_wrsctrl | ( | uint8_t | nIC,
|  | uint8_t | sctrl_reg,
|  | cell_asic * | ic
| ) |  |

Write the LTC6813 Sctrl register.

Returns
  void

Parameters

  nIC | Number of ICs in the daisy chain
  ic | SCTRL Register A or B A two dimensional array that will store the data

Definition at line 470 of file LTC6813.cpp.

## Macro Definition Documentation

## ◆ AUX

#define AUX 2

Definition at line 64 of file LTC6813.h.

## ◆ CELL

#define CELL 1

Definition at line 63 of file LTC6813.h.

## ◆ STAT

#define STAT 3

Definition at line 65 of file LTC6813.h.