Code Example - Infineon SP37 Function Manual

High integrated single-chip tpms sensor with a low power embedded microcontroller and wireless fsk/ask uhf transmitter
Table of Contents

Advertisement

2.11.8

Code Example

// 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
}
}
Figure 9
Code example for usage of the functions Start_Supply_Voltage, Trig_Supply_Voltage and
Get_Supply_Voltage()
ROM Library Function Guide
Tire Pressure Monitoring Sensor
68
SP37
ROM Library Functions
Revision 1.0, 2011-12-15

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents