JavaScript is disabled on your browser. Please enable JavaScript to enjoy all the features of this site.
AVR Libc Reference Manual
macros for printf and scanf format specifiers
Sidebar
Prev
|
Up
|
Next
Macro SCNu32
#define SCNu32 "lu"
decimal scanf format for uint32_t
Contents
Search
Documentation Home
AVR Libc Reference Manual
AVR Libc
Introduction
General information about this library
Supported Devices
avr-libc License
Toolchain Overview
Introduction
FSF and GNU
GCC
GNU Binutils
avr-libc
Building Software
AVRDUDE
GDB / Insight / DDD
AVaRICE
SimulAVR
Utilities
Toolchain Distributions (Distros)
Open Source
Memory Areas and Using malloc()
Introduction
Internal vs. external RAM
Tunables for malloc()
Implementation details
Memory Sections
The .text Section
The .data Section
The .bss Section
The .eeprom Section
The .noinit Section
The .initN Sections
The .finiN Sections
Using Sections in Assembler Code
Using Sections in C Code
Data in Program Space
Introduction
A Note On const
Storing and Retrieving Data in the Program Space
Storing and Retrieving Strings in the Program Space
Caveats
avr-libc and assembler programs
Introduction
Invoking the compiler
Example program
Pseudo-ops and operators
Inline Assembler Cookbook
GCC asm Statement
Assembler Code
Input and Output Operands
Clobbers
Assembler Macros
C Stub Functions
C Names Used in Assembler Code
Links
How to Build a Library
Introduction
How the Linker Works
How to Design a Library
Creating a Library
Using a Library
Benchmarks
A few of libc functions.
Math functions.
Porting From IAR to AVR GCC
Introduction
Registers
Interrupt Service Routines (ISRs)
Intrinsic Routines
Flash Variables
Non-Returning main()
Locking Registers
Frequently Asked Questions
FAQ Index
My program doesn't recognize a variable updated within an interrupt routine
I get "undefined reference to..." for functions like "sin()"
How to permanently bind a variable to a register?
How to modify MCUCR or WDTCR early?
What is all this _BV() stuff about?
Can I use C++ on the AVR?
Shouldn't I initialize all my variables?
Why do some 16-bit timer registers sometimes get trashed?
How do I use a #define'd constant in an asm statement?
Why does the PC randomly jump around when single-stepping through my program in avr-gdb?
How do I trace an assembler file in avr-gdb?
How do I pass an IO port as a parameter to a function?
What registers are used by the C compiler?
How do I put an array of strings completely in ROM?
How to use external RAM?
Which -O flag to use?
How do I relocate code to a fixed address?
My UART is generating nonsense! My ATmega128 keeps crashing! Port F is completely broken!
Why do all my "foo...bar" strings eat up the SRAM?
Why does the compiler compile an 8-bit operation that uses bitwise operators into a 16-bit operation in assembly?
How to detect RAM memory and variable overlap problems?
Is it really impossible to program the ATtinyXX in C?
What is this "clock skew detected" message?
Why are (many) interrupt flags cleared by writing a logical 1?
Why have "programmed" fuses the bit value 0?
Which AVR-specific assembler operators are available?
Why are interrupts re-enabled in the middle of writing the stack pointer?
Why are there five different linker scripts?
How to add a raw binary image to linker output?
How do I perform a software reset of the AVR?
I am using floating point math. Why is the compiled code so big? Why does my code not work?
What pitfalls exist when writing reentrant code?
Why are some addresses of the EEPROM corrupted (usually address zero)?
Why is my baud rate wrong?
On a device with more than 128 KiB of flash, how to make function pointers work?
Why is assigning ports in a "chain" a bad idea?
Building and Installing the GNU Tool Chain
Building and Installing under Linux, FreeBSD, and Others
Required Tools
Optional Tools
GNU Binutils for the AVR target
GCC for the AVR target
AVR LibC
AVRDUDE
GDB for the AVR target
SimulAVR
AVaRICE
Building and Installing under Windows
Tools Required for Building the Toolchain for Windows
Building the Toolchain for Windows
Using the GNU tools
Options for the C compiler avr-gcc
Machine-specific options for the AVR
Selected general compiler options
Options for the assembler avr-as
Machine-specific assembler options
Examples for assembler options passed through the C compiler
Controlling the linker avr-ld
Selected linker options
Passing linker options from the C compiler
Compiler optimization
Problems with reordering code
Using the avrdude program
Release Numbering and Methodology
Release Version Numbering Scheme
Releasing AVR Libc
Creating an SVN branch
Making a release
Acknowledgments
Todo List
Deprecated List
Modules
<alloca.h>: Allocate space in the stack
Function alloca()
<assert.h>: Diagnostics
Macro assert
<ctype.h>: Character Operations
Character classification routines
Function isalnum()
Function isalpha()
Function isascii()
Function isblank()
Function iscntrl()
Function isdigit()
Function isgraph()
Function islower()
Function isprint()
Function ispunct()
Function isspace()
Function isupper()
Function isxdigit()
Character convertion routines
Function toascii()
Function tolower()
Function toupper()
<errno.h>: System Errors
Macro EDOM
Macro ERANGE
<inttypes.h>: Integer Type conversions
Far pointers for memory access >64K
Type int_farptr_t
Type uint_farptr_t
macros for printf and scanf format specifiers
Macro PRId8
Macro PRIdLEAST8
Macro PRIdFAST8
Macro PRIi8
Macro PRIiLEAST8
Macro PRIiFAST8
Macro PRId16
Macro PRIdLEAST16
Macro PRIdFAST16
Macro PRIi16
Macro PRIiLEAST16
Macro PRIiFAST16
Macro PRId32
Macro PRIdLEAST32
Macro PRIdFAST32
Macro PRIi32
Macro PRIiLEAST32
Macro PRIiFAST32
Macro PRIdPTR
Macro PRIiPTR
Macro PRIo8
Macro PRIoLEAST8
Macro PRIoFAST8
Macro PRIu8
Macro PRIuLEAST8
Macro PRIuFAST8
Macro PRIx8
Macro PRIxLEAST8
Macro PRIxFAST8
Macro PRIX8
Macro PRIXLEAST8
Macro PRIXFAST8
Macro PRIo16
Macro PRIoLEAST16
Macro PRIoFAST16
Macro PRIu16
Macro PRIuLEAST16
Macro PRIuFAST16
Macro PRIx16
Macro PRIxLEAST16
Macro PRIxFAST16
Macro PRIX16
Macro PRIXLEAST16
Macro PRIXFAST16
Macro PRIo32
Macro PRIoLEAST32
Macro PRIoFAST32
Macro PRIu32
Macro PRIuLEAST32
Macro PRIuFAST32
Macro PRIx32
Macro PRIxLEAST32
Macro PRIxFAST32
Macro PRIX32
Macro PRIXLEAST32
Macro PRIXFAST32
Macro PRIoPTR
Macro PRIuPTR
Macro PRIxPTR
Macro PRIXPTR
Macro SCNd16
Macro SCNdLEAST16
Macro SCNdFAST16
Macro SCNi16
Macro SCNiLEAST16
Macro SCNiFAST16
Macro SCNd32
Macro SCNdLEAST32
Macro SCNdFAST32
Macro SCNi32
Macro SCNiLEAST32
Macro SCNiFAST32
Macro SCNdPTR
Macro SCNiPTR
Macro SCNo16
Macro SCNoLEAST16
Macro SCNoFAST16
Macro SCNu16
Macro SCNuLEAST16
Macro SCNuFAST16
Macro SCNx16
Macro SCNxLEAST16
Macro SCNxFAST16
Macro SCNo32
Macro SCNoLEAST32
Macro SCNoFAST32
Macro SCNu32
Macro SCNuLEAST32
Macro SCNuFAST32
Macro SCNx32
Macro SCNxLEAST32
Macro SCNxFAST32
Macro SCNoPTR
Macro SCNuPTR
Macro SCNxPTR
<math.h>: Mathematics
Function cos()
Function sin()
Function tan()
Function fabs()
Function fmod()
Function modf()
Function modff()
Function sqrt()
Function cbrt()
Function hypot()
Function square()
Function floor()
Function ceil()
Function frexp()
Function ldexp()
Function exp()
Function cosh()
Function sinh()
Function tanh()
Function acos()
Function asin()
Function atan()
Function atan2()
Function log()
Function log10()
Function pow()
Function isnan()
Function isinf()
Function isfinite()
Function copysign()
Function signbit()
Function fdim()
Function fma()
Function fmax()
Function fmin()
Function trunc()
Function round()
Function lround()
Function lrint()
Macro M_E
Macro M_LOG2E
Macro M_LOG10E
Macro M_LN2
Macro M_LN10
Macro M_PI
Macro M_PI_2
Macro M_PI_4
Macro M_1_PI
Macro M_2_PI
Macro M_2_SQRTPI
Macro M_SQRT2
Macro M_SQRT1_2
Macro NAN
Macro INFINITY
Macro cosf
Macro sinf
Macro tanf
Macro fabsf
Macro fmodf
Macro sqrtf
Macro cbrtf
Macro hypotf
Macro squaref
Macro floorf
Macro ceilf
Macro frexpf
Macro ldexpf
Macro expf
Macro coshf
Macro sinhf
Macro tanhf
Macro acosf
Macro asinf
Macro atanf
Macro atan2f
Macro logf
Macro log10f
Macro powf
Macro isnanf
Macro isinff
Macro isfinitef
Macro copysignf
Macro signbitf
Macro fdimf
Macro fmaf
Macro fmaxf
Macro fminf
Macro truncf
Macro roundf
Macro lroundf
Macro lrintf
<setjmp.h>: Non-local goto
Function setjmp()
Function longjmp()
<stdint.h>: Standard Integer Types
Exact-width integer types
Type int8_t
Type uint8_t
Type int16_t
Type uint16_t
Type int32_t
Type uint32_t
Type int64_t
Type uint64_t
Integer types capable of holding object pointers
Type intptr_t
Type uintptr_t
Minimum-width integer types
Type int_least8_t
Type uint_least8_t
Type int_least16_t
Type uint_least16_t
Type int_least32_t
Type uint_least32_t
Type int_least64_t
Type uint_least64_t
Fastest minimum-width integer types
Type int_fast8_t
Type uint_fast8_t
Type int_fast16_t
Type uint_fast16_t
Type int_fast32_t
Type uint_fast32_t
Type int_fast64_t
Type uint_fast64_t
Greatest-width integer types
Type intmax_t
Type uintmax_t
Limits of specified-width integer types
Macro INT8_MAX
Macro INT8_MIN
Macro UINT8_MAX
Macro INT16_MAX
Macro INT16_MIN
Macro UINT16_MAX
Macro INT32_MAX
Macro INT32_MIN
Macro UINT32_MAX
Macro INT64_MAX
Macro INT64_MIN
Macro UINT64_MAX
Limits of minimum-width integer types
Macro INT_LEAST8_MAX
Macro INT_LEAST8_MIN
Macro UINT_LEAST8_MAX
Macro INT_LEAST16_MAX
Macro INT_LEAST16_MIN
Macro UINT_LEAST16_MAX
Macro INT_LEAST32_MAX
Macro INT_LEAST32_MIN
Macro UINT_LEAST32_MAX
Macro INT_LEAST64_MAX
Macro INT_LEAST64_MIN
Macro UINT_LEAST64_MAX
Limits of fastest minimum-width integer types
Macro INT_FAST8_MAX
Macro INT_FAST8_MIN
Macro UINT_FAST8_MAX
Macro INT_FAST16_MAX
Macro INT_FAST16_MIN
Macro UINT_FAST16_MAX
Macro INT_FAST32_MAX
Macro INT_FAST32_MIN
Macro UINT_FAST32_MAX
Macro INT_FAST64_MAX
Macro INT_FAST64_MIN
Macro UINT_FAST64_MAX
Limits of integer types capable of holding object pointers
Macro INTPTR_MAX
Macro INTPTR_MIN
Macro UINTPTR_MAX
Limits of greatest-width integer types
Macro INTMAX_MAX
Macro INTMAX_MIN
Macro UINTMAX_MAX
Limits of other integer types
Macro PTRDIFF_MAX
Macro PTRDIFF_MIN
Macro SIG_ATOMIC_MAX
Macro SIG_ATOMIC_MIN
Macro SIZE_MAX
Macros for integer constants
Macro INT8_C
Macro UINT8_C
Macro INT16_C
Macro UINT16_C
Macro INT32_C
Macro UINT32_C
Macro INT64_C
Macro UINT64_C
Macro INTMAX_C
Macro UINTMAX_C
<stdio.h>: Standard IO facilities
Function fclose()
Function vfprintf()
Function vfprintf_P()
Function fputc()
Function printf()
Function printf_P()
Function vprintf()
Function sprintf()
Function sprintf_P()
Function snprintf()
Function snprintf_P()
Function vsprintf()
Function vsprintf_P()
Function vsnprintf()
Function vsnprintf_P()
Function fprintf()
Function fprintf_P()
Function fputs()
Function fputs_P()
Function puts()
Function puts_P()
Function fwrite()
Function fgetc()
Function ungetc()
Function fgets()
Function gets()
Function fread()
Function clearerr()
Function feof()
Function ferror()
Function vfscanf()
Function vfscanf_P()
Function fscanf()
Function fscanf_P()
Function scanf()
Function scanf_P()
Function vscanf()
Function sscanf()
Function sscanf_P()
Function fflush()
Function fdevopen()
Macro FILE
Macro stdin
Macro stdout
Macro stderr
Macro EOF
Macro fdev_set_udata
Macro fdev_get_udata
Macro fdev_setup_stream
Macro _FDEV_SETUP_READ
Macro _FDEV_SETUP_WRITE
Macro _FDEV_SETUP_RW
Macro _FDEV_ERR
Macro _FDEV_EOF
Macro FDEV_SETUP_STREAM
Macro fdev_close
Macro putc
Macro putchar
Macro getc
Macro getchar
<stdlib.h>: General utilities
Non-standard (i.e. non-ISO C) functions.
Function ltoa()
Function utoa()
Function ultoa()
Function random()
Function srandom()
Function random_r()
Function itoa()
Macro RANDOM_MAX
Conversion functions for double arguments.
Function dtostre()
Function dtostrf()
Macro DTOSTR_ALWAYS_SIGN
Macro DTOSTR_PLUS_SIGN
Macro DTOSTR_UPPERCASE
Macro EXIT_SUCCESS
Macro EXIT_FAILURE
Type __compar_fn_t
Variable __malloc_margin
Variable __malloc_heap_start
Variable __malloc_heap_end
Function abort()
Function abs()
Function labs()
Function bsearch()
Function div()
Function ldiv()
Function qsort()
Function strtol()
Function strtoul()
Function atol()
Function atoi()
Function exit()
Function malloc()
Function free()
Function calloc()
Function realloc()
Function strtod()
Function atof()
Function rand()
Function srand()
Function rand_r()
Macro RAND_MAX
<string.h>: Strings
Macro _FFS
Function ffs()
Function ffsl()
Function ffsll()
Function memccpy()
Function memchr()
Function memcmp()
Function memcpy()
Function memmem()
Function memmove()
Function memrchr()
Function memset()
Function strcasecmp()
Function strcasestr()
Function strcat()
Function strchr()
Function strchrnul()
Function strcmp()
Function strcpy()
Function strcspn()
Function strdup()
Function strlcat()
Function strlcpy()
Function strlen()
Function strlwr()
Function strncasecmp()
Function strncat()
Function strncmp()
Function strncpy()
Function strnlen()
Function strpbrk()
Function strrchr()
Function strrev()
Function strsep()
Function strspn()
Function strstr()
Function strtok()
Function strtok_r()
Function strupr()
<avr/boot.h>: Bootloader Support Utilities
Macro BOOTLOADER_SECTION
Macro boot_spm_interrupt_enable
Macro boot_spm_interrupt_disable
Macro boot_is_spm_interrupt
Macro boot_rww_busy
Macro boot_spm_busy
Macro boot_spm_busy_wait
Macro GET_LOW_FUSE_BITS
Macro GET_LOCK_BITS
Macro GET_EXTENDED_FUSE_BITS
Macro GET_HIGH_FUSE_BITS
Macro boot_lock_fuse_bits_get
Macro boot_signature_byte_get
Macro boot_page_fill
Macro boot_page_erase
Macro boot_page_write
Macro boot_rww_enable
Macro boot_lock_bits_set
Macro boot_page_fill_safe
Macro boot_page_erase_safe
Macro boot_page_write_safe
Macro boot_rww_enable_safe
Macro boot_lock_bits_set_safe
<avr/cpufunc.h>: Special AVR CPU functions
Macro _NOP
Macro _MemoryBarrier
<avr/eeprom.h>: EEPROM handling
IAR C compatibility defines
Macro _EEPUT
Macro __EEPUT
Macro _EEGET
Macro __EEGET
Function eeprom_read_byte()
Function eeprom_read_word()
Function eeprom_read_dword()
Function eeprom_read_float()
Function eeprom_read_block()
Function eeprom_write_byte()
Function eeprom_write_word()
Function eeprom_write_dword()
Function eeprom_write_float()
Function eeprom_write_block()
Function eeprom_update_byte()
Function eeprom_update_word()
Function eeprom_update_dword()
Function eeprom_update_float()
Function eeprom_update_block()
Macro EEMEM
Macro eeprom_is_ready
Macro eeprom_busy_wait
<avr/fuse.h>: Fuse Support
<avr/interrupt.h>: Interrupts
Global manipulation of the interrupt flag
Macro sei
Macro cli
Macros for writing interrupt handler functions
Macro ISR
Macro SIGNAL
Macro EMPTY_INTERRUPT
Macro ISR_ALIAS
Macro reti
Macro BADISR_vect
ISR attributes
Macro ISR_BLOCK
Macro ISR_NOBLOCK
Macro ISR_NAKED
Macro ISR_ALIASOF
<avr/io.h>: AVR device-specific IO definitions
Macro _PROTECTED_WRITE
<avr/lock.h>: Lockbit Support
<avr/pgmspace.h>: Program Space Utilities
Function strtok_P()
Function memcmp_PF()
Function memcpy_PF()
Function strcasecmp_PF()
Function strcat_PF()
Function strcmp_PF()
Function strcpy_PF()
Function strlcat_PF()
Function strlcpy_PF()
Function strlen_PF()
Function strncasecmp_PF()
Function strncat_PF()
Function strncmp_PF()
Function strncpy_PF()
Function strnlen_PF()
Function strstr_PF()
Macro PROGMEM
Macro PGM_P
Macro PGM_VOID_P
Macro PSTR
Macro pgm_read_byte_near
Macro pgm_read_word_near
Macro pgm_read_dword_near
Macro pgm_read_float_near
Macro pgm_read_ptr_near
Macro pgm_read_byte_far
Macro pgm_read_word_far
Macro pgm_read_dword_far
Macro pgm_read_float_far
Macro pgm_read_ptr_far
Macro pgm_read_byte
Macro pgm_read_word
Macro pgm_read_dword
Macro pgm_read_float
Macro pgm_read_ptr
Variable prog_void
Variable prog_char
Variable prog_uchar
Variable prog_int8_t
Variable prog_uint8_t
Variable prog_int16_t
Variable prog_uint16_t
Variable prog_int32_t
Variable prog_uint32_t
Variable prog_int64_t
Variable prog_uint64_t
<avr/power.h>: Power Reduction Management
Additional notes from <avr/sfr_defs.h>
<avr/sfr_defs.h>: Special function registers
Bit manipulation
Macro _BV
IO register bit manipulation
Macro bit_is_set
Macro bit_is_clear
Macro loop_until_bit_is_set
Macro loop_until_bit_is_clear
<avr/signature.h>: Signature Support
<avr/sleep.h>: Power Management and Sleep Modes
Function sleep_enable()
Function sleep_disable()
Function sleep_cpu()
<avr/version.h>: avr-libc version macros
Macro __AVR_LIBC_VERSION_STRING__
Macro __AVR_LIBC_VERSION__
Macro __AVR_LIBC_DATE_STRING__
Macro __AVR_LIBC_DATE_
Macro __AVR_LIBC_MAJOR__
Macro __AVR_LIBC_MINOR__
Macro __AVR_LIBC_REVISION__
<avr/wdt.h>: Watchdog timer handling
Function __attribute__()
Macro wdt_reset
Macro WDTO_15MS
Macro WDTO_30MS
Macro WDTO_60MS
Macro WDTO_120MS
Macro WDTO_250MS
Macro WDTO_500MS
Macro WDTO_1S
Macro WDTO_2S
Macro WDTO_4S
Macro WDTO_8S
<util/atomic.h> Atomically and Non-Atomically Executed Code Blocks
Macro ATOMIC_BLOCK
Macro NONATOMIC_BLOCK
Macro ATOMIC_RESTORESTATE
Macro ATOMIC_FORCEON
Macro NONATOMIC_RESTORESTATE
Macro NONATOMIC_FORCEOFF
<util/crc16.h>: CRC Computations
Function _crc16_update()
Function _crc_xmodem_update()
Function _crc_ccitt_update()
Function _crc_ibutton_update()
Function _crc8_ccitt_update()
<util/delay.h>: Convenience functions for busy-wait delay loops
Function _delay_ms()
Function _delay_us()
<util/delay_basic.h>: Basic busy-wait delay loops
Function _delay_loop_1()
Function _delay_loop_2()
<util/parity.h>: Parity bit generation
Macro parity_even_bit
<util/setbaud.h>: Helper macros for baud rate calculations
Macro BAUD_TOL
Macro UBRR_VALUE
Macro UBRRL_VALUE
Macro UBRRH_VALUE
Macro USE_2X
<util/twi.h>: TWI bit mask definitions
TWSR values
Macro TW_START
Macro TW_REP_START
Macro TW_MT_SLA_ACK
Macro TW_MT_SLA_NACK
Macro TW_MT_DATA_ACK
Macro TW_MT_DATA_NACK
Macro TW_MT_ARB_LOST
Macro TW_MR_ARB_LOST
Macro TW_MR_SLA_ACK
Macro TW_MR_SLA_NACK
Macro TW_MR_DATA_ACK
Macro TW_MR_DATA_NACK
Macro TW_ST_SLA_ACK
Macro TW_ST_ARB_LOST_SLA_ACK
Macro TW_ST_DATA_ACK
Macro TW_ST_DATA_NACK
Macro TW_ST_LAST_DATA
Macro TW_SR_SLA_ACK
Macro TW_SR_ARB_LOST_SLA_ACK
Macro TW_SR_GCALL_ACK
Macro TW_SR_ARB_LOST_GCALL_ACK
Macro TW_SR_DATA_ACK
Macro TW_SR_DATA_NACK
Macro TW_SR_GCALL_DATA_ACK
Macro TW_SR_GCALL_DATA_NACK
Macro TW_SR_STOP
Macro TW_NO_INFO
Macro TW_BUS_ERROR
Macro TW_STATUS_MASK
Macro TW_STATUS
R/~W bit in SLA+R/W address field.
Macro TW_READ
Macro TW_WRITE
<compat/deprecated.h>: Deprecated items
Allowing specific system-wide interrupts
Function timer_enable_int()
Macro enable_external_int
Macro INTERRUPT
Macro __INTR_ATTRS
Obsolete IO macros
Macro inp
Macro outp
Macro inb
Macro outb
Macro sbi
Macro cbi
<compat/ina90.h>: Compatibility with IAR EWB 3.x
Demo projects
Combining C and assembly source files
Hardware setup
A code walkthrough
asmdemo.c
project.h
isrs.S
The source code
A simple project
The Project
The Source Code
Compiling and Linking
Examining the Object File
Linker Map Files
Generating Intel Hex Files
Letting Make Build the Project
Reference to the source code
A more sophisticated project
Hardware setup
Functional overview
A code walkthrough
Part 1: Macro definitions
Part 2: Variable definitions
Part 3: Interrupt service routines
Part 4: Auxiliary functions
Part 5: main()
The source code
Using the standard IO facilities
Hardware setup
Functional overview
A code walkthrough
stdiodemo.c
defines.h
hd44780.h
hd44780.c
lcd.h
lcd.c
uart.h
uart.c
The source code
Example using the two-wire interface (TWI)
Introduction into TWI
The TWI example project
The Source Code
Structs
Struct div_t
Struct ldiv_t
Search Highlighter (On/Off)