AN370
Rev. 1.0
45
vDmdTs_Enable
Description
: Controls the enabling and disabling of the temperature sensor digital demod-
ulator (DMD) and the temperature sensor analog block (TS).
Inputs
:
biDmdTsSetEnable: (BYTE) Bit 6 enables the digital demodulator (DMD) when
set. Bit 7 enables the temperature sensor (TS) analog hardware when set. All other
bits are unused. It is recommended to keep them as 0.
Outputs
:
None
vDmdTs_RunForTemp
Description
: Sets up the demodulator and temperature sensor module for running in tem-
perature mode. It is a wrapper around the multistep setup procedure to get the TS and
DMD running in temperature mode.
This is the recommended function for the user to set up, enable and run the temperature
measurement. This function needs to be run only once to enable the TS and DMD.
It calls vDmdTs_Setup() and vDmdTs_Enable() function. It clears and sets up the demod-
ulator and temperature sensor from scratch.
The application using this function must include the DMD ISR in order for the application
to work properly. Once vDmdTs_RunForTemp() has been run, the user can simply wait
for a valid temperature sample and then retrieve it as shown in the following code:
/* Setup the DMD temperature sensor for temperature mode */
vDmdTs_RunForTemp( 3 ); /* Skip first 3 samples */
/* Wait until there is a valid DMD temp sensor sample */
while ( 0 == bDmdTs_GetSamplesTaken() ) {}
/* Retrieve the temperature sample in internal units */
iCurrentTemp = iDmdTs_GetLatestTemp();