17.02.2015 Views

CCS C Compiler Manual PCB / PCM / PCH

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Built-in Functions<br />

Parameters:<br />

String is a constant string or an array of characters null terminated.<br />

Values is a list of variables separated by commas, fname is a function name to<br />

be used for outputting (default is putc is none is specified.<br />

Stream is a stream identifier (a constant byte). Note that format specifies do<br />

not work in ram band strings.<br />

Returns:<br />

Function:<br />

undefined<br />

Outputs a string of characters to either the standard RS-232 pins (first two<br />

forms) or to a specified function. Formatting is in accordance with the string<br />

argument. When variables are used this string must be a constant. The %<br />

character is used within the string to indicate a variable value is to be formatted<br />

and output. Longs in the printf may be 16 or 32 bit. A %% will output a single<br />

%. Formatting rules for the % follows.<br />

See the Expressions > Constants and Trigraph sections of this manual for<br />

other escape character that may be part of the string.<br />

If fprintf() is used then the specified stream is used where printf() defaults to<br />

STDOUT (the last USE RS232).<br />

Format:<br />

The format takes the generic form %nt. n is optional and may be 1-9 to specify<br />

how many characters are to be outputted, or 01-09 to indicate leading zeros, or<br />

1.1 to 9.9 for floating point and %w output. t is the type and may be one of the<br />

following:<br />

c Character<br />

s String or character<br />

u Unsigned int<br />

d Signed int<br />

Lu Long unsigned int<br />

Ld Long signed int<br />

x Hex int (lower case)<br />

X Hex int (upper case)<br />

Lx Hex long int (lower case)<br />

LX Hex long int (upper case)<br />

f Float with truncated decimal<br />

g Float with rounded decimal<br />

e<br />

w<br />

Float in exponential format<br />

Unsigned int with decimal place inserted.<br />

Specify two numbers for n. The first is a<br />

total field width. The second is the desired<br />

number of decimal places.<br />

Example formats:<br />

Specifier Value=0x12 Value=0xfe<br />

%03u 018 254<br />

%u 18 254<br />

233

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!