ARM Technical Support Knowledge Articles

SPRINTF CONVERTS FLOAT VARIABLES TO ZERO?

Applies to: C166 C Compiler

Answer


Information in this article applies to:


QUESTION

Whenever I try to format a Float variable using SPRINTF, the resulting string is zero. The values to be converted are within the floating-point limits. This only happens when I use my own startup code. What could be causing this?

ANSWER

You are not initializing the DPP1 and DPP2 registers in your startup code. Although your program does not use them, the C compiler requires that these registers are initialized during start up.

We strongly urge you to use the START167.A66 or START_V2.A66 file that we provide as the basis for your startup routines. The Keil startup code performs the following operations:

Your startup code must do all of these. If it doesn't, you may encounter run-time problems that are difficult to debug and diagnose.

MORE INFORMATION

Article last edited on: 2005-07-15 10:10:11

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential