Functions to meassure motor current and current draw sum. More...
#include <avr/io.h>#include "xtypes.h"#include "global.h"#include "adc.h"#include "safety.h"#include "current.h"
Go to the source code of this file.
Defines | |
| #define | EXPORT |
| #define | SUM_COUNT 20U |
| This value defines the array size of mg_au16Data and thus the span of time used to calculate the motor current sum. | |
| #define | AVG_COUNT 8U |
| This value defines the array size of mg_au16AvgData and thus the span of time used to calculate the average motor current. | |
Functions | |
| void | current_Init (void) |
| Init function of module current.c. | |
| void | current_Update (void) |
| Reads the motor current load. | |
| void | current_UpdateSum (void) |
| Updates the motor current load sum. | |
| void | current_UpdateAvg (void) |
| Updates the average motor current. | |
| UINT16 | current_GetAvg (void) |
| Returns the average motor current value. | |
| UINT16 | current_GetValue (void) |
| Returns the latest value for motor current. | |
| UINT16 | current_GetSum (void) |
| Returns the latest value for motor current sum. | |
Variables | |
| static UINT16 | mg_u16Value = 0U |
| UINT16 variable to store the latest current ADC value. | |
| static UINT16 | mg_au16Data [SUM_COUNT] |
| UINT16 variable to store the ADC values of motor current for accumulation. | |
| static UINT16 | mg_au16AvgData [AVG_COUNT] |
| UINT16 variable to store the ADC values of motor current for averaging. | |
| static UINT16 | mg_u16Sum = 0U |
| UINT16 variable to store the current sum. | |
| static UINT8 | mg_u8SumIdx = 0U |
| UINT8 index variable for array mg_au16Data. | |
| static UINT8 | mg_u8AvgIdx = 0U |
| UINT8 index variable for array mg_au16AvgData. | |
This module provides service-level functions to get the momentary motor current load, as well as the recent current sum.
Definition in file current.c.
1.7.2