EasyManua.ls Logo

Infineon SP37 - Code Example

Infineon SP37
135 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
SP37
Tire Pressure Monitoring Sensor
ROM Library Functions
ROM Library Function Guide 68 Revision 1.0, 2011-12-15
2.11.8 Code Example
Figure 9 Code example for usage of the functions Start_Supply_Voltage, Trig_Supply_Voltage and
Get_Supply_Voltage()
// Library function prototypes
#include "SP37_ROMLibrary.h"
void main()
{
// Return value of battery voltage measurement is stored in StatusByte
unsigned char StatusByte;
// struct for battery voltage measurement results
struct{
signed int Voltage;
signed int Raw_voltage;
} idata Volt_Result;
// ADC setup for supply voltage measurement is done before real time critical
// function is executed
Start_Supply_Voltage();
// real time critical function starts here
// ...
Trig_Supply_Voltage();
// ...
// end of real time critical function
// Get the measurement result after the real time critical function
StatusByte = Get_Supply_Voltage(&Volt_Result.Voltage);
if(!StatusByte){
// Battery voltage measurement was successful
}
else{
// Battery voltage measurement was not successful, underflow or
// overflow of ADC result occurred
}
}

Table of Contents