Using Floating-Point
Adds the floating-point
RTS library(s) to the
CCS project
standard RTS lib
(required)
rts2800_fpu32.lib
comes with compiler
fast RTS lib (optional)
C28x_FPU_FastRTS.lib
on TI web, #SPRC664
improved performance
Strongly
Recommended
Selects ‘fpu32’ support
in CCS build
configuration settings
Set the “Specify floating point support” project option to ‘fpu32’
When creating a new CCS project, choosing a device variant that
has the FPU will automatically select this option, so normally no
user action is required
#define AdcFsVoltage float(3.3) // ADC full scale voltage
float Result; // ADC result
void main(void)
{
// Convert unsigned 16-bit result to 32-bit float. Gives value of 0 to 4095.
// Scale result by 1/4096. Gives value of 0 to ~1.
// Scale result by AdcFsVoltage. Gives value of 0 to ~3.3.
Result = (AdcFsVoltage/4096.0)*(float)AdcResult.ADCRESULT0;
}
Getting the ADC Result into
Floating-Point Format
AdcResult.
ADCRESULTx
x x x x
x x x
x
x x x x
0 0 0 0
32-bit float
15 031
f f f ff f f ff f f ff f f f
s e e e e
f f f
e e e e
f f f f
ASM:
I16TOF32
C:
(float)
Compiler will pre-compute at build-time.
No runtime division!