brazos-trapezoidal
Classes | Macros | Functions | Variables
SRMCAtod.c File Reference

This module treats analog conversions for motor control. More...

#include "uc.h"
#include "Compiler_defs.h"
#include "C_Extensions.h"
#include "SRMicro.h"
#include "SRMCAtod.h"
Include dependency graph for SRMCAtod.c:

Go to the source code of this file.

Classes

struct  ANALOG_REF_TYPE
 

Macros

#define US10   167U
 
#define FILTER_FC_HZ   212
 
#define FILTER_FS_HZ   1000
 
#define FILTER_TAU   (1/(2*3.1416*FILTER_FC_HZ))
 
#define FILTER_TS   (1.0f/FILTER_FS_HZ)
 

Functions

float SRCalcLPKT (float tau, float tc)
 
void SRMCAtod__Initialize (void)
 
void SRMCAtod__ISR (void)
 
void SRMCAtod__ISR2 (void)
 
void SRMCAtod__DiagnosticHandler (void)
 
void SRMCAtod__EnableDiagnostic (signed short int commanded_threshold)
 
SRMCATOD_DIAG_ERROR_TYPE SRMCAtod__GetDiagnosticFeedback (void)
 
void SRMCAtod__InitReadVref (void)
 It read the Vref voltage at the start up. More...
 
void SRMCAtod__Read_Vref (void)
 voltage reference reading, filtering and A/D conversion constants correction More...
 
float SRMCAtod__GetKRef (void)
 This function is used to get the ad correction related the VREF. More...
 

Variables

float SR_Off_Ulpkt
 current offsets filter time constant (1/x) More...
 
float SR_Vr_Ulpkt
 reference voltage filter time constant (1/x) More...
 
float NSR_Vr_Ulpkt
 
ANALOG_REF_TYPE SR_AdRef
 
ANALOG_REF_TYPE NSR_AdRef
 
volatile unsigned short ForcedCurrA
 

Detailed Description

This module treats analog conversions for motor control.

Analog conversions are triggered by MTU4 timer event in order minimize ringing noise. Trigger for all 3 currents and DC bus voltage occur at the same time


----------------— Copyright 2012. Whirlpool Corporation. All rights reserved - CONFIDENTIAL ------------------—

Definition in file SRMCAtod.c.

Macro Definition Documentation

◆ FILTER_FC_HZ

#define FILTER_FC_HZ   212

Definition at line 23 of file SRMCAtod.c.

◆ FILTER_FS_HZ

#define FILTER_FS_HZ   1000

Definition at line 24 of file SRMCAtod.c.

◆ FILTER_TAU

#define FILTER_TAU   (1/(2*3.1416*FILTER_FC_HZ))

Definition at line 25 of file SRMCAtod.c.

◆ FILTER_TS

#define FILTER_TS   (1.0f/FILTER_FS_HZ)

Definition at line 26 of file SRMCAtod.c.

◆ US10

#define US10   167U

Definition at line 21 of file SRMCAtod.c.

Function Documentation

◆ SRMCAtod__DiagnosticHandler()

void SRMCAtod__DiagnosticHandler ( void  )

This function is a handler used to check 12 bits AD registers and converters status. May be used to test stuck at register failure and conversion errors. Checks all converters with all possible fixed values. this handler has no time dependency, may be used on handlers at 16KHz, 250us, 1ms 5ms or 25ms. Use functions to start tests and get feedbacks

Definition at line 162 of file SRMCAtod.c.

◆ SRMCAtod__EnableDiagnostic()

void SRMCAtod__EnableDiagnostic ( signed short int  commanded_threshold)

This function is a handler used to start checking 12 bits AD registers and converters status. Only restarts if feedback was updated or it's waiting for a check request.

Definition at line 171 of file SRMCAtod.c.

◆ SRMCAtod__GetDiagnosticFeedback()

SRMCATOD_DIAG_ERROR_TYPE SRMCAtod__GetDiagnosticFeedback ( void  )

This function gets converters status.

Returns
returns if all converters tests result: TEST_NOT_PERFORMED, TEST_NOT_INITIALIZED, REGISTER_BIT_STUCK_AT_0, REGISTER_BIT_STUCK_AT_1, CONVERTER_ERROR or PERIPHERAL_SAFE

Definition at line 181 of file SRMCAtod.c.

◆ SRMCAtod__GetKRef()

float SRMCAtod__GetKRef ( void  )

This function is used to get the ad correction related the VREF.

Returns

Definition at line 280 of file SRMCAtod.c.

◆ SRMCAtod__Initialize()

void SRMCAtod__Initialize ( void  )

It Initializes the module MCAtod peripheral and its variables. All 12 bits channels are converted when MTU4 TADCORB register matches with TCNT.

Definition at line 67 of file SRMCAtod.c.

◆ SRMCAtod__InitReadVref()

void SRMCAtod__InitReadVref ( void  )

It read the Vref voltage at the start up.

Definition at line 258 of file SRMCAtod.c.

◆ SRMCAtod__ISR()

void SRMCAtod__ISR ( void  )

Definition at line 76 of file SRMCAtod.c.

◆ SRMCAtod__ISR2()

void SRMCAtod__ISR2 ( void  )

Definition at line 120 of file SRMCAtod.c.

◆ SRMCAtod__Read_Vref()

void SRMCAtod__Read_Vref ( void  )

voltage reference reading, filtering and A/D conversion constants correction

Definition at line 269 of file SRMCAtod.c.

Variable Documentation

◆ ForcedCurrA

volatile unsigned short ForcedCurrA

End of engine 0 conversion. This is supposed to be simultaneous to the end of engine 1, since they are triggered together.

Definition at line 75 of file SRMCAtod.c.

◆ NSR_AdRef

ANALOG_REF_TYPE NSR_AdRef

Definition at line 42 of file SRMCAtod.c.

◆ NSR_Vr_Ulpkt

float NSR_Vr_Ulpkt

Definition at line 40 of file SRMCAtod.c.

◆ SR_AdRef

ANALOG_REF_TYPE SR_AdRef

Definition at line 42 of file SRMCAtod.c.

◆ SR_Off_Ulpkt

float SR_Off_Ulpkt

current offsets filter time constant (1/x)

Definition at line 38 of file SRMCAtod.c.

◆ SR_Vr_Ulpkt

float SR_Vr_Ulpkt

reference voltage filter time constant (1/x)

Definition at line 40 of file SRMCAtod.c.