DC2100A  1.2.0
Bi-Directional Cell Balancer Using the LTC3300-1 and the LTC6804-2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages

Reference Application File for Controlling the LTC3300-1 Battery Balancers through the LTC6804-2 Battery Monitor on the DC2100A PCB. More...

Go to the source code of this file.

Detailed Description

Reference Application File for Controlling the LTC3300-1 Battery Balancers through the LTC6804-2 Battery Monitor on the DC2100A PCB.

Definition in file Balancer.c.

Functions

void balancer_command_update (int8 board_num)
 
void balancer_nextstop_update (int8 board_num, int16 bal_timer)
 
void balancer_max_and_nextstop_update (int8 board_num, BALANCER_ACTIVE_STATE_TYPE balancer_state)
 
void balancer_status_update (int8 board_num)
 
void Balancer_Init (void)
 Initializes the parts of the Balancer Module, that need to be initialized upon power-up of the PIC. More...
 
BOOLEAN Balancer_Wakeup_Init (void)
 Initializes the parts of the Balancer Module, that need to be initialized upon wakeup of the LTC3300-1. More...
 
void Balancer_Control_Task (void)
 Executes the Balancer Control task. More...
 
void Balancer_Set (void)
 Places Balancer Control Task in the BALANCER_CONTROL_SETUP state. More...
 
void Balancer_Set (int8 board_num, BALANCER_ACTIVE_STATE_TYPE *cell_state_ptr)
 
void Balancer_Set (BALANCER_DELTA_Q_TYPE *charge_target_ptr)
 Places Balancer Control Task in the BALANCER_CONTROL_SETUP state. More...
 
void Balancer_Start (void)
 Places Balancer Control Task in the BALANCER_CONTROL_ON state. More...
 
void Balancer_Stop (void)
 Places Balancer Control Task in the BALANCER_CONTROL_OFF state immediately, as it's possible there's a catastrophic reason why we need to suspend,and resets the Balancer Control Task. More...
 
void Balancer_Suspend (void)
 Places Balancer Control Task in the BALANCER_CONTROL_SUSPEND state immediately as it's possible there's a catastrophic reason why we need to suspend. More...
 
void Balancer_GUI (void)
 Places Balancer Control Task in the BALANCER_CONTROL_GUI state, stopping all control of balancers by Balancer Control Task, and allows full control of LTC3300 ICs through direct commands from GUI. More...
 
BOOLEAN Balancer_Is_Balancing (void)
 Returns if any balancer is actively balancing. More...
 
void Balancer_Synchronous_Mode_Set (BOOLEAN synchronous_mode)
 Sets Balancer Control Task for synchronous or asynchronous mode. More...
 
BOOLEAN Balancer_Synchronous_Mode_Get (void)
 Returns if Balancer Control Task is configured for synchronous mode. More...
 
void Balancer_Max_and_Nextstop_Find (void)
 Forces recalculation of the longest and shortest (yet non-zero) active balance times in the DC2100A system. More...
 

Macros

#define BALANCER_ALGORITHM_NUM_BOARDS   1
 
#define BALANCER_ALGORITHM_PASSES   10
 
#define BALANCER_TIME_RESOLUTION_SHIFT   2
 
#define BALANCER_TIME_RESOLUTION   (1L << BALANCER_TIME_RESOLUTION_SHIFT)
 
#define BALANCER_CHARGE_EFFICIENCY   92
 
#define BALANCER_DISCHARGE_EFFICIENCY   92
 
#define BALANCER_CELL_CHARGE_ERROR_DAMPING_SHIFT   1
 
#define BALANCER_CELL_CHARGE_ERROR_DAMPING   (1L << BALANCER_CELL_CHARGE_ERROR_DAMPING_SHIFT)
 
#define BALANCER_HALF_STACK_EEROR_DAMPING_SHIFT   1
 
#define BALANCER_HALF_STACK_EEROR_DAMPING   (1L << BALANCER_HALF_STACK_EEROR_DAMPING_SHIFT)
 

Variables

BALANCER_ACTIVE_STATE_TYPE Balancer_Active_State [DC2100A_MAX_BOARDS][DC2100A_NUM_CELLS]
 The state of each active cell balancer on each DC2100A in the system. More...
 
BALANCER_ACTIVE_STATE_TYPE Balancer_Active_Time_Max
 The longest active balance time in the DC2100A system. More...
 
BALANCER_ACTIVE_STATE_TYPE Balancer_Active_Time_Next_Stop
 The shortest, yet non-zero, active balance time in the DC2100A system. More...
 
int8 Balancer_Active_Board_Max
 The board with the longest remaining balance time. More...
 
int8 Balancer_Active_Board_Next_Stop
 The cell with the shortest, yet non-zero, remaining balance time. More...
 
BALANCER_PASSIVE_STATE_TYPE Balancer_Passive_State [DC2100A_MAX_BOARDS]
 Bitmap for LTC6804_NUM_CELLV_ADC passive balancers on one DC2100A, 1 = ON and 0 = Off, bit 0 = cell 0. More...
 
BALANCER_CONTROL_STATE_TYPE balancer_control_state
 
int8 balancer_watchdog_counter
 
BOOLEAN balancer_synchronous_mode
 
unsigned int16 balancer_gate_drive_ok [DC2100A_MAX_BOARDS]
 
unsigned int16 balancer_cells_ov_ok
 
unsigned int16 balancer_stack_ov_ok
 
unsigned int16 balancer_temperature_ok
 

Function Documentation

void Balancer_Control_Task ( void  )

Executes the Balancer Control task.

  • Sends watchdog commands to the LTC3300-1 ICs to keep them awake, unless in a state which allows the LTC3300-1 ICs to sleep.
  • If in the BALANCER_CONTROL_ON state, each active cell balancer command has its timer decremented while sending the appropriate commands to the LTC3300-1 ICs. The max and min (yet non-zero) balance times are tracked in this state.
  • Turns on/off the passive balancers.
    Returns
    void

Definition at line 168 of file Balancer.c.

void Balancer_GUI ( void  )

Places Balancer Control Task in the BALANCER_CONTROL_GUI state, stopping all control of balancers by Balancer Control Task, and allows full control of LTC3300 ICs through direct commands from GUI.

Returns
void

Definition at line 570 of file Balancer.c.

void Balancer_Init ( void  )

Initializes the parts of the Balancer Module, that need to be initialized upon power-up of the PIC.

Returns
void

Definition at line 120 of file Balancer.c.

BOOLEAN Balancer_Is_Balancing ( void  )

Returns if any balancer is actively balancing.

Returns
TRUE if any balancer is actively balancing.

Definition at line 576 of file Balancer.c.

void Balancer_Max_and_Nextstop_Find ( void  )

Forces recalculation of the longest and shortest (yet non-zero) active balance times in the DC2100A system.

Returns
void

Definition at line 604 of file Balancer.c.

void Balancer_Set ( void  )

Places Balancer Control Task in the BALANCER_CONTROL_SETUP state.

Does not change the active cell balancer states.

Returns
void

Definition at line 303 of file Balancer.c.

void Balancer_Set ( BALANCER_DELTA_Q_TYPE charge_target_ptr)

Places Balancer Control Task in the BALANCER_CONTROL_SETUP state.

Definition at line 331 of file Balancer.c.

void Balancer_Start ( void  )

Places Balancer Control Task in the BALANCER_CONTROL_ON state.

Note that balancing is not started until the next state execution, to ensure that the balance times are accurately controlled to the BALANCER_TASK_RATE resolution.

Returns
void

Definition at line 539 of file Balancer.c.

void Balancer_Stop ( void  )

Places Balancer Control Task in the BALANCER_CONTROL_OFF state immediately, as it's possible there's a catastrophic reason why we need to suspend,and resets the Balancer Control Task.

Returns
void

Definition at line 547 of file Balancer.c.

void Balancer_Suspend ( void  )

Places Balancer Control Task in the BALANCER_CONTROL_SUSPEND state immediately as it's possible there's a catastrophic reason why we need to suspend.

Returns
void

Definition at line 562 of file Balancer.c.

BOOLEAN Balancer_Synchronous_Mode_Get ( void  )

Returns if Balancer Control Task is configured for synchronous mode.

Returns
TRUE if Balancer Control Task is configured for synchronous mode.

Definition at line 598 of file Balancer.c.

void Balancer_Synchronous_Mode_Set ( BOOLEAN  synchronous_mode)

Sets Balancer Control Task for synchronous or asynchronous mode.

Returns
void
Parameters
synchronous_modeTRUE for synchronous mode, FALSE for asynchronous mode.

Definition at line 592 of file Balancer.c.

BOOLEAN Balancer_Wakeup_Init ( void  )

Initializes the parts of the Balancer Module, that need to be initialized upon wakeup of the LTC3300-1.

Returns
TRUE if initialization was successful.

Definition at line 143 of file Balancer.c.

Variable Documentation

int8 Balancer_Active_Board_Max

The board with the longest remaining balance time.

Definition at line 92 of file Balancer.c.

int8 Balancer_Active_Board_Next_Stop

The cell with the shortest, yet non-zero, remaining balance time.

Definition at line 93 of file Balancer.c.

BALANCER_ACTIVE_STATE_TYPE Balancer_Active_State[DC2100A_MAX_BOARDS][DC2100A_NUM_CELLS]

The state of each active cell balancer on each DC2100A in the system.

Definition at line 89 of file Balancer.c.

BALANCER_ACTIVE_STATE_TYPE Balancer_Active_Time_Max

The longest active balance time in the DC2100A system.

Definition at line 90 of file Balancer.c.

BALANCER_ACTIVE_STATE_TYPE Balancer_Active_Time_Next_Stop

The shortest, yet non-zero, active balance time in the DC2100A system.

Definition at line 91 of file Balancer.c.

BALANCER_PASSIVE_STATE_TYPE Balancer_Passive_State[DC2100A_MAX_BOARDS]

Bitmap for LTC6804_NUM_CELLV_ADC passive balancers on one DC2100A, 1 = ON and 0 = Off, bit 0 = cell 0.

Definition at line 94 of file Balancer.c.